diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2016-12-29 15:28:53 +0000 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2016-12-29 15:28:53 +0000 |
commit | f7798e1b29c6d4620d8dd8c8053ef4c110d2a9fc (patch) | |
tree | 41eb580450147c4e0dfbfe0d52c745a99ebd4f03 /mount.lua | |
parent | ef3217d77f6cb5fb5259b673eea99e5af6da8fee (diff) |
added dtime to drive function
Diffstat (limited to 'mount.lua')
-rw-r--r-- | mount.lua | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -18,6 +18,10 @@ local function node_is(pos) return "air" end + if minetest.get_item_group(node.name, "lava") ~= 0 then + return "lava" + end + if minetest.get_item_group(node.name, "liquid") ~= 0 then return "liquid" end @@ -155,7 +159,7 @@ function mobs.detach(player, offset) end -function mobs.drive(entity, moving_anim, stand_anim, can_fly) +function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime) local rot_steer, rot_view = math.pi/2, 0 @@ -283,7 +287,27 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly) new_acce.y = 0 end - elseif ni == "liquid" then + elseif ni == "liquid" or ni == "lava" then + + if ni == "lava" and entity.lava_damage ~= 0 then + + entity.lava_counter = (entity.lava_counter or 0) + dtime + + if entity.lava_counter > 1 then + + minetest.sound_play("default_punch", { + object = entity.object, + max_hear_distance = 5 + }) + + entity.object:punch(entity.object, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = entity.lava_damage} + }, nil) + + entity.lava_counter = 0 + end + end if entity.terrain_type == 2 or entity.terrain_type == 3 then @@ -309,7 +333,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly) end end else - v = v*0.25 + v = v * 0.25 end -- elseif ni == "walkable" then -- v = 0 |