possibility of no damage if enable_damage or in protected areas
parent
899027749d
commit
87858643f9
|
@ -47,13 +47,22 @@ end
|
|||
|
||||
function petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
local pos = self.object:get_pos() --pos of the petz
|
||||
if not mobkit.is_alive(self) then --is petz alive
|
||||
if not(mobkit.is_alive(self)) then --is petz is died
|
||||
return
|
||||
end
|
||||
--Do not punch when you are mounted on it!!!-->
|
||||
if self.is_mountable and puncher == self.driver then
|
||||
return
|
||||
end
|
||||
--Check the setting 'check_enable_damage'
|
||||
if petz.settings.check_enable_damage and
|
||||
not(minetest.setting_getbool("enable_damage")) then
|
||||
return
|
||||
end
|
||||
--Check area protection
|
||||
if petz.settings.no_damage_in_protected and minetest.is_protected(pos, puncher:get_player_name()) then
|
||||
return
|
||||
end
|
||||
--Check Dreamcatcher Protection
|
||||
local puncher_is_player = petz.puncher_is_player(puncher)
|
||||
if puncher_is_player then --player
|
||||
|
|
|
@ -179,6 +179,13 @@ lycanthropy = true
|
|||
lycanthropy_infection_chance_by_wolf = 200
|
||||
lycanthropy_infection_chance_by_werewolf = 10
|
||||
|
||||
##Damage Engine
|
||||
#If this setting is 'true', checks the "enable_damage" setting of the game
|
||||
#and if 'enable_damage=false', disables the damage for pets too.
|
||||
check_enable_damage = false
|
||||
#Petz are not damaged in protected areas
|
||||
no_damage_in_protected = true
|
||||
|
||||
##Enviromental Damage
|
||||
air_damage = 1
|
||||
#Lava & Fire
|
||||
|
|
|
@ -79,6 +79,17 @@ local settings_def = {
|
|||
split = true,
|
||||
default = "",
|
||||
},
|
||||
--Damage Engine
|
||||
{
|
||||
name = "check_enable_damage",
|
||||
type = "boolean",
|
||||
default = false,
|
||||
},
|
||||
{
|
||||
name = "no_damage_in_protected",
|
||||
type = "boolean",
|
||||
default = false,
|
||||
},
|
||||
--Enviromental Damage
|
||||
{
|
||||
name = "air_damage",
|
||||
|
|
Loading…
Reference in New Issue