Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rudderbucky committed Aug 14, 2021
1 parent d6e2593 commit ce085de
Show file tree
Hide file tree
Showing 504 changed files with 44,648 additions and 14,694 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class BattleZoneManager : MonoBehaviour
static List<Entity> targets;
public string sectorName;
public bool playing;
public bool opposingFactionAdded = false;

float startTime = 0f;
public int CreditsCollected = 0;
Expand All @@ -31,6 +32,7 @@ public Stats(int faction)

void OnEnable()
{
opposingFactionAdded = false;
targets = new List<Entity>();
Entity.OnEntityDeath += OnEntityDeath;
ShellCore.OnPowerCollected += OnPowerCollected;
Expand Down Expand Up @@ -180,7 +182,7 @@ public void UpdateCounters()
}
}

if (livingFactions.Count < 2 || allAllied)
if ((livingFactions.Count < 2 || allAllied))
{
foreach (Entity playerEntity in targets)
{
Expand Down Expand Up @@ -225,7 +227,10 @@ public void AddTarget(Entity target)

if (target)
{
playing = true;
if (!opposingFactionAdded && targets.Exists(e => !FactionManager.IsAllied(e.GetFaction(), target.GetFaction())))
opposingFactionAdded = true;
if (opposingFactionAdded)
playing = true;
}

if (!targets.Contains(target))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,11 @@ public Entity SpawnEntity(EntityBlueprint blueprint, Sector.LevelEntity data)
{
ok = false;
}

if (blueprint.dialogue.traderInventory == null)
else if (blueprint.dialogue.traderInventory == null)
{
ok = false;
}

if (string.IsNullOrEmpty(data.blueprintJSON))
else if (string.IsNullOrEmpty(data.blueprintJSON))
{
ok = false;
}
Expand All @@ -768,12 +766,13 @@ public Entity SpawnEntity(EntityBlueprint blueprint, Sector.LevelEntity data)
}
else
{
blueprint.dialogue = ScriptableObject.CreateInstance<Dialogue>();
blueprint.dialogue.traderInventory = new List<EntityBlueprint.PartInfo>();
}
}
catch (System.Exception e)
{
Debug.LogWarning(e);
Debug.LogWarning(e + " " + data.ID);
blueprint.dialogue.traderInventory = new List<EntityBlueprint.PartInfo>();
}

Expand Down
40 changes: 25 additions & 15 deletions Assets/Scripts/Game Object Definitions/AI/PartyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using System.Linq;

public class PartyManager : MonoBehaviour
{
Expand Down Expand Up @@ -189,29 +190,33 @@ public void Unassign(string charID)
if (!PartyLocked)
{
var member = partyMembers.Find(c => c.ID == charID);
if (member && member.GetAI() != null)
{
member.GetAI().follow(null);
}

partyMembers.Remove(member);
partyResponses.Remove(charID);

if (partyIndicators.ContainsKey(member))
{
Destroy(partyIndicators[member]);
partyIndicators.Remove(member);
}
// sukratHealth.SetActive(false);
UnassignBackend(charID, member);
}
else
{
PlayerCore.Instance.alerter.showMessage("Cannot modify party currently!", "clip_alert");
}

UpdatePortraits();
}


public void UnassignBackend(string charID, ShellCore member)
{
if (member && member.GetAI() != null)
{
member.GetAI().follow(null);
}

partyMembers.Remove(member);
if (charID != null) partyResponses.Remove(charID);

if (partyIndicators.ContainsKey(member))
{
Destroy(partyIndicators[member]);
partyIndicators.Remove(member);
}
}

public GameObject partyIndicatorPrefab;
public Dictionary<ShellCore, GameObject> partyIndicators = new Dictionary<ShellCore, GameObject>();
public Transform indicatorTransform;
Expand Down Expand Up @@ -293,6 +298,11 @@ public void CharacterScrollSetup()
void Update()
{
blocker.SetActive(false);
var deadMembers = partyMembers.FindAll(sc => !sc);
foreach (var member in deadMembers)
{
UnassignBackend(null, member);
}

// distance maximum for party members - teleport them close to the player
if (SectorManager.instance?.current?.type != Sector.SectorType.BattleZone && !DialogueSystem.isInCutscene)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ protected virtual void BuildEntity()
int sortingOrder = 1;
//For shellcores, create the tractor beam
// Create shell parts
if (blueprint != null)
if (blueprint != null && blueprint.parts != null)
{
for (int i = 0; i < blueprint.parts.Count; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/HUD Scripts/MinimapArrowScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void ClearCoreArrows()

public void AddCoreArrow(ShellCore core)
{
if (coreArrows.ContainsKey(core))
if (coreArrows.ContainsKey(core) || !core)
{
return;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit ce085de

Please sign in to comment.