diff --git a/init.lua b/init.lua index 11e01b8..5fbe530 100644 --- a/init.lua +++ b/init.lua @@ -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, +}) diff --git a/lib_planes/utilities.lua b/lib_planes/utilities.lua index f26b9d2..cf79dcf 100644 --- a/lib_planes/utilities.lua +++ b/lib_planes/utilities.lua @@ -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 +