Document Waygate and Unit Issued Order APIs; clarify GetLocationZ and CreateDestructable pitfall - #160
Closed
Luashine wants to merge 4 commits into
Closed
Document Waygate and Unit Issued Order APIs; clarify GetLocationZ and CreateDestructable pitfall#160Luashine wants to merge 4 commits into
Luashine wants to merge 4 commits into
Conversation
Game version 1.36.2.21230
Full test code to showcase the desctructable animation delay that affects height immediately after creation:
```lua
-- HD Model: "Stand 1", "Death 1"
-- SD Model: "Stand", "Death"
function printLocOfUnit(u)
local uX, uY = GetUnitX(u), GetUnitY(u)
local loc = Location(uX, uY)
printLocCoords(loc)
RemoveLocation(loc)
end
function printLocCoords(loc)
local x,y,z = GetLocationX(loc), GetLocationY(loc), GetLocationZ(loc)
print(x,y,z)
end
function printUnitLocAndLoc(unit, staticLoc)
local unitLoc = Location(GetUnitX(unit), GetUnitY(unit))
local unitX,unitY,unitZ = GetLocationX(unitLoc), GetLocationY(unitLoc), GetLocationZ(unitLoc)
local staticX,staticY,staticZ = GetLocationX(staticLoc), GetLocationY(staticLoc), GetLocationZ(staticLoc)
print(string.format(
"unitLoc: \037-9.4f,\037-9.4f,\037-9.4f; staticLoc: \037-9.4f,\037-9.4f,\037-9.4f",
unitX,unitY,unitZ,
staticX,staticY,staticZ
))
RemoveLocation(unitLoc)
end
testHeightTrig = CreateTrigger()
testHeightAct = TriggerAddAction(testHeightTrig, function()
print("Creating footman and printing unitLoc & staticLoc:")
local footman = CreateUnit(Player(0), FourCC("hfoo"), 0, -1024, 90)
local staticLoc = GetUnitLoc(footman)
printUnitLocAndLoc(footman, staticLoc)
---
print("Creating platform, then new unitLoc & staticLoc: (expect dead height)")
local platform = CreateDestructable(FourCC("DTrx"), 0, -1024, 180, 1, 0)
printUnitLocAndLoc(footman, staticLoc)
---
TriggerSleepAction(0)
print("Sleep after platform creation: new unitLoc & staticLoc: (expect alive height)")
printUnitLocAndLoc(footman, staticLoc)
---
TriggerSleepAction(3)
print("Long Sleep after platform creation: new unitLoc & staticLoc: (expect alive height)")
printUnitLocAndLoc(footman, staticLoc)
---
print("Killing destructable: (expect alive height)")
KillDestructable(platform)
printUnitLocAndLoc(footman, staticLoc)
---
TriggerSleepAction(0.5)
print("Sleep after platform kill: new unitLoc & staticLoc: (expect dead animation)")
printUnitLocAndLoc(footman, staticLoc)
---
TriggerSleepAction(3)
print("Long Sleep after platform kill: new unitLoc & staticLoc: (expect dead height)")
printUnitLocAndLoc(footman, staticLoc)
---
print("Removing destructable: (expect 0)")
RemoveDestructable(platform)
printUnitLocAndLoc(footman, staticLoc)
---
TriggerSleepAction(0)
print("Sleep after platform removal: new unitLoc & staticLoc: (expect 0)")
printUnitLocAndLoc(footman, staticLoc)
---
RemoveUnit(footman)
RemoveLocation(staticLoc)
end)
TriggerExecute(testHeightTrig)
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit has the full testing code for the "delayed destructable height" bbe9760
Very much like in #148 , the created destructables delay their "final" position by one tick because it needs for the animation to play.
This is the map that does everything automatically and prints that Z results console. I've asked for people to run it in HD to compare against my SD results. I just want to confirm this for myself. Early on this was a major desync reason on Reforged release, actual model animations affected the surface elevation (if walkable destructable) and THAT caused different values between HD and SD players. I have no idea how they solved it exactly, but they did take agree on one value as far as I understand.
because this SD model still has different animation heights when compared to HD. And then what if you trigger DIFFERENT animation variations, one that exists in HD but not in SD? I guess that's still a desync even today??
Feel free to review, but before merging please wait until someone has confirmed the test map output on HD.
PlatformHeightTest.zip
Result: It was manually merged