Skip to content

Commit

Permalink
Remembered to set Chirr minion spawnpoint on stage start
Browse files Browse the repository at this point in the history
  • Loading branch information
Moffein committed Jan 26, 2024
1 parent 699365a commit ab7b423
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Starstorm 2/Starstorm2Release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ The SS2 team is free to use any of the new code from this mod as long as this re

## Changelog

`0.16.11`

- Chirr
- Fixed weird minion spawnpoints on stage start due to 0.16.10

`0.16.10`

- Chirr
Expand Down
Binary file modified Starstorm 2/Starstorm2Release/VideogameMod2Unofficial.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Starstorm 2/Starstorm2Release/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Videogame_Mod_2_Unofficial",
"version_number": "0.16.10",
"version_number": "0.16.11",
"website_url": "https://github.com/Moffein/Starstorm2Unofficial",
"description": "A restoration of the pre-SotV Videogame Mod 2. Compatible with the official Videogame Mod 2!",
"dependencies": [
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Starstorm 2/StarstormPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class StarstormPlugin : BaseUnityPlugin
{
internal const string guid = "com.ChirrLover.Starstorm2Unofficial";
internal const string modName = "Starstorm 2 Unofficial";
internal const string version = "0.16.10";
internal const string version = "0.16.11";

public static StarstormPlugin instance;

Expand Down
45 changes: 44 additions & 1 deletion Starstorm 2/Survivors/Chirr/Components/ChirrFriendController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.UIElements;

namespace Starstorm2Unofficial.Survivors.Chirr.Components
{
Expand Down Expand Up @@ -185,11 +186,53 @@ public void TrySpawnSavedMaster()
GameObject masterPrefab = MasterCatalog.GetMasterPrefab(masterFriendController.masterIndex);
if (masterPrefab)
{
bool isFlying = false;
bool isChampion = false;
HullClassification hullSize = HullClassification.Golem;

CharacterMaster potentialMaster = masterPrefab.GetComponent<CharacterMaster>();
if (potentialMaster)
{
GameObject potentialBodyObject = masterPrefab.GetComponent<CharacterMaster>().bodyPrefab;
if (potentialBodyObject)
{
CharacterBody potentialBody = potentialBodyObject.GetComponent<CharacterBody>();
if (potentialBody)
{
isFlying = potentialBody.isFlying;
isChampion = potentialBody.isChampion;
}
}
}
if (isChampion) hullSize = HullClassification.BeetleQueen;

//Set spawnpoint
Vector3 spawnPos = ownerBody.corePosition + Vector3.back * 5;
SpawnCard spawnCard = ScriptableObject.CreateInstance<SpawnCard>();
spawnCard.hullSize = hullSize;
spawnCard.nodeGraphType = (isFlying ? MapNodeGroup.GraphType.Air : MapNodeGroup.GraphType.Ground);
spawnCard.prefab = ChirrFriendController.teleportHelperPrefab;

GameObject gameObject = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(spawnCard, new DirectorPlacementRule
{
placementMode = DirectorPlacementRule.PlacementMode.NearestNode,
position = ownerBody.corePosition,
minDistance = 12f,
maxDistance = 60f
}, RoR2Application.rng));

if (gameObject)
{
spawnPos = gameObject.transform.position;
UnityEngine.Object.Destroy(gameObject);
}
Destroy(spawnCard);

MasterSummon masterSummon = new MasterSummon
{
masterPrefab = masterPrefab,
ignoreTeamMemberLimit = true,
position = ownerBody.corePosition + Vector3.back * 5, //todo: properly get random nearby pos
position = spawnPos,
summonerBodyObject = (ownerBody ? ownerBody.gameObject : null),
useAmbientLevel = false
};
Expand Down

0 comments on commit ab7b423

Please sign in to comment.