From 36427d5aef0650935e35be59b6236ae1756f4fbc Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Fri, 7 Oct 2022 13:32:25 -0500 Subject: [PATCH] Check enable damage instead of creative mode in some cases --- mods/ENTITIES/mcl_burning/api.lua | 7 +++++-- mods/ENTITIES/mcl_mobs/api.lua | 1 - mods/ENTITIES/mobs_mc/enderman.lua | 3 ++- mods/PLAYER/mcl_playerplus/init.lua | 3 --- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_burning/api.lua b/mods/ENTITIES/mcl_burning/api.lua index 1d07e96f0..df0953398 100644 --- a/mods/ENTITIES/mcl_burning/api.lua +++ b/mods/ENTITIES/mcl_burning/api.lua @@ -1,3 +1,5 @@ +local enable_damage = minetest.settings:get_bool("enable_damage") + function mcl_burning.get_storage(obj) return obj:is_player() and mcl_burning.storage[obj] or obj:get_luaentity() end @@ -77,7 +79,7 @@ end -- The effective burn duration is modified by obj's armor protection. -- If obj was already burning, its burn duration is updated if the current -- duration is less than burn_time. --- If obj is dead, fireproof or a creative player, this function does nothing. +-- If obj is dead, fireproof or enable_damage is disabled, this function does nothing. -- function mcl_burning.set_on_fire(obj, burn_time) if obj:get_hp() < 0 then @@ -89,8 +91,9 @@ function mcl_burning.set_on_fire(obj, burn_time) return end - if obj:is_player() and minetest.is_creative_enabled(obj:get_player_name()) then + if obj:is_player() and not enable_damage then burn_time = 0 + return else local max_fire_prot_lvl = 0 local inv = mcl_util.get_inventory(obj) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 3fd374fd6..093c56ace 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1910,7 +1910,6 @@ end -- find someone to attack local monster_attack = function(self) if not damage_enabled - or minetest.is_creative_enabled("") or self.passive ~= false or self.state == "attack" or day_docile(self) then diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index c5923d4df..296963ef2 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -42,6 +42,7 @@ minetest.register_entity("mobs_mc:ender_eyes", { }) local S = minetest.get_translator("mobs_mc") +local enable_damage = minetest.settings:get_bool("enable_damage") local telesound = function(pos, is_source) local snd @@ -412,7 +413,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { -- self:teleport(nil) -- self.state = "" --else - if self.attack ~= nil and not minetest.settings:get_bool("creative_mode") then + if self.attack ~= nil and enable_damage then self.state = 'attack' end --end diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e9bfc5b9e..85cfaf561 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -605,9 +605,6 @@ end) -- Don't change HP if the player falls in the water or through End Portal: mcl_damage.register_modifier(function(obj, damage, reason) if reason.type == "fall" then - if minetest.is_creative_enabled(obj:get_player_name()) then - return 0 - end local pos = obj:get_pos() local node = minetest.get_node(pos) local velocity = obj:get_velocity() or obj:get_player_velocity() or {x=0,y=-10,z=0}