Animation-CobCallins

From Spring
Revision as of 06:32, 28 May 2008 by Evil4Zerggin (talk | contribs)
Jump to navigationJump to search

Source

Some (but not all) are listed near the end of this file: https://spring.clan-sy.com/svn/spring/trunk/rts/Sim/Units/COB/CobFile.cpp

Callins

General

  • Create(): Called when the unit is created. "Created" means when the unit's nanoframe is created; if you want to wait until the unit is actually finished, you'll have to use something like
while(GET BUILD_PERCENT_LEFT) sleep 250; 
  • Activate()/Deactivate(): Called when the unit is turned on/off.
  • Killed(severity, corpsetype): Called when the unit is killed. Severity indicates how many percent of the unit's hit points were dealt by the final blow. Corpsetype basically indicates the number of times the unit and its corpses are destroyed; for example, corpsetype = 3 acts as if the unit is destroyed, the corpse is destroyed, and the corpse's corpse is destroyed. If it runs out of corpses nothing is left behind. Set corpsetype to the desired value.

Movement

  • StartMoving()/StopMoving(): Called when the unit starts/stops moving. This includes rotation, so don't be surprised if StartMoving() sometimes gets called when a unit starts aiming at a target.
  • SetSFXOccupy(terraintype): Supposedly called when the unit changes terrain type, although it didn't work last time I tried it? Maybe I was using it wrong. terraintype: 0 = transported, 1 = sea, 2 = deep sea (greater than 5 water depth and unit is upright), 4 = land.
  • MoveRate[0...3](): Appears to be the aircraft equivalent of SetSFXOccupy. MoveRate3 doesn't appear to actually be used. MoveRate1 is called when the aircraft takes off or lands. If the aircraft is not taking off or landing, MoveRate0 is called when the aircraft drops below 1/3 maximum speed, MoveRate2 is called when the aircraft exceeds 2/3 maximum speed, and MoveRate1 is called when the aircraft enters within 1/3-2/3 maximum speed. I don't know if this actually works.
  • SetDirection(heading): Used only for wind generators. Gives the direction of the wind.
  • SetSpeed(speed): Used for wind generators, tidals, and mexes. Basically more resources = higher speed.

Weapons

For weapons, X means either the number of the weapon, or "Primary", "Secondary", or "Tertiary" (don't put "Weapon" for these). I recommend using numbers, since it's cleaner and you can use more than three weapons that way.

  • AimWeaponX(heading, pitch): Called every ~0.5s when the unit is aiming the weapon at a target. This is used to turn a unit's turrets toward the target. Return 1 when the weapon is ready to fire. Alternately, return 0 if you don't want the weapon to fire (you can use this to disable weapons).
  • AimFromWeaponX(piecenum): You should set piecenum to a piece of the model; LOS is traced from the here to the target to see if the weapon can fire.
  • FireWeaponX(): Called whenever the trigger is pulled on a weapon. This occurs before the first shot in a burst/projectile salvo (only).
  • ShotX(): Called before every shot a weapon fires. This includes burst and projectile tags. This happens after FireWeaponX(), even for the first shot.
  • QueryWeaponX(piecenum): You should set piecenum to a piece of the model. The shot starts from this piece of the model; this is called for this purpose after FireWeaponX() and ShotX(). LOS is also traced from here to the target to see if a weapon can fire. Make sure this is a piece on the weapon's turret. Not doing this right can cause headaches; example: http://trac.caspring.org/wiki/GunsJammingOnShips
  • EndBurstX(): Called after the last shot in a burst.
  • BlockShotX()
  • TargetWeightX()
  • RockUnit(anglex, anglez): Called when the unit fires. Use it to rock the unit on firing, although there are other ways to do this.
  • HitByWeaponID(damage, weaponid?, unitid?)

Other

  • QueryLandingPadCount(count)
  • QueryLandingPad
  • Falling
  • Landed
  • SetMaxReloadTime(time): Called on unit creation. time is the time in ms that it takes the slowest-firing weapon to reload.
  • BeginTransport
  • QueryTransport
  • TransportPickup
  • EndTransport
  • StartUnload
  • StartBuilding(): Called when the unit starts building.
  • StopBuilding(): Called when the unit stops building.
  • QueryNanoPiece(piecenum): Set piecenum to the piece you want the nanospray to come from.
  • QueryBuildInfo