added option to disable blast damage

This commit is contained in:
Alexsandro Percy 2023-08-25 22:35:10 -03:00
parent beddd07827
commit cc10bd1fef
2 changed files with 28 additions and 1 deletions

View file

@ -1,5 +1,7 @@
-- Minetest 5.4.1 : airutils
local storage = minetest.get_mod_storage()
airutils = {}
airutils.colors ={
@ -20,6 +22,11 @@ airutils.colors ={
yellow='#ffe400',
}
local load_blast_damage = storage:get_int("blast_damage")
airutils.blast_damage = true
-- 1 == true ---- 2 == false
if load_blast_damage == 2 then airutils.blast_damage = false end
airutils.is_minetest = minetest.get_modpath("player_api")
airutils.is_mcl = minetest.get_modpath("mcl_player")
@ -449,3 +456,20 @@ end
function airutils.normalize_rotations(rotations)
return {x = get_norm_angle(rotations.x), y = get_norm_angle(rotations.y), z = get_norm_angle(rotations.z)}
end
minetest.register_chatcommand("enable_blast_damage", {
func = function(name, param)
local command = param
if command == "false" then
airutils.blast_damage = false
minetest.chat_send_player(name, ">>> Blast damage by explosion is disabled")
else
airutils.blast_damage = true
minetest.chat_send_player(name, ">>> Blast damage by explosion is enabled")
end
local save = 2
if airutils.blast_damage == true then save = 1 end
storage:set_int("blast_damage", save)
end,
})

View file

@ -283,7 +283,9 @@ function airutils.destroy(self, by_name)
airutils.destroy_inventory(self)
self.object:remove()
airutils.add_blast_damage(pos, 5 + 4, 10)
if airutils.blast_damage == true and with_fire == true then
airutils.add_blast_damage(pos, 7, 10)
end
--[[pos.y=pos.y+2
minetest.add_item({x=pos.x+math.random()-0.5,y=pos.y,z=pos.z+math.random()-0.5},'hidroplane:wings')
@ -1010,3 +1012,4 @@ function airutils.get_adf_angle(self, pos)
return adf
end