Merge pull request #870 from alixander/d2oracle-near

d2oracle: fix near updating in flat map
This commit is contained in:
Alexander Wang 2023-02-22 15:38:21 -08:00 committed by GitHub
commit 9e5e633e76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1536 additions and 1 deletions

View file

@ -1538,7 +1538,7 @@ func updateNear(prevG, g *d2graph.Graph, from, to *string) error {
if len(n.MapKey.Key.Path) == 0 {
continue
}
if n.MapKey.Key.Path[0].Unbox().ScalarString() == "near" {
if n.MapKey.Key.Path[len(n.MapKey.Key.Path)-1].Unbox().ScalarString() == "near" {
k := n.MapKey.Value.ScalarBox().Unbox().ScalarString()
if strings.EqualFold(k, *from) && to == nil {
deleteFromMap(obj.Map, n.MapKey)

View file

@ -3824,6 +3824,37 @@ y
exp: `x
y
`,
},
{
name: "delete_container_of_near",
text: `direction: down
first input -> start game -> game loop
game loop: {
direction: down
input -> increase bird top velocity
move bird -> move pipes -> render
render -> no collision -> wait 16 milliseconds -> move bird
render -> collision detected -> game over
no collision.near: game loop.collision detected
}
`,
key: `game loop`,
exp: `direction: down
first input -> start game
input -> increase bird top velocity
move bird -> move pipes -> render
render -> no collision -> wait 16 milliseconds -> move bird
render -> collision detected -> game over
no collision.near: collision detected
`,
},
{

File diff suppressed because it is too large Load diff