Skip to content

Commit

Permalink
Hook the aircraft carrier instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored and speed2CZ committed Aug 25, 2023
1 parent dd0b2bf commit 1a4c191
Showing 1 changed file with 52 additions and 3 deletions.
55 changes: 52 additions & 3 deletions hook/lua/defaultunits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,57 @@ SeaUnit = Class(oldSeaUnit) {
end,
}

AircraftCarrier = Class(SeaUnit, BaseTransport) {

DisableIntelOfCargo = true,

---@param self AircraftCarrier
---@param attachBone Bone
---@param unit Unit
OnTransportAttach = function(self, attachBone, unit)
SeaUnit.OnTransportAttach(self, attachBone, unit)
BaseTransport.OnTransportAttach(self, attachBone, unit)
end,

---@param self AircraftCarrier
---@param attachBone Bone
---@param unit Unit
OnTransportDetach = function(self, attachBone, unit)
SeaUnit.OnTransportDetach(self, attachBone, unit)
BaseTransport.OnTransportDetach(self, attachBone, unit)
end,

OnAttachedKilled = function(self, attached)
SeaUnit.OnAttachedKilled(self, attached)
BaseTransport.OnAttachedKilled(self, attached)
end,

---@param self AircraftCarrier
OnStartTransportLoading = function(self)
SeaUnit.OnStartTransportLoading(self)
BaseTransport.OnStartTransportLoading(self)
end,

---@param self AircraftCarrier
OnStopTransportLoading = function(self)
SeaUnit.OnStopTransportLoading(self)
BaseTransport.OnStopTransportLoading(self)
end,

---@param self AircraftCarrier
DestroyedOnTransport = function(self)
-- SeaUnit.DestroyedOnTransport(self)
BaseTransport.DestroyedOnTransport(self)
end,


OnKilled = function(self, instigator, type, overkillRatio)
self:SaveCargoMass()
SeaUnit.OnKilled(self, instigator, type, overkillRatio)
self:DetachCargo()
end,
}

local oldSubUnit = SubUnit
SubUnit = Class(oldSubUnit) {
TempestModifier = function(self) --Adjusts oil slick for Tempest
Expand Down Expand Up @@ -797,9 +848,7 @@ StructureUnit = Class(StructureHelperfunctions, oldStructureUnit) {
}

local oldFactoryUnit = FactoryUnit
FactoryUnit = Class(StructureUnit, oldFactoryUnit) {
IdleState = oldFactoryUnit.oldFactoryUnit,
}
FactoryUnit = Class(StructureUnit, oldFactoryUnit) {}

-- AIR FACTORY UNITS
AirFactoryUnit = Class(FactoryUnit) {}
Expand Down

0 comments on commit 1a4c191

Please sign in to comment.