Skip to content
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

I love null checking!! #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Derpy-Jacob-903
Copy link

@Derpy-Jacob-903 Derpy-Jacob-903 commented Nov 4, 2024

Fix NRE's from the TowerSelectionMenu_IsUpgradePathClosed patch outside of BTD6Rogue game modes.

Weird the code that prevents this was removed in 0.3.0 :/

Use GetTowerFromId(BaseHeroId) instead of GetHeroWithNameAndLevel(BaseHeroId, 1),

This fixes RogueHero.GetBaseHero() returning null for modded heros.

Null check the tower returned from RogueTower.GetBaseTower(), RogueHero.GetBaseHero(), RogueParagon.GetBaseTower(). and RogueParagon.GetBaseParagon(), treating that RogueTower as disabled if its tower is null.

This fixes cases where the BaseTowerId doesn't reference an existing tower.

Added Warnings if RogueTower/Paragon.GetBaseTower() is in the Hero TowerSet, or if RogueHero.GetBaseHero() is not in the Hero TowerSet.

This warns of possible NREs from non-hero/upgradable Towers gained from a RogueHero

Added a Bloon Validation Button which "Validates each RogueBloon to ensure it references existing Bloons in the GameModel. Logs warnings if invalid references are found." This is unnecessary if no new RogueBloons are being added by external mods.

This should be used to catch cases where a RogueBloon doesn't reference an existing bloon, or tries to give a bloon properties it can't spawn with. (like a Camo MOAB or Fortified Blue.)
Note that this doesn't prevent crashes from a invalid bloon, just gives me people a quick way to check instead of playing until the game crashes

[20:29:09.130] [BTD6Rogue] [BTD6Rogue-v3.0.0] (Warning) BTD6Rogue.BloonValidation: The XStablesMod-RoboCamo Bloon was not found. It may cause a crash ingame.
[20:29:09.131] [BTD6Rogue] [BTD6Rogue-v3.0.0] (Warning) BTD6Rogue.BloonValidation: The XStablesMod-RoboRegrow Bloon was not found. It may cause a crash ingame.
[20:29:09.135] [BTD6Rogue] [BTD6Rogue-v3.0.0] (Warning) BTD6Rogue.BloonValidation: The XStablesMod-RoboRegrowCamo Bloon was not found. It may cause a crash ingame.

^^An example of said warnings.

Fix NRE's from the TowerSelectionMenu_IsUpgradePathClosed patch outside of BTD6Rogue game modes.
> Weird the code that prevents this was removed in 0.3.0 :/

Use GetTowerFromId(BaseHeroId) instead of GetHeroWithNameAndLevel(BaseHeroId, 1),
> This fixes RogueHero.GetBaseHero() returning null for modded heros.

Null check the tower returned from RogueTower.GetBaseTower(), RogueHero.GetBaseHero(), RogueParagon.GetBaseTower(). and RogueParagon.GetBaseParagon(), treating that RogueTower as disabled if its tower is null.
> This fixes cases where the BaseTowerId doesn't reference an existing tower.

Added Warnings if RogueTower/Paragon.GetBaseTower() is in the Hero TowerSet, or if RogueHero.GetBaseHero() is not in the Hero TowerSet.
> This warns of possible NREs caused by line 25 of TowerSelectionMenu_IsUpgradePathClosed.cs
(Heros don't reach that line, but normal towers do. RogueTowers likely set a value that RogueHero don't)

Added a Bloon Validation Button which "Validates each RogueBloon to ensure it references existing Bloons in the GameModel. Logs warnings if invalid references are found."  This is unnecessary if no new RogueBloons are being added by external mods.
> This should be used to catch cases where a RogueBloon doesn't reference an existing bloon, or tries to give a bloon properties it can't spawn with. (like a Camo MOAB or Fortified Blue.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant