diff options
author | number Zero <silverunicorn2011@yandex.ru> | 2016-04-10 21:55:37 +0300 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2017-02-25 20:55:15 -0500 |
commit | cbe97434dc6524cb8fc5163936e726db095ab222 (patch) | |
tree | e1b61a1605ae393eef2ba13951dca00306651f91 | |
parent | 73afc40d9c9125c2e07137422569c30150e0d84c (diff) |
Add option to disable radiation protection
-rw-r--r-- | technic/config.lua | 1 | ||||
-rw-r--r-- | technic/radiation.lua | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/technic/config.lua b/technic/config.lua index c253612..29321f9 100644 --- a/technic/config.lua +++ b/technic/config.lua @@ -9,6 +9,7 @@ local defaults = { enable_wind_mill = "false", enable_frames = "false", enable_corium_griefing = "true", + enable_radiation_protection = "true", enable_entity_radiation_damage = "true", enable_longterm_radiation_damage = "true", } diff --git a/technic/radiation.lua b/technic/radiation.lua index bbe1eec..13936f9 100644 --- a/technic/radiation.lua +++ b/technic/radiation.lua @@ -242,6 +242,7 @@ local cache_scaled_shielding = {} local rad_dmg_cutoff = 0.2 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 longterm_damage = technic.config:get_bool("enable_longterm_radiation_damage") @@ -303,15 +304,21 @@ end local function dmg_object(pos, object, strength) local obj_pos = vector.add(object:getpos(), calculate_object_center(object)) - local mul = calculate_damage_multiplier(object) - if mul == 0 then - return + local mul + if armor_enabled or entity_damage then + -- we need to check may the object be damaged even if armor is disabled + mul = calculate_damage_multiplier(object) + if mul == 0 then + return + end end local dmg = calculate_base_damage(pos, obj_pos, strength) if not dmg then return end - dmg = dmg * mul + if armor_enabled then + dmg = dmg * mul + end apply_fractional_damage(object, dmg) if longterm_damage and object:is_player() then local pn = object:get_player_name() |