Line 33: |
Line 33: |
| == Meteor Location == | | == Meteor Location == |
| I don't think the logic for the meteor's position is correct. The page states, the game chooses a random 3x3 square, then checks for a suitably-clear 2x2 square within that. However I had the meteor event, reloaded from the day before, and experimented with obstacles: anything within the *3x3* square prevented the meteor from landing. (Obstacles around the 3x3 square didn't block it, but anything inside did, even if not on the 2x2 square the meteor chose.) [[User:Lchu|Lchu]] ([[User talk:Lchu|talk]]) 13:28, 26 October 2022 (UTC) | | I don't think the logic for the meteor's position is correct. The page states, the game chooses a random 3x3 square, then checks for a suitably-clear 2x2 square within that. However I had the meteor event, reloaded from the day before, and experimented with obstacles: anything within the *3x3* square prevented the meteor from landing. (Obstacles around the 3x3 square didn't block it, but anything inside did, even if not on the 2x2 square the meteor chose.) [[User:Lchu|Lchu]] ([[User talk:Lchu|talk]]) 13:28, 26 October 2022 (UTC) |
| + | :You might be right, I don't know. The relevant code is <samp>Events.SoundInTheNightEvent</samp>. I don't have time to step through the code atm, but I will copy it here: |
| + | <syntaxhighlight lang="C#"> |
| + | targetLocation = new Vector2(r.Next(5, f.map.GetLayer("Back").TileWidth - 20), r.Next(5, f.map.GetLayer("Back").TileHeight - 4)); |
| + | for (int i = (int)targetLocation.X; (float)i <= targetLocation.X + 1f; i++) |
| + | { |
| + | for (int j = (int)targetLocation.Y; (float)j <= targetLocation.Y + 1f; j++) |
| + | { |
| + | Vector2 v = new Vector2(i, j); |
| + | if (!f.isTileOpenBesidesTerrainFeatures(v) || |
| + | !f.isTileOpenBesidesTerrainFeatures(new Vector2(v.X + 1f, v.Y)) || |
| + | !f.isTileOpenBesidesTerrainFeatures(new Vector2(v.X + 1f, v.Y - 1f)) || |
| + | !f.isTileOpenBesidesTerrainFeatures(new Vector2(v.X, v.Y - 1f)) || |
| + | f.doesTileHaveProperty((int)v.X, (int)v.Y, "Water", "Back") != null || |
| + | f.doesTileHaveProperty((int)v.X + 1, (int)v.Y, "Water", "Back") != null) |
| + | { |
| + | return true; |
| + | } |
| + | } |
| + | }</syntaxhighlight> |
| + | :I don't know offhand what the standard TileWidth is, and that's preventing me from analyzing this code snippet. Any insights are welcome! [[User:Margotbean|margotbean]] ([[User talk:Margotbean|talk]]) 15:07, 26 October 2022 (UTC) |