Skip to content

Commit

Permalink
Add option to disable radiation protection
Browse files Browse the repository at this point in the history
  • Loading branch information
numberZero authored and ShadowNinja committed Feb 26, 2017
1 parent 73afc40 commit cbe9743
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions technic/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down
15 changes: 11 additions & 4 deletions technic/radiation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit cbe9743

Please sign in to comment.