-
Notifications
You must be signed in to change notification settings - Fork 200
feat(Synced): Add DropCurrentUnitAutoTargets for finer control #2675
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: sprunk <spr.ng@o2.pl>
|
Yeah thanks for the correction, this was the wanted behaviour but it must've slipped through when committing, as i had previously tried dropping all. Btw dropping all doesn't seem to cause any issue either, it's more a matter of staying "clean" i guess. |
Creates Spring.DropCurrentUnitAutoTargets(number unitID) -> nil untested
rts/Lua/LuaSyncedCtrl.cpp
Outdated
| * @ return nil | ||
| */ | ||
|
|
||
| void LuaSyncedCtrl::DropCurrentUnitAutoTargets(lua_State* L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returns int
|
Looks good, other than the two lines above. |
|
Fixed the return type // the function definitions in LuaSyncedCtrl.h (wrong name and return type) |
|
Where is the part where this function is called? Unless you mean that games should call it manually? What does the "fix" look like? |
|
Games would be responsible for calling it. |
function gadget:GetInfo()
return {
name = "Hold fire means stop firing",
desc = "",
author = "DoodVanDaag",
date = "dec 2025",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = true
}
end
if gadgetHandler:IsSyncedCode() then
local exclusionList = {}
function gadget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, cmdOptions)
if cmdID == CMD.FIRE_STATE and cmdParams[1] <= 1 then
if not exclusionList[unitDefID] then
Spring.DropCurrentUnitAutoTargets(unitID)
-- else
-- decide what to do (put a timer? remove targets one frame before reload progress is complete ? w/e)
-- we might actually even want the hold fire command to be applied later on so that it keeps acquiring new targets aswell, in which case the moment it is applied would just drop targets aswell; so maybe the first solution is the one to go and games should delay hold fire instead? Any thoughts on that ?
end
end
end
end
Would look like this. |
|
I think i overreacted to the "retargetting" projectiles issue. |
badosu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to @sprunk, code looks good at a glance
Meant to fix #2674
Drop all autoacquired (non user) targets upon receiving a firestate < FIRESTATE_FIREATWILL state command