mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 10:10:21 +01:00
fix damage_per_sec checks wit some nested if's, add custom on_activate to arrows
This commit is contained in:
parent
d6ff282917
commit
608a5178cf
32
api.lua
32
api.lua
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
-- Mobs Api (27th May 2017)
|
-- Mobs Api (28th May 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
mobs.version = "20170527"
|
mobs.version = "20170528"
|
||||||
|
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
@ -550,7 +550,7 @@ local do_env_damage = function(self)
|
|||||||
-- what is mob standing in?
|
-- what is mob standing in?
|
||||||
pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level
|
pos.y = pos.y + self.collisionbox[2] + 0.1 -- foot level
|
||||||
self.standing_in = node_ok(pos, "air").name
|
self.standing_in = node_ok(pos, "air").name
|
||||||
--print ("standing in " .. self.standing_in)
|
-- print ("standing in " .. self.standing_in)
|
||||||
|
|
||||||
-- don't fall when on ignore, just stand still
|
-- don't fall when on ignore, just stand still
|
||||||
if self.standing_in == "ignore" then
|
if self.standing_in == "ignore" then
|
||||||
@ -566,26 +566,30 @@ local do_env_damage = function(self)
|
|||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
-- water
|
-- water
|
||||||
if self.water_damage ~= 0
|
if nodef.groups.water then
|
||||||
and nodef.groups.water then
|
|
||||||
|
|
||||||
self.health = self.health - self.water_damage
|
if self.water_damage ~= 0 then
|
||||||
|
|
||||||
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
self.health = self.health - self.water_damage
|
||||||
|
|
||||||
if check_for_death(self, "water") then return end
|
effect(pos, 5, "bubble.png", nil, nil, 1, nil)
|
||||||
|
|
||||||
|
if check_for_death(self, "water") then return end
|
||||||
|
end
|
||||||
|
|
||||||
-- lava or fire
|
-- lava or fire
|
||||||
elseif self.lava_damage ~= 0
|
elseif (nodef.groups.lava
|
||||||
and (nodef.groups.lava
|
|
||||||
or self.standing_in == "fire:basic_flame"
|
or self.standing_in == "fire:basic_flame"
|
||||||
or self.standing_in == "fire:permanent_flame") then
|
or self.standing_in == "fire:permanent_flame") then
|
||||||
|
|
||||||
self.health = self.health - self.lava_damage
|
if self.lava_damage ~= 0 then
|
||||||
|
|
||||||
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
self.health = self.health - self.lava_damage
|
||||||
|
|
||||||
if check_for_death(self, "lava") then return end
|
effect(pos, 5, "fire_basic_flame.png", nil, nil, 1, nil)
|
||||||
|
|
||||||
|
if check_for_death(self, "lava") then return end
|
||||||
|
end
|
||||||
|
|
||||||
-- damage_per_second node check
|
-- damage_per_second node check
|
||||||
elseif minetest.registered_nodes[self.standing_in].damage_per_second ~= 0 then
|
elseif minetest.registered_nodes[self.standing_in].damage_per_second ~= 0 then
|
||||||
@ -2879,6 +2883,8 @@ function mobs:register_arrow(name, def)
|
|||||||
automatic_face_movement_dir = def.rotate
|
automatic_face_movement_dir = def.rotate
|
||||||
and (def.rotate - (pi / 180)) or false,
|
and (def.rotate - (pi / 180)) or false,
|
||||||
|
|
||||||
|
on_activate = def.on_activate or nil,
|
||||||
|
|
||||||
on_step = def.on_step or function(self, dtime)
|
on_step = def.on_step or function(self, dtime)
|
||||||
|
|
||||||
self.timer = self.timer + 1
|
self.timer = self.timer + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user