(5f61edb68) Allow to issue orders in single player while not controlling any character (freecam debug).

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:35:45 +03:00
parent eb7097d1a3
commit a83532f7a9
2 changed files with 11 additions and 3 deletions
@@ -505,7 +505,10 @@ namespace Barotrauma
btn.OnClicked += (GUIButton button, object userData) => btn.OnClicked += (GUIButton button, object userData) =>
{ {
if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false; #if CLIENT
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
if (Character.Controlled != null && Character.Controlled.SpeechImpediment >= 100.0f) { return false; }
if (btn.GetChildByUserData("selected").Visible) if (btn.GetChildByUserData("selected").Visible)
{ {
@@ -919,7 +922,9 @@ namespace Barotrauma
Font = GUI.SmallFont, Font = GUI.SmallFont,
OnClicked = (btn, userData) => OnClicked = (btn, userData) =>
{ {
if (Character.Controlled == null) return false; #if CLIENT
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
SetCharacterOrder(character, userData as Order, option, Character.Controlled); SetCharacterOrder(character, userData as Order, option, Character.Controlled);
orderTargetFrame = null; orderTargetFrame = null;
OrderOptionButtons.Clear(); OrderOptionButtons.Clear();
@@ -957,7 +962,9 @@ namespace Barotrauma
UserData = item == null ? order : new Order(order, item, item.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)), UserData = item == null ? order : new Order(order, item, item.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)),
OnClicked = (btn, userData) => OnClicked = (btn, userData) =>
{ {
if (Character.Controlled == null) return false; #if CLIENT
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
SetCharacterOrder(character, userData as Order, option, Character.Controlled); SetCharacterOrder(character, userData as Order, option, Character.Controlled);
orderTargetFrame = null; orderTargetFrame = null;
OrderOptionButtons.Clear(); OrderOptionButtons.Clear();
@@ -234,6 +234,7 @@ namespace Barotrauma
switch (order.AITag.ToLowerInvariant()) switch (order.AITag.ToLowerInvariant())
{ {
case "follow": case "follow":
if (orderGiver == null) { return null; }
newObjective = new AIObjectiveGoTo(orderGiver, character, this, repeat: true, priorityModifier: priorityModifier) newObjective = new AIObjectiveGoTo(orderGiver, character, this, repeat: true, priorityModifier: priorityModifier)
{ {
CloseEnough = 150, CloseEnough = 150,