Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement variable transport speeds #6309

Merged
merged 28 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a86b2b6
Implement variable transport speeds
Basilisk3 Jun 26, 2024
76270cf
Implement the UnitWeight stat for four units to demonstrate the changes
Basilisk3 Jun 26, 2024
2defbc9
Merge branch 'develop' into VariableTransportSpeeds
Basilisk3 Jun 26, 2024
e1f1e07
Change the `MaxAirspeed` of all Tech 2 transports
Basilisk3 Jun 26, 2024
321df71
Change the `MaxAirspeed` of all Tech 1 transports
Basilisk3 Jun 26, 2024
e31fcff
Change the `MaxAirspeed` of the Continental
Basilisk3 Jun 26, 2024
d2a233a
Update lua/sim/units/AirTransportUnit.lua
Basilisk3 Jun 27, 2024
c92bf5f
Update lua/sim/units/AirTransportUnit.lua
Basilisk3 Jun 27, 2024
d6efcb1
Remove unneeded changes
Basilisk3 Jun 27, 2024
dc35ce8
Define the `UnitWeight` stat in blueprints-units.lua
Basilisk3 Jun 27, 2024
182822e
Update the name of the function
Basilisk3 Jun 27, 2024
1b6ff8e
Make it possible to override the `UnitWeight` definition in blueprint…
Basilisk3 Jun 27, 2024
3c3323b
Add a check for `isStructure` because structures can have the 'land' …
Basilisk3 Jun 27, 2024
39e7d93
Merge branch 'develop' into VariableTransportSpeeds
Basilisk3 Jun 27, 2024
1b5e73e
Add features.6309.md
Basilisk3 Jun 27, 2024
7b345bc
Add the `UnitWeight` stat to uvd.lua
Basilisk3 Jun 28, 2024
62bbd07
Update features.6309.md
Basilisk3 Jun 28, 2024
7c9f7db
Update features.6309.md
Basilisk3 Jun 28, 2024
83da1b6
Rename the blueprint stat
Basilisk3 Jun 30, 2024
9e3470e
Merge branch 'develop' into VariableTransportSpeeds
Basilisk3 Jun 30, 2024
2466715
Apply feedback
Basilisk3 Jun 30, 2024
bee4ead
Small fix
Basilisk3 Jun 30, 2024
0a4dab1
Remove the last remaining reference to `UnitWeight`
Basilisk3 Jun 30, 2024
a19c064
Move the `TransportSpeedReduction` stat from `General` to `Physics`
Basilisk3 Jun 30, 2024
9be240f
Add more fail-safes and improve annotations
Basilisk3 Jul 1, 2024
f93449a
Improve annotations
Basilisk3 Jul 1, 2024
222e68d
Update features.6309.md
Basilisk3 Jul 1, 2024
876aca5
Update features.6309.md
Basilisk3 Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lua/sim/units/AirTransportUnit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,25 @@ AirTransport = ClassUnit(AirUnit, BaseTransport) {
end
end,

---@param self AirTransport
---@param totalweight CargoWeight
---@param unit Unit
CalculateSpeedMult = function(self)
local transportspeed = self:GetBlueprint().Air.MaxAirspeed
Basilisk3 marked this conversation as resolved.
Show resolved Hide resolved
local totalweight = 0
for _, unit in ipairs(self:GetCargo()) do
Basilisk3 marked this conversation as resolved.
Show resolved Hide resolved
lL1l1 marked this conversation as resolved.
Show resolved Hide resolved
totalweight = totalweight + unit.Blueprint.General.UnitWeight
MrRowey marked this conversation as resolved.
Show resolved Hide resolved
end
self:SetSpeedMult(1 - (totalweight * 0.1 / transportspeed))
Basilisk3 marked this conversation as resolved.
Show resolved Hide resolved
end,

---@param self AirTransport
---@param attachBone Bone
---@param unit Unit
OnTransportAttach = function(self, attachBone, unit)
AirUnitOnTransportAttach(self, attachBone, unit)
BaseTransportOnTransportAttach(self, attachBone, unit)
self:CalculateSpeedMult()
end,

---@param self AirTransport
Expand All @@ -89,6 +102,7 @@ AirTransport = ClassUnit(AirUnit, BaseTransport) {
OnTransportDetach = function(self, attachBone, unit)
AirUnitOnTransportDetach(self, attachBone, unit)
BaseTransportOnTransportDetach(self, attachBone, unit)
self:CalculateSpeedMult()
end,

OnAttachedKilled = function(self, attached)
Expand Down
2 changes: 1 addition & 1 deletion units/UAA0104/UAA0104_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 13.5,
MaxAirspeed = 14.5,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
2 changes: 1 addition & 1 deletion units/UAA0107/UAA0107_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 10,
MaxAirspeed = 10.75,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
2 changes: 1 addition & 1 deletion units/UEA0104/UEA0104_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 13.5,
MaxAirspeed = 14.5,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
2 changes: 1 addition & 1 deletion units/UEA0107/UEA0107_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 10,
MaxAirspeed = 10.75,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
1 change: 1 addition & 0 deletions units/UEL0001/UEL0001_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ UnitBlueprint{
SelectionPriority = 3,
TeleportDelay = 15,
TeleportFlatEnergyCost = 75000,
UnitWeight = 10,
},
Intel = {
FreeIntel = true,
Expand Down
2 changes: 1 addition & 1 deletion units/URA0104/URA0104_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 13.5,
MaxAirspeed = 14.5,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
2 changes: 1 addition & 1 deletion units/URA0107/URA0107_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 10,
MaxAirspeed = 10.75,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
1 change: 1 addition & 0 deletions units/URL0202/URL0202_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ UnitBlueprint{
FactionName = "Cybran",
Icon = "land",
UnitName = "<LOC url0202_name>Rhino",
UnitWeight = 3,
},
Intel = { VisionRadius = 22 },
LifeBarHeight = 0.075,
Expand Down
2 changes: 1 addition & 1 deletion units/XEA0306/XEA0306_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 7,
MaxAirspeed = 15,
MaxAirspeed = 17.5,
StartTurnDistance = 10,
TransportHoverHeight = 6,
},
Expand Down
1 change: 1 addition & 0 deletions units/XRL0305/XRL0305_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ UnitBlueprint{
FactionName = "Cybran",
Icon = "amph",
UnitName = "<LOC xrl0305_name>The Brick",
UnitWeight = 6,
},
Intel = {
VisionRadius = 26,
Expand Down
2 changes: 1 addition & 1 deletion units/XSA0104/XSA0104_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 4,
LiftFactor = 8,
MaxAirspeed = 13.5,
MaxAirspeed = 14.5,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
2 changes: 1 addition & 1 deletion units/XSA0107/XSA0107_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ UnitBlueprint{
KTurn = 2,
KTurnDamping = 2,
LiftFactor = 8,
MaxAirspeed = 10,
MaxAirspeed = 10.75,
StartTurnDistance = 10,
TransportHoverHeight = 4,
},
Expand Down
1 change: 1 addition & 0 deletions units/XSL0103/XSL0103_unit.bp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ UnitBlueprint{
FactionName = "Seraphim",
Icon = "amph",
UnitName = "<LOC xsl0103_name>Zthuee",
UnitWeight = 1.5,
},
Intel = { VisionRadius = 18 },
LifeBarHeight = 0.075,
Expand Down