Skip to content

Commit

Permalink
implement health modifier id for damage multiplier
Browse files Browse the repository at this point in the history
for controlling one named "type" of damage multiplier involving multiple parts (instead of proxies)

when multiple parts can be active at a time, it's probably simpler to have the option to cleanup like this instead of making a complex event setup to force all the others to hide for the reset on hide
  • Loading branch information
pingu7867 authored Mar 24, 2024
1 parent 3593b68 commit 152d670
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/pac3/extra/shared/net_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,16 @@ if SERVER then

local function AddDamageScale(ply, id,scale, part_uid)
ply.pac_damage_scalings = ply.pac_damage_scalings or {}
ply.pac_damage_scalings[part_uid] = {scale = scale, id = id, uid = part_uid}
if id == "" then --no mod id = part uid mode, don't overwrite another part
ply.pac_damage_scalings[part_uid] = {scale = scale, id = id, uid = part_uid}
else --mod id = try to remove competing parts whose multipliers have the same mod id
for existing_uid,tbl in pairs(ply.pac_damage_scalings) do
if tbl.id == id then
ply.pac_damage_scalings[existing_uid] = nil
end
end
ply.pac_damage_scalings[part_uid] = {scale = scale, id = id, uid = part_uid}
end
end

local function FixMaxHealths(ply)
Expand Down

0 comments on commit 152d670

Please sign in to comment.