mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 17:09:32 +01:00
Merge pull request 'Check enable damage instead of creative mode when appropriate' (#2726) from enable_damage into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2726 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
aea899a569
4 changed files with 7 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue