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)
|
function petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||||
local pos = self.object:get_pos() --pos of the petz
|
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
|
return
|
||||||
end
|
end
|
||||||
--Do not punch when you are mounted on it!!!-->
|
--Do not punch when you are mounted on it!!!-->
|
||||||
if self.is_mountable and puncher == self.driver then
|
if self.is_mountable and puncher == self.driver then
|
||||||
return
|
return
|
||||||
end
|
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
|
--Check Dreamcatcher Protection
|
||||||
local puncher_is_player = petz.puncher_is_player(puncher)
|
local puncher_is_player = petz.puncher_is_player(puncher)
|
||||||
if puncher_is_player then --player
|
if puncher_is_player then --player
|
||||||
|
|
|
@ -179,6 +179,13 @@ lycanthropy = true
|
||||||
lycanthropy_infection_chance_by_wolf = 200
|
lycanthropy_infection_chance_by_wolf = 200
|
||||||
lycanthropy_infection_chance_by_werewolf = 10
|
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
|
##Enviromental Damage
|
||||||
air_damage = 1
|
air_damage = 1
|
||||||
#Lava & Fire
|
#Lava & Fire
|
||||||
|
|
|
@ -79,6 +79,17 @@ local settings_def = {
|
||||||
split = true,
|
split = true,
|
||||||
default = "",
|
default = "",
|
||||||
},
|
},
|
||||||
|
--Damage Engine
|
||||||
|
{
|
||||||
|
name = "check_enable_damage",
|
||||||
|
type = "boolean",
|
||||||
|
default = false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "no_damage_in_protected",
|
||||||
|
type = "boolean",
|
||||||
|
default = false,
|
||||||
|
},
|
||||||
--Enviromental Damage
|
--Enviromental Damage
|
||||||
{
|
{
|
||||||
name = "air_damage",
|
name = "air_damage",
|
||||||
|
|
Loading…
Reference in New Issue