Transport scripts

From Spring
Revision as of 15:16, 13 November 2012 by Emmanuel (talk | contribs) (half made (not air transport exemple))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

--transportation--

ground sea transports

  • to check and improve

local loader=piece "loader"
function script.QueryTransport(passengerID)
return loader
end
function script.TransportPickup (passengerID)
Spring.Echo(passengerID)
SetUnitValue(6, 1)-- BUSY set BUSY to 1;
Spring.UnitScript.AttachUnit(slot, passengerID)
currSlot=currSlot+1
SetUnitValue(6, 0)--set BUSY to 0;
end
function script.EndTransport(each, passengerID)--ground UnloadLandFlood after the last unit unloaded.
end


function script.TransportDrop (passengerID, x, y, z )
SetUnitValue(6,1)-- BUSY
Spring.UnitScript.DropUnit(passengerID)
SetUnitValue(6,0)
end


Air transports

  • todo
function script.BeginTransport(passengerID) end


UnitDef tags involved in transportation :

transportCapacity=1,-- - Int - This is simply the number of units it can hold
transportMass=15000,-- Float - This is the total maximum mass of units it can hold (Mass being another unitdef tag which defaults to the buildCostMetal)
transportSize=6,-- - Int - This is the maximum size of unit it can hold, in terms of the transportees footprintX
minTransportSize=1,-- - Int - The minimum size of footprint that this transport can hold
minTransportMass=1,-- - Float - The minimum mass a unit must have to be transported by this (N.B. this is not quite the inverse of transportMass)
cantBeTransported=true,-- - bool - This unit can / cannot be transported by any transport
transportByEnemy=true,-- - bool - This unit can / cannot be transported by enemy transports
ReleaseHeld = true, --transported units survive if transporter dies
HoldSteady=1, --useless for ground transport --maybe transported units tilt and turn like the transporter
transportUnloadMethod = 0,--UnloadLand (0)defaultunload --UnloadDrop (1)fly over and drop unit-- UnloadLandFlood (2) land, then release all units at once
loadingRadius=999,--defaults to 220
isfireplatform=true,