Skip to content

Commit

Permalink
Recon comm fixes:
Browse files Browse the repository at this point in the history
 * fix Disruptor Bomb + Personal Shield incompatibility
 * fix not retaining the peashooter after picking an adv. weapon
  • Loading branch information
sprunk committed Sep 30, 2016
1 parent c1fa11f commit 045c9d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LuaRules/Gadgets/unit_commander_upgrade.lua
Expand Up @@ -92,7 +92,7 @@ end
local function ApplyWeaponData(unitID, weapon1, weapon2, shield, rangeMult)
if (not weapon2) and weapon1 then
local unitDefID = Spring.GetUnitDefID(unitID)
local weaponName = UnitDefs[unitDefID].name .. "_" .. weapon1
local weaponName = "0_" .. weapon1

This comment has been minimized.

Copy link
@Anarchid

Anarchid Sep 30, 2016

Member

there's actually a unit named Zero in Zero-K :0

This comment has been minimized.

Copy link
@sprunk

sprunk Sep 30, 2016

Author Member

no

This comment has been minimized.

Copy link
@GoogleFrog

GoogleFrog Oct 1, 2016

Contributor

Make sure that this does not break anything. There could easily be some lua which parses weapons to get unitDefName.

This comment has been minimized.

Copy link
@sprunk

sprunk Oct 1, 2016

Author Member

There could easily be some lua which parses weapons to get unitDefName.

This very code was one. I am not changing how weapon names are generated, this just parses the names. Comm weapons do not belong to any particular unitdefname but instead their prefix signifies damage boosters.

local wd = WeaponDefNames[weaponName]
if wd and wd.customParams and wd.customParams.manualfire then
weapon2 = weapon1
Expand Down
4 changes: 2 additions & 2 deletions gamedata/modularcomms/moduledefs.lua
Expand Up @@ -577,7 +577,7 @@ upgrades = {
description = "Generates a small bubble shield",
func = function(unitDef)
if unitDef.customparams.dynamic_comm then
DynamicApplyWeapon(unitDef, "commweapon_personal_shield", 16)
DynamicApplyWeapon(unitDef, "commweapon_personal_shield", #unitDef.weapons + 1)
else
ApplyWeapon(unitDef, "commweapon_personal_shield", 4)
end
Expand All @@ -600,7 +600,7 @@ upgrades = {
--ApplyWeapon(unitDef, "commweapon_areashield", 2)

if unitDef.customparams.dynamic_comm then
DynamicApplyWeapon(unitDef, "commweapon_areashield", 16)
DynamicApplyWeapon(unitDef, "commweapon_areashield", #unitDef.weapons) -- not +1 so as to replace personal
else
ReplaceWeapon(unitDef, "commweapon_personal_shield", "commweapon_areashield")
end
Expand Down

0 comments on commit 045c9d6

Please sign in to comment.