mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-23 16:00:16 +01:00
add nodes to immune_to ability.
This commit is contained in:
parent
6a7c221ce1
commit
527fe8c2d5
19
api.lua
19
api.lua
@ -19,7 +19,7 @@ end
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20241122",
|
version = "20241127",
|
||||||
spawning_mobs = {},
|
spawning_mobs = {},
|
||||||
translate = S,
|
translate = S,
|
||||||
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
||||||
@ -1039,9 +1039,22 @@ function mob_class:do_env_damage()
|
|||||||
if self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0
|
if self.node_damage and nodef.damage_per_second and nodef.damage_per_second ~= 0
|
||||||
and nodef.groups.lava == nil and nodef.groups.fire == nil then
|
and nodef.groups.lava == nil and nodef.groups.fire == nil then
|
||||||
|
|
||||||
self.health = self.health - nodef.damage_per_second
|
local damage = nodef.damage_per_second
|
||||||
|
|
||||||
effect(py, 5, "tnt_smoke.png")
|
-- check for node immunity or special damage
|
||||||
|
for n = 1, #self.immune_to do
|
||||||
|
|
||||||
|
if self.immune_to[n][1] == self.standing_in then
|
||||||
|
|
||||||
|
damage = self.immune_to[n][2] or 0
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.health = self.health - damage
|
||||||
|
|
||||||
|
if damage > 0 then effect(py, 5, "tnt_smoke.png") end
|
||||||
|
|
||||||
if self:check_for_death({type = "environment",
|
if self:check_for_death({type = "environment",
|
||||||
pos = pos, node = self.standing_in}) then return true end
|
pos = pos, node = self.standing_in}) then return true end
|
||||||
|
5
api.txt
5
api.txt
@ -85,8 +85,6 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
'fire_damage' holds the damage per second inflicted to mobs when standing
|
'fire_damage' holds the damage per second inflicted to mobs when standing
|
||||||
'node_damage' True by default, will harm mobs when inside damage_per_second
|
'node_damage' True by default, will harm mobs when inside damage_per_second
|
||||||
nodes.
|
nodes.
|
||||||
in fire.
|
|
||||||
|
|
||||||
'light_damage' holds the damage per second inflicted to mobs when light
|
'light_damage' holds the damage per second inflicted to mobs when light
|
||||||
level is between the min and max values below
|
level is between the min and max values below
|
||||||
'light_damage_min' minimum light value when mob is affected (default: 14)
|
'light_damage_min' minimum light value when mob is affected (default: 14)
|
||||||
@ -178,6 +176,9 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
{"default:gold_lump", -10} -- heals by 10 health points.
|
{"default:gold_lump", -10} -- heals by 10 health points.
|
||||||
{"default:coal_block", 20} -- 20 damage when hit on head with coal blocks.
|
{"default:coal_block", 20} -- 20 damage when hit on head with coal blocks.
|
||||||
{"all"} -- stops all weapons causing damage apart from those on list.
|
{"all"} -- stops all weapons causing damage apart from those on list.
|
||||||
|
nodes can also be added so that node_per_second damage
|
||||||
|
does not affect the mob either e.g.
|
||||||
|
{"ethereal:crystal_spike", 0} -- causes no damage.
|
||||||
|
|
||||||
'makes_footstep_sound' when true you can hear mobs walking.
|
'makes_footstep_sound' when true you can hear mobs walking.
|
||||||
'sounds' this is a table with sounds of the mob
|
'sounds' this is a table with sounds of the mob
|
||||||
|
Loading…
Reference in New Issue
Block a user