View Issue Details

IDProjectCategoryView StatusLast Update
0002728Spring engineUnit Scriptingpublic2011-11-12 16:26
ReporterGoogle_Frog Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionno change required 
Summary0002728: beamlaser ignores script.AimWeapon return value
DescriptionTurreted beamlasers always fire regardless of script.AimWeapon. The following script.AimWeapon should prevent a unit from firing.

function script.AimWeapon(num, heading, pitch)
    return false
end

The result of this is beamlasers fire before the unit has finished aiming. Occurs with both cob and lua scripts.

Seems to be since https://github.com/spring/spring/commit/572aa92211a9dc9f57339ae3dbc2ee8ef15d52c1
Additional InformationEngine 83.0.1-96-gd8e23a8
TagsNo tags attached.
Checked infolog.txt for Errors

Activities

Kloot

2011-11-12 11:39

developer   ~0007582

Last edited: 2011-11-12 12:26

For Lua animation scripts, the return value of AimWeapon is NOT** used. Instead you are supposed to call

    Spring.SetUnitWeaponState(unitID, weaponID, "aimReady", true)

but this requirement was hidden prior to my commit.

** these source comments explain why:

- Because in current design CBCobThreadFinish can impossibly be called, certain
  state changes which normally happen immediately when script returns should
  be triggered through a call to a callOut when using Lua scripts.
  This applies to:
  * Spring.SetUnitShieldState(unitID, false|true) replaces return value 0|1 of
    COB's AimWeaponX function for plasma repulsers.
  * Spring.SetUnitWeaponState(unitID, weaponNum, "aimReady", 0|1) replaces
    return value 0|1 of COB's AimWeaponX function for all other weapons.

tvo

2011-11-12 16:26

reporter   ~0007586

Kloot: LUS gadget handles calling SetUnitWeaponState after AimWeapon returns true. (so return value is used, but not by engine)

Issue History

Date Modified Username Field Change
2011-11-12 04:31 Google_Frog New Issue
2011-11-12 11:39 Kloot Note Added: 0007582
2011-11-12 11:39 Kloot Status new => feedback
2011-11-12 11:54 Kloot Note Edited: 0007582
2011-11-12 11:55 Kloot Status feedback => closed
2011-11-12 11:55 Kloot Resolution open => no change required
2011-11-12 12:26 Kloot Status closed => feedback
2011-11-12 12:26 Kloot Resolution no change required => reopened
2011-11-12 12:26 Kloot Note Edited: 0007582
2011-11-12 12:26 Kloot Status feedback => closed
2011-11-12 12:26 Kloot Resolution reopened => no change required
2011-11-12 16:26 tvo Note Added: 0007586