Conversation
Moves the rez queue functionality to the api and makes accessible for other things via a callback function. Except I havent figured out how to get the callback funciton to work correctly.
Thx Steelblue
who knew functions accept only as many arguments as they request! new zombies also do their thing on rez correctly
thxthx anyhow. needs to be fixed at some point eh?
Seems to be working as intended
| if (resurrectingFeatures[featureID].rezFrameCallback) then | ||
| resurrectingFeatures[featureID].rezFrameCallback(featureID) | ||
| else | ||
| local unitID = TurnFeatureIntoUnit(featureID,GaiaTeamID,true,nil) |
There was a problem hiding this comment.
Unsure if this sort of default behavior is good practice.
Can't be slowed because unslowing isn't handled here but in the global rez gadget.
| local unitID = units[i] | ||
| local unitTeam = spGetUnitTeam(unitID) | ||
| if (unitTeam == GaiaTeamID) then | ||
| zombies[unitID] = true |
There was a problem hiding this comment.
As far as I can tell, you reach this via unpause and I assume also "loading" a game as a campaign map start would.
I've attempted to differentiate between zombies and other forms of neutral units via the zombies table here, though a pause would just add all neutrals to the zombie team regardless. I assume its necessary or good when all neutrals units are intended to be zombies.
I suppose the gadget removes itself anyways if global zombies are disabled. So if this is reached all neutrals would/should be considered zombies anyways in that case and it doesnt matter?
| -- Reclaiming the wreck can stretch the revive time up to 2x the base time. | ||
| function gadget:AllowFeatureBuildStep(builderID, builderTeam, featureID, featureDefID, part) | ||
| if (resurrectingFeatures[featureID]) then | ||
| local rezInitFrame = resurrectingFeatures[featureID].rezInitFrame | ||
| local rezBaseTime = resurrectingFeatures[featureID].rezBaseTime | ||
| local reclaimPercent = resurrectingFeatures[featureID].reclaimPercent | ||
|
|
||
| reclaimPercent = reclaimPercent + part | ||
| local rezTime = rezBaseTime + rezBaseTime * (1 - reclaimPercent) | ||
| resurrectingFeatures[featureID].rezFrame = rezInitFrame + rezTime * 32 | ||
|
|
||
| resurrectingFeatures[featureID].reclaimPercent = reclaimPercent | ||
| end | ||
| return true |
There was a problem hiding this comment.
Was a bit scary to touch, but I think is functionally identical.
We count the reclaim % remaining down from 100 instead of reclaim taken up from 0.
| local _,_,_,_,reclaimPercent,_ = Spring.GetFeatureResources(featureID) | ||
|
|
||
| rezTime = rezBaseTime + rezBaseTime * (1 - reclaimPercent) | ||
|
|
There was a problem hiding this comment.
Starting revive time is also based on reclaim % left in the wreck instead of assuming it is at 100%
This is new, but shouldnt change anything for base zombies as they revive on Feature creation at 100% reclaim. Seem logical and inline for how it would work for a delayed revival application however.
| rezWarningTime = WARNING_TIME, -- warning time in seconds for base particles and sfx, set 0 to hide. | ||
| reclaimPercent = reclaimPercent, -- reclaim left in feature in % to compare and adjust reztime | ||
| } | ||
| return resurrectingFeatures[featureID] |
There was a problem hiding this comment.
This should allow anyone to modify the base values to their liking afterwards
Unsure if there would be a better way to do things for this function outside of me assuming some base functionality/behavior as a wanted standard and then exposing the output for tweaks.
|
Also could add proper getter/setters to modify things with if requested |
Moves the rez queue functionality of zombies to the api and makes accessible for other things.