Skip to content

Commit

Permalink
Manual unit share no longer gives Stop command (#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveridge authored Sep 10, 2023
1 parent 0bfe4d8 commit f0fd775
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Misc:
in conjunction with `Spring.GetPlayerInfo` poisoning.
- Add new `/remove` cheat-only command, it removes selected units similar to
`/destroy` except no death script is run (so no explosion nor wreckage).
- Units no longer clear command queue when shared. This can be implemented gameside with UnitGiven callin.

Sim:
- Improved performance of long-range path finding requests (TKPFS)
Expand Down
1 change: 1 addition & 0 deletions doc/site/changelogs/running-changelog.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The extras are considered to start in the (0, 0) corner and it is now up to the
* the `movement.allowGroundUnitGravity` mod rule now defaults to `false`. All known games have an explicit value set, so this should only affect new games.
* `/ally` no longer announces this to unrelated players via a console message. The affected players still see one.
Use the `TeamChanged` call-in to make a replacement if you want it to be public.
* manually shared units no longer receive the Stop command. Use the `UnitGiven` callin to get back the previous behaviour.

### Deprecation
No changes yet, but these will happen in the future and possibly break things.
Expand Down
11 changes: 11 additions & 0 deletions doc/site/migrating-from-spring.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ Instead use the second return value, e.g.:
+ local counts, unitDefsCount = Spring.GetSelectedUnitsCounts()
```

## Stop command on manual share
Manually shared units no longer receive the Stop command.
Replicate the previous behaviour via the `UnitGiven` callin:
```lua
function wupget:UnitGiven(unitID, unitDefID, newTeam)
if newTeam == Spring.GetMyTeamID() then -- if doing in unsynced
Spring.GiveOrderToUnit(unitID, CMD.STOP, 0, 0)
end
end
```

## Defs

- Hovercraft and ships brought out of water no longer forced to be upright.
Expand Down
2 changes: 0 additions & 2 deletions rts/Lua/LuaUnsyncedCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3520,8 +3520,6 @@ int LuaUnsyncedCtrl::ShareResources(lua_State* L)

const char* type = lua_tostring(L, 2);
if (type[0] == 'u') {
// update the selection, and clear the unit command queues
selectedUnitsHandler.GiveCommand(Command(CMD_STOP), false);
clientNet->Send(CBaseNetProtocol::Get().SendShare(gu->myPlayerNum, teamID, 1, 0.0f, 0.0f));
selectedUnitsHandler.ClearSelected();
return 0;
Expand Down

0 comments on commit f0fd775

Please sign in to comment.