View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0006096 | Spring engine | Lua | public | 2018-12-09 01:04 | 2018-12-10 00:48 | ||||
Reporter | raaar | ||||||||
Assigned To | Kloot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 104.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0006096: allowWeaponTarget not preventing the weapon from aiming and firing at targets | ||||||||
Description | I'm trying to get reliable ways for units to not fire at targets in certain conditions (example: torpedo fires at unit if it's on or above water, but not if it's over land) The allowweapontarget seems to not prevent the weapon from aiming and firing regardless of the return value and priority i set. I'm returning false,0, but tried false,nil and false,9999999 --- this extreme example should apparently block all auto-targeting, but it does nothing function gadget:Initialize() for weaponID,_ in pairs(WeaponDefs) do Script.SetWatchWeapon(weaponID, true) Spring.Echo("WEAPON "..weaponID.." BLOCKED") end end -- weapon target check function gadget:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defaultPriority) Spring.Echo("BLOCKED! "..Spring.GetGameFrame()) return false,0 end | ||||||||
Tags | No tags attached. | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
Notes | |
raaar (reporter) 2018-12-09 01:06 |
the "BLOCKED!" is printed as the weapon is aiming at an enemy spawned within range and the unit fires, but it shouldn't aim or fire. |
raaar (reporter) 2018-12-09 01:49 |
note that I'm testing how the unit behaves by itself, no manual orders were given. |
raaar (reporter) 2018-12-09 08:28 |
This can be reproduced on MF v1.03. There's a gadget that tries to prevent most torpedoes from firing from water at land targets. In such cases the AllowWeaponTarget returns false,99999999 An example unit is the aven_commander when underwater, firing at an enemy aven_radar_tower spawned near the shore. Even if it's in range of the radar, as long as the commander is moving it won't fire. If it stops moving and becomes idle, the engine adds in an attack order even if no manual attack order is given, and then it tries to fire. (the torpedoes will generally explode a few elmos above water level before reaching the target but that's another gadget-enforced feature) |
Kloot (developer) 2018-12-10 00:47 |
Fix 82add77b48ceadac5d72d4f49817ef2db41ee8ec committed to develop branch: fix 0006096 0006093 call AllowWeaponTarget when auto-generating CAI attack commands when targetID=-1 and weaponNum=-1 targetPriority determines the target search radius; targetPriority=nil accompanies any actual target being considered, repo: spring changeset id: 11188 |
Kloot (developer) 2018-12-10 00:48 |
Fix 198e315d4d7c736794223d3c8aece278909ac967 committed to maintenance branch: fix 0006096 0006093 call AllowWeaponTarget when auto-generating CAI attack commands when targetID=-1 and weaponNum=-1 targetPriority determines the target search radius; targetPriority=nil accompanies any actual target being considered, repo: spring changeset id: 11189 |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2018-12-09 01:04 | raaar | New Issue | |
2018-12-09 01:06 | raaar | Note Added: 0019595 | |
2018-12-09 01:49 | raaar | Note Added: 0019596 | |
2018-12-09 08:28 | raaar | Note Added: 0019597 | |
2018-12-10 00:47 | Kloot | Changeset attached | => spring develop 82add77b |
2018-12-10 00:47 | Kloot | Note Added: 0019598 | |
2018-12-10 00:47 | Kloot | Assigned To | => Kloot |
2018-12-10 00:47 | Kloot | Status | new => resolved |
2018-12-10 00:47 | Kloot | Resolution | open => fixed |
2018-12-10 00:48 | Kloot | Changeset attached | => spring maintenance 198e315d |
2018-12-10 00:48 | Kloot | Note Added: 0019600 |