mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Make undead mobs burn in sunlight instead of dealing damage directly
This commit is contained in:
parent
8ba8f62527
commit
081ae7fbff
@ -1053,8 +1053,11 @@ local do_env_damage = function(self)
|
||||
if mod_worlds then
|
||||
_, dim = mcl_worlds.y_to_layer(pos.y)
|
||||
end
|
||||
if self.sunlight_damage ~= 0 and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||
if deal_light_damage(self, pos, self.sunlight_damage) then
|
||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (minetest.get_node_light(pos) or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||
if self.ignited_by_sunlight then
|
||||
mcl_burning.set_on_fire(self.object, 10, self.sunlight_damage or 1)
|
||||
else
|
||||
deal_light_damage(self, pos, self.sunlight_damage)
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -3813,6 +3816,7 @@ minetest.register_entity(name, {
|
||||
instant_death = def.instant_death or false,
|
||||
fire_resistant = def.fire_resistant or false,
|
||||
fire_damage_resistant = def.fire_damage_resistant or false,
|
||||
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
||||
-- End of MCL2 extensions
|
||||
|
||||
on_spawn = def.on_spawn,
|
||||
|
@ -251,6 +251,7 @@ functions needed for the mob to work properly which contains the following:
|
||||
'xp_max' the maximum XP it drops on death (default: 0)
|
||||
'fire_resistant' If true, the mob can't burn
|
||||
'fire_damage_resistant' If true the mob will not take damage when burning
|
||||
'ignited_by_sunlight' If true the mod will burn at daytime. (Takes sunlight_damage per second)
|
||||
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ local skeleton = {
|
||||
die_speed = 15,
|
||||
die_loop = false,
|
||||
},
|
||||
sunlight_damage = 1,
|
||||
ignited_by_sunlight = true,
|
||||
view_range = 16,
|
||||
fear_height = 4,
|
||||
attack_type = "dogshoot",
|
||||
|
@ -82,7 +82,8 @@ mobs:register_mob("mobs_mc:villager_zombie", {
|
||||
run_start = 0,
|
||||
run_end = 20,
|
||||
},
|
||||
sunlight_damage = 1,
|
||||
sunlight_damage = 2,
|
||||
ignited_by_sunlight = true,
|
||||
view_range = 16,
|
||||
fear_height = 4,
|
||||
harmed_by_heal = true,
|
||||
|
@ -85,6 +85,7 @@ local zombie = {
|
||||
walk_start = 0, walk_end = 40,
|
||||
run_start = 0, run_end = 40,
|
||||
},
|
||||
ignited_by_sunlight = true,
|
||||
sunlight_damage = 2,
|
||||
view_range = 16,
|
||||
attack_type = "dogfight",
|
||||
@ -111,6 +112,7 @@ mobs:register_mob("mobs_mc:baby_zombie", baby_zombie)
|
||||
-- Desert variant of the zombie
|
||||
local husk = table.copy(zombie)
|
||||
husk.textures = {{"mobs_mc_husk.png"}}
|
||||
husk.ignited_by_sunlight = false
|
||||
husk.sunlight_damage = 0
|
||||
husk.drops = drops_common
|
||||
-- TODO: Husks avoid water
|
||||
|
Loading…
Reference in New Issue
Block a user