-
Notifications
You must be signed in to change notification settings - Fork 112
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
Fix static ghost behaviours #1831
base: master
Are you sure you want to change the base?
Fix static ghost behaviours #1831
Conversation
This just forces immobiles to have ghosts while leaving games no control. Add a new unit def tag, That tag should default to true for buildings and false for mobiles, but I dug a bit and I'm no longer sure whether that new tag should default to true for immobiles. See 30c07c5, e573bdb, and https://springrts.com/mantis/view.php?id=6127. |
bfe5b71
to
f3ea435
Compare
Would be nice to split this into two PRs: small one adding the boolean tag, and the big refactor + fixing minimap icons. |
f956649
to
fcbb300
Compare
done, see #1887 |
- Also rename lua methods accordingly.
unitdef initially.
3a18651
to
bb41bc9
Compare
bb41bc9
to
afd9a07
Compare
if (prevValue != unit->leavesGhost) | ||
unitDrawer->UnitLeavesGhostChanged(unit, luaL_optboolean(L, 3, false)); |
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.
These two lines should probably be part of unit->SetLeavesGhost
since otherwise unit drawer can fail to be notified of a change.
*/ | ||
int LuaSyncedRead::GetUnitLeavesGhost(lua_State* L) | ||
{ | ||
const CUnit* const unit = ParseAllyUnit(L, __func__, 1); |
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.
Should probably be allowed for enemy units too, since that is whose ghosts you're interested in.
@@ -555,7 +562,7 @@ float3 CUnit::GetErrorVector(int argAllyTeam) const | |||
const int atSightMask = losStatus[argAllyTeam]; | |||
|
|||
const int isVisible = 2 * ((atSightMask & LOS_INLOS ) != 0 || teamHandler.Ally(argAllyTeam, allyteam)); // in LOS or allied, no error | |||
const int seenGhost = 4 * ((atSightMask & LOS_PREVLOS) != 0 && gameSetup->ghostedBuildings && unitDef->IsBuildingUnit()); // seen ghosted building, no error | |||
const int seenGhost = 4 * ((atSightMask & LOS_PREVLOS) != 0 && leavesGhost); // seen ghosted immobiles, no error |
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.
Ghosts are no longer tied to being an immobile.
const int seenGhost = 4 * ((atSightMask & LOS_PREVLOS) != 0 && leavesGhost); // seen ghosted immobiles, no error | |
const int seenGhost = 4 * ((atSightMask & LOS_PREVLOS) != 0 && leavesGhost); // seen ghost, no error |
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.
Unsure about this, since this is just for ghosts of "generally immobile" units.
At least I don't see how this kind of ghosts could have a meaning in the game unless the unit has some kind of "generally immobile" assumption, even if it can sometimes be broken, like when a building is moved with some exception like being transported.
Mobile ones have a different kind of ghost.
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.
Can you point to the different kind of ghost for mobiles? Maybe handling for the two could be combined somehow.
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.
actually, looks like the mobile ones don't get drawn by engine itself, for bar it looks like it goes through unit_ghostradar_gl4.
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.
actually, looks like the mobile ones don't get drawn by engine itself, for bar it looks like it goes through unit_ghostradar_gl4.
I suspect they could use the same path liveGhostBuildings are using tho, they probably doing it for nothing
* | ||
* @number unitID | ||
* @bool leavesGhost | ||
* @bool[opt] leaveDeadGhost leave a dead ghost behind if disabling and the unit had a live static ghost. |
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.
It would be good if leaving a dead ghost was a standalone function. That way SetUnitLeavesGhost
is atomic and you can leave dead ghosts around in other circumstances at will.
Co-authored-by: sprunk <spr.ng@o2.pl>
Work done
leavesRadarGhost
unitdefstaticRadarGhost
unit attributeGet/SetUnitStaticRadarGhost
allows changing this at any timeRelated issues
Remarks
Pending
Reference