Skip to content

Commit

Permalink
Set a limit on Placestation height.
Browse files Browse the repository at this point in the history
  • Loading branch information
GoogleFrog committed Aug 31, 2019
1 parent b6dcc70 commit ff31392
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions LuaRules/Configs/area_damage_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ for id, data in pairs(WeaponDefs) do
duration = tonumber(cp.area_damage_duration) * 30,
rangeFall = tonumber(cp.area_damage_range_falloff),
timeFall = tonumber(cp.area_damage_time_falloff),
heightMax = tonumber(cp.area_damage_height_max),
heightInt = tonumber(cp.area_damage_height_int),
heightReduce = tonumber(cp.area_damage_height_reduce),
}
array[id].timeLoss = array[id].damage * array[id].timeFall * DAMAGE_PERIOD/array[id].duration
end
Expand Down
23 changes: 21 additions & 2 deletions LuaRules/Gadgets/weapon_area_damage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,33 @@ end

function gadget:Explosion(weaponID, px, py, pz, ownerID)
if (weaponInfo[weaponID]) then
local weaponDamage = weaponInfo[weaponID].damage
local timeLoss = weaponInfo[weaponID].timeLoss
local heightMax = weaponInfo[weaponID].heightMax
if heightMax then
local heightInt = weaponInfo[weaponID].heightInt or heightMax
local height = (py - math.max(0, Spring.GetGroundHeight(px, pz) or 0))
if height > heightMax then
return false
elseif height > heightMax - heightInt then
local mult = ((heightMax - height)/heightInt)
weaponDamage = weaponDamage*mult
timeLoss = timeLoss*mult
local heightReduce = weaponInfo[weaponID].heightReduce
if heightReduce then
py = py - (1 - mult)*heightReduce
end
end
end

explosionCount = explosionCount + 1
explosionList[explosionCount] = {
radius = weaponInfo[weaponID].radius,
damage = weaponInfo[weaponID].damage,
damage = weaponDamage,
impulse = weaponInfo[weaponID].impulse,
expiry = frameNum + weaponInfo[weaponID].duration,
rangeFall = weaponInfo[weaponID].rangeFall,
timeLoss = weaponInfo[weaponID].timeLoss,
timeLoss = timeLoss,
id = weaponID,
pos = {x = px, y = py, z = pz},
owner=ownerID,
Expand Down
3 changes: 3 additions & 0 deletions units/jumpblackhole.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ unitDef = {
area_damage_duration = 13.3,
area_damage_range_falloff = 0.4,
area_damage_time_falloff = 0.6,
area_damage_height_max = 1200,
area_damage_height_int = 400,
area_damage_height_reduce = 160,

light_color = [[1 1 1]],
light_radius = 500,
Expand Down

0 comments on commit ff31392

Please sign in to comment.