mirror of
https://github.com/minetest-mods/technic.git
synced 2024-11-10 20:40:27 +01:00
Armor may be disabled now
This commit is contained in:
parent
958e1d402d
commit
47742ee3e9
|
@ -9,6 +9,7 @@ local defaults = {
|
||||||
enable_wind_mill = "false",
|
enable_wind_mill = "false",
|
||||||
enable_frames = "false",
|
enable_frames = "false",
|
||||||
enable_corium_griefing = "true",
|
enable_corium_griefing = "true",
|
||||||
|
enable_radiation_protection = "true",
|
||||||
enable_entity_radiation_damage = "true",
|
enable_entity_radiation_damage = "true",
|
||||||
enable_longterm_radiation_damage = "true",
|
enable_longterm_radiation_damage = "true",
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,6 +242,7 @@ local cache_scaled_shielding = {}
|
||||||
local rad_dmg_cutoff = 0.2
|
local rad_dmg_cutoff = 0.2
|
||||||
local radiated_players = {}
|
local radiated_players = {}
|
||||||
|
|
||||||
|
local armor_enabled = technic.config:get_bool("enable_radiation_protection")
|
||||||
local entity_damage = technic.config:get_bool("enable_entity_radiation_damage")
|
local entity_damage = technic.config:get_bool("enable_entity_radiation_damage")
|
||||||
local longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage")
|
local longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage")
|
||||||
|
|
||||||
|
@ -303,15 +304,20 @@ end
|
||||||
|
|
||||||
local function dmg_object(pos, object, strength)
|
local function dmg_object(pos, object, strength)
|
||||||
local obj_pos = vector.add(object:getpos(), calculate_object_center(object))
|
local obj_pos = vector.add(object:getpos(), calculate_object_center(object))
|
||||||
local mul = calculate_damage_multiplier(object)
|
if armor_enabled or entity_damage then
|
||||||
if mul == 0 then
|
-- we need to check may the object be damaged even if armor is disabled
|
||||||
return
|
local mul = calculate_damage_multiplier(object)
|
||||||
|
if mul == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local dmg = calculate_base_damage(pos, obj_pos, strength)
|
local dmg = calculate_base_damage(pos, obj_pos, strength)
|
||||||
if not dmg then
|
if not dmg then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
dmg = dmg * mul
|
if armor_enabled then
|
||||||
|
dmg = dmg * mul
|
||||||
|
end
|
||||||
apply_fractional_damage(object, dmg)
|
apply_fractional_damage(object, dmg)
|
||||||
if longterm_damage and object:is_player() then
|
if longterm_damage and object:is_player() then
|
||||||
local pn = object:get_player_name()
|
local pn = object:get_player_name()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user