Skip to content

Commit

Permalink
Fix the roll off order for the Tempest (FAForever#5357)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored Aug 25, 2023
1 parent b7fe398 commit bec3183
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions engine/Sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ end
--- Calculates the desired world position from the supplied relative vector from the center of the unit.
--- Used for naval factories to set rally point under them.
---@param vector Vector
---@return Vector
function Unit:CalculateWorldPositionFromRelative(vector)
end

Expand Down
18 changes: 15 additions & 3 deletions units/UAS0401/UAS0401_script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ UAS0401 = ClassUnit(ASeaUnit, ExternalFactoryComponent) {
end
end,

---@param self UEL0401
---@param self UAS0401
---@param new Layer
---@param old Layer
OnLayerChange = function(self, new, old)
Expand All @@ -136,6 +136,13 @@ UAS0401 = ClassUnit(ASeaUnit, ExternalFactoryComponent) {
ExternalFactoryComponent.OnUnpaused(self)
end,

RolloffBody = function(self)
end,

---@param self ExternalFactoryUnit
RollOffUnit = function(self)
end,

DiveDepthThread = function(self)
-- Takes the given location, adjusts the Y value to the surface height on that location, with an offset
local Yoffset = 1.2 -- The default (built in) offset appears to be 0.25 - if the place where thats set is found, that would be epic.
Expand Down Expand Up @@ -190,8 +197,15 @@ UAS0401 = ClassUnit(ASeaUnit, ExternalFactoryComponent) {
self.UnitDoneBeingBuilt = false
end,

---@param self UAS0401
---@param unitBeingBuilt Unit
OnStopBuild = function(self, unitBeingBuilt)
ASeaUnit.OnStopBuild(self, unitBeingBuilt)

local blueprint = unitBeingBuilt.Blueprint
local distance = math.max(blueprint.SizeX, blueprint.SizeZ, 6)
local worldPos = self:CalculateWorldPositionFromRelative({0, 0, - 2 * distance})
IssueMoveOffFactory({unitBeingBuilt}, worldPos)
ChangeState(self, self.RollingOffState)
end,
},
Expand All @@ -201,8 +215,6 @@ UAS0401 = ClassUnit(ASeaUnit, ExternalFactoryComponent) {
local unitBuilding = self.UnitBeingBuilt
unitBuilding:DetachFrom(true)
self:DetachAll(self.BuildAttachBone)
local worldPos = self:CalculateWorldPositionFromRelative({0, 0, -20})
IssueMoveOffFactory({unitBuilding}, worldPos)

WaitTicks(21)

Expand Down

0 comments on commit bec3183

Please sign in to comment.