Skip to content

Commit

Permalink
Generalize behavior of Salem that allows it to switch to land (#6499)
Browse files Browse the repository at this point in the history
  • Loading branch information
4z0t authored Nov 7, 2024
1 parent 5a55468 commit c69792c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
5 changes: 5 additions & 0 deletions changelog/snippets/features.6499.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- (#6499) Allow Footprint locking for (modded) units

With thanks to an assembly patch the footprint changes that were previously unique to the Cybran Tech 2 Destroyer can now be applied to any unit. For more details, see the pull request on GitHub.

Interested in how assembly patches work? Reach out to the game team. You can find us easiest via the official Discord server.
5 changes: 5 additions & 0 deletions changelog/snippets/fix.6499.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- (#6499) Fix hard crash when exiting the game when a Salem is on land

The Cybran Tech 2 Destroyer (Salem) has the special ability to move from water onto land. There was a bug in a special, alternative implementation introduced by FAForever. Together with an assembly patch this bug is now fixed.

Interested in how assembly patches work? Reach out to the game team. You can find us easiest via the official Discord server.
14 changes: 0 additions & 14 deletions engine/Patches.lua

This file was deleted.

6 changes: 5 additions & 1 deletion engine/Sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ end
function Unit:EnableManipulators(bone, Enable)
end

---Forces game to use AltFootprint for the unit
---@param state boolean
function Unit:ForceAltFootPrint(state)
end

--- Returns the unit's multiplier to a damage type
---@param damageTypeName DamageType
---@return number
Expand Down Expand Up @@ -269,7 +274,6 @@ end
---@param statName string
---@param defaultVal? number
---@return number
-- Special case for the Salem: GetStat("h1_SetSalemAmph", 0 or 1) will Disable/Enable amphibious mode
function Unit:GetStat(statName, defaultVal)
end

Expand Down
4 changes: 2 additions & 2 deletions units/URS0201/URS0201_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ URS0201 = ClassUnit(CSeaUnit) {
CSeaUnit.OnScriptBitSet(self, bit)
if bit == 1 then
if self.Layer ~= 'Land' then
self:GetStat("h1_SetSalemAmph", 0)
self:ForceAltFootPrint(true)
else
self:SetScriptBit('RULEUTC_WeaponToggle', false)
end
Expand All @@ -183,7 +183,7 @@ URS0201 = ClassUnit(CSeaUnit) {
OnScriptBitClear = function(self, bit)
CSeaUnit.OnScriptBitClear(self, bit)
if bit == 1 then
self:GetStat("h1_SetSalemAmph", 1)
self:ForceAltFootPrint(false)
end
end,
}
Expand Down
7 changes: 7 additions & 0 deletions units/URS0201/URS0201_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ UnitBlueprint{
BuildCostMass = 2250,
BuildTime = 10000,
},
AltFootprint = -- water only
{
SizeX = 2,
SizeZ = 8,
OccupancyCaps = 8,
MinWaterDepth = 1.5,
},
Footprint = {
SizeX = 2,
SizeZ = 8,
Expand Down

0 comments on commit c69792c

Please sign in to comment.