diff --git a/api.lua b/api.lua index e606d5e..f63f9d7 100644 --- a/api.lua +++ b/api.lua @@ -3,7 +3,7 @@ mobs = {} mobs.mod = "redo" -mobs.version = "20180523" +mobs.version = "20180530" -- Intllib @@ -289,13 +289,12 @@ end -- are we flying in what we are suppose to? (taikedz) local flight_check = function(self, pos_w) - local nod = self.standing_in - local def = minetest.registered_nodes[nod] + local def = minetest.registered_nodes[self.standing_in] if not def then return false end -- nil check if type(self.fly_in) == "string" - and nod == self.fly_in then + and self.standing_in == self.fly_in then return true @@ -303,7 +302,7 @@ local flight_check = function(self, pos_w) for _,fly_in in pairs(self.fly_in) do - if nod == fly_in then + if self.standing_in == fly_in then return true end @@ -626,7 +625,7 @@ local do_env_damage = function(self) if check_for_death(self, "light", {type = "light"}) then return end end - +--[[ local y_level = self.collisionbox[2] if self.child then @@ -637,7 +636,7 @@ local do_env_damage = function(self) pos.y = pos.y + y_level + 0.25 -- foot level self.standing_in = node_ok(pos, "air").name -- print ("standing in " .. self.standing_in) - +]] -- don't fall when on ignore, just stand still if self.standing_in == "ignore" then self.object:setvelocity({x = 0, y = 0, z = 0}) @@ -2289,13 +2288,13 @@ local falling = function(self, pos) end -- in water then float up - if minetest.registered_nodes[node_ok(pos).name].groups.water then + if minetest.registered_nodes[self.standing_in].groups.water then if self.floats == 1 then self.object:setacceleration({ x = 0, - y = -self.fall_speed / (max(1, v.y) ^ 2), + y = -self.fall_speed / (max(1, v.y) ^ 8), -- 8 was 2 z = 0 }) end @@ -2395,6 +2394,10 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) damage = self.immune_to[n][2] or 0 break + + -- if "all" then no tool does damage unless it's specified in list + elseif self.immune_to[n][1] == "all" then + damage = self.immune_to[n][2] or 0 end end @@ -2751,7 +2754,7 @@ local mob_activate = function(self, staticdata, def, dtime) self.collisionbox = colbox self.selectionbox = selbox self.visual_size = vis_size - self.standing_in = "" + self.standing_in = "air" -- check existing nametag if not self.nametag then @@ -2828,6 +2831,26 @@ local mob_step = function(self, dtime) end end + -- get node at foot level every quarter second + self.node_timer = (self.node_timer or 0) + dtime + + if self.node_timer > 0.25 then + + self.node_timer = 0 + + local y_level = self.collisionbox[2] + + if self.child then + y_level = self.collisionbox[2] * 0.5 + end + + -- what is mob standing in? + self.standing_in = node_ok({ + x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name +-- print ("standing in " .. self.standing_in) + end + + -- check if falling, flying, floating falling(self, pos) -- smooth rotation by ThomasMonroe314 diff --git a/api.txt b/api.txt index 324ae90..40dbf51 100644 --- a/api.txt +++ b/api.txt @@ -126,6 +126,7 @@ functions needed for the mob to work properly which contains the following: {"default:sword_wood", 0} -- causes no damage. {"default:gold_lump", -10} -- heals by 10 health points. {"default:coal_block", 20} -- 20 damage when hit on head with coal blocks. + {"all"} -- stops all weapons causing damage apart from those on list. 'makes_footstep_sound' when true you can hear mobs walking. 'sounds' this is a table with sounds of the mob diff --git a/crafts.lua b/crafts.lua index 1e98f64..0bf42ad 100644 --- a/crafts.lua +++ b/crafts.lua @@ -176,3 +176,9 @@ minetest.register_craft({ recipe = "mobs:saddle", burntime = 7, }) + +minetest.register_craft({ + type = "fuel", + recipe = "mobs:fence_wood", + burntime = 7, +}) diff --git a/lucky_block.lua b/lucky_block.lua index 7da0040..8cf20ed 100644 --- a/lucky_block.lua +++ b/lucky_block.lua @@ -6,10 +6,12 @@ if minetest.get_modpath("lucky_block") then {"dro", {"mobs:meat"}, 5}, {"dro", {"mobs:nametag"}, 1}, {"dro", {"mobs:leather"}, 5}, + {"dro", {"default:stick"}, 10}, {"dro", {"mobs:net"}, 1}, {"dro", {"mobs:lasso"}, 1}, {"dro", {"mobs:shears"}, 1}, {"dro", {"mobs:protector"}, 1}, + {"dro", {"mobs:fence_wood"}, 10}, {"lig"}, }) end diff --git a/readme.MD b/readme.MD index 68b03e7..b555b34 100644 --- a/readme.MD +++ b/readme.MD @@ -22,6 +22,7 @@ Lucky Blocks: 9 Changelog: +- 1.42- Added "all" option to immune_to table, tidied floating mobs to be less intensive - 1.41- Mob pathfinding has been updated thanks to Elkien3 - 1.40- Updated to use newer functions, requires Minetest 0.4.16+ to work. - 1.39- Added 'on_breed', 'on_grown' and 'do_punch' custom functions per mob