(5c35a640e) Update tutorial-rework with dev
This commit is contained in:
@@ -51,6 +51,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public PhysicsBody Body { get; private set; }
|
||||
|
||||
private float RepairThreshold
|
||||
{
|
||||
get { return item.GetComponent<Repairable>()?.ShowRepairUIThreshold ?? 0.0f; }
|
||||
}
|
||||
|
||||
private float stuck;
|
||||
[Serialize(0.0f, false)]
|
||||
public float Stuck
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Barotrauma.Items.Components
|
||||
GameServer.Log(picker.LogName + " threw " + item.Name, ServerLog.MessageType.ItemInteraction);
|
||||
#endif
|
||||
|
||||
item.Drop(picker);
|
||||
item.Drop(picker, createNetworkEvent: GameMain.NetworkMember == null || GameMain.NetworkMember.IsServer);
|
||||
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f);
|
||||
|
||||
ac.GetLimb(LimbType.Head).body.ApplyLinearImpulse(throwVector*10.0f);
|
||||
|
||||
@@ -208,8 +208,9 @@ namespace Barotrauma.Items.Components
|
||||
public ItemComponent(Item item, XElement element)
|
||||
{
|
||||
this.item = item;
|
||||
originalElement = element;
|
||||
name = element.Name.ToString();
|
||||
properties = SerializableProperty.GetProperties(this);
|
||||
SerializableProperties = SerializableProperty.GetProperties(this);
|
||||
requiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>();
|
||||
requiredSkills = new List<Skill>();
|
||||
|
||||
@@ -243,18 +244,9 @@ namespace Barotrauma.Items.Components
|
||||
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e);
|
||||
}
|
||||
|
||||
properties = SerializableProperty.DeserializeProperties(this, element);
|
||||
#if CLIENT
|
||||
string msg = TextManager.Get(Msg, true);
|
||||
if (msg != null)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||
}
|
||||
Msg = msg;
|
||||
}
|
||||
#endif
|
||||
SerializableProperties = SerializableProperty.DeserializeProperties(this, element);
|
||||
ParseMsg();
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
@@ -631,53 +623,11 @@ namespace Barotrauma.Items.Components
|
||||
public virtual void Load(XElement componentElement)
|
||||
{
|
||||
if (componentElement == null) return;
|
||||
|
||||
foreach (XAttribute attribute in componentElement.Attributes())
|
||||
{
|
||||
if (!properties.TryGetValue(attribute.Name.ToString().ToLowerInvariant(), out SerializableProperty property)) continue;
|
||||
if (!SerializableProperties.TryGetValue(attribute.Name.ToString().ToLowerInvariant(), out SerializableProperty property)) continue;
|
||||
property.TrySetValue(this, attribute.Value);
|
||||
}
|
||||
#if CLIENT
|
||||
string msg = TextManager.Get(Msg, true);
|
||||
if (msg != null)
|
||||
{
|
||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||
{
|
||||
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||
}
|
||||
Msg = msg;
|
||||
}
|
||||
#endif
|
||||
var prevRequiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(requiredItems);
|
||||
bool overrideRequiredItems = false;
|
||||
|
||||
foreach (XElement subElement in componentElement.Elements())
|
||||
{
|
||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||
{
|
||||
case "requireditem":
|
||||
if (!overrideRequiredItems) requiredItems.Clear();
|
||||
overrideRequiredItems = true;
|
||||
|
||||
RelatedItem newRequiredItem = RelatedItem.Load(subElement, item.Name);
|
||||
if (newRequiredItem == null) continue;
|
||||
|
||||
var prevRequiredItem = prevRequiredItems.ContainsKey(newRequiredItem.Type) ?
|
||||
prevRequiredItems[newRequiredItem.Type].Find(ri => ri.JoinedIdentifiers == newRequiredItem.JoinedIdentifiers) : null;
|
||||
if (prevRequiredItem != null)
|
||||
{
|
||||
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
|
||||
newRequiredItem.Msg = prevRequiredItem.Msg;
|
||||
}
|
||||
|
||||
if (!requiredItems.ContainsKey(newRequiredItem.Type))
|
||||
{
|
||||
requiredItems[newRequiredItem.Type] = new List<RelatedItem>();
|
||||
}
|
||||
requiredItems[newRequiredItem.Type].Add(newRequiredItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ParseMsg();
|
||||
OverrideRequiredItems(componentElement);
|
||||
}
|
||||
|
||||
@@ -201,19 +201,19 @@ namespace Barotrauma.Items.Components
|
||||
tolerance = MathHelper.Lerp(5.0f, 20.0f, degreeOfSuccess);
|
||||
allowedTurbineOutput = new Vector2(correctTurbineOutput - tolerance, correctTurbineOutput + tolerance);
|
||||
|
||||
float temperatureTolerance = MathHelper.Lerp(10.0f, 20.0f, degreeOfSuccess);
|
||||
optimalTemperature = Vector2.Lerp(new Vector2(40.0f, 60.0f), new Vector2(30.0f, 70.0f), degreeOfSuccess);
|
||||
allowedTemperature = Vector2.Lerp(new Vector2(30.0f, 70.0f), new Vector2(10.0f, 90.0f), degreeOfSuccess);
|
||||
|
||||
float fissionRateTolerance = MathHelper.Lerp(10.0f, 20.0f, degreeOfSuccess);
|
||||
optimalFissionRate = Vector2.Lerp(new Vector2(40.0f, 70.0f), new Vector2(30.0f, 85.0f), degreeOfSuccess);
|
||||
allowedFissionRate = Vector2.Lerp(new Vector2(30.0f, 85.0f), new Vector2(20.0f, 98.0f), degreeOfSuccess);
|
||||
|
||||
optimalFissionRate = Vector2.Lerp(new Vector2(30, AvailableFuel - 20), new Vector2(20, AvailableFuel - 10), degreeOfSuccess);
|
||||
optimalFissionRate.X = Math.Min(optimalFissionRate.X, optimalFissionRate.Y - 10);
|
||||
allowedFissionRate = Vector2.Lerp(new Vector2(20, AvailableFuel), new Vector2(10, AvailableFuel), degreeOfSuccess);
|
||||
allowedFissionRate.X = Math.Min(allowedFissionRate.X, allowedFissionRate.Y - 10);
|
||||
|
||||
float heatAmount = fissionRate * (AvailableFuel / 100.0f) * 2.0f;
|
||||
float temperatureDiff = (heatAmount - turbineOutput) - Temperature;
|
||||
Temperature += MathHelper.Clamp(Math.Sign(temperatureDiff) * 10.0f * deltaTime, -Math.Abs(temperatureDiff), Math.Abs(temperatureDiff));
|
||||
if (item.InWater && AvailableFuel < 100.0f) Temperature -= 12.0f * deltaTime;
|
||||
|
||||
|
||||
FissionRate = MathHelper.Lerp(fissionRate, Math.Min(targetFissionRate, AvailableFuel), deltaTime);
|
||||
TurbineOutput = MathHelper.Lerp(turbineOutput, targetTurbineOutput, deltaTime);
|
||||
|
||||
@@ -364,7 +364,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else if (-currPowerConsumption < load)
|
||||
{
|
||||
targetFissionRate = Math.Min(targetFissionRate + speed * 2 * deltaTime, allowedFissionRate.Y);
|
||||
targetFissionRate = Math.Min(targetFissionRate + speed * 2 * deltaTime, 100.0f);
|
||||
}
|
||||
targetFissionRate = MathHelper.Clamp(targetFissionRate, 0.0f, 100.0f);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace Barotrauma.Items.Components
|
||||
public static float SkillIncreaseMultiplier = 0.4f;
|
||||
|
||||
private string header;
|
||||
|
||||
private float fixDurationLowSkill, fixDurationHighSkill;
|
||||
|
||||
private float deteriorationTimer;
|
||||
|
||||
@@ -52,17 +50,20 @@ namespace Barotrauma.Items.Components
|
||||
set;
|
||||
}
|
||||
|
||||
/*private float repairProgress;
|
||||
public float RepairProgress
|
||||
[Serialize(100.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, ToolTip = "The amount of time it takes to fix the item with insufficient skill levels.")]
|
||||
public float FixDurationLowSkill
|
||||
{
|
||||
get { return repairProgress; }
|
||||
set
|
||||
{
|
||||
repairProgress = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
if (repairProgress >= 1.0f && currentFixer != null) currentFixer.AnimController.Anim = AnimController.Animation.None;
|
||||
}
|
||||
}*/
|
||||
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(10.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, ToolTip = "The amount of time it takes to fix the item with sufficient skill levels.")]
|
||||
public float FixDurationHighSkill
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private Character currentFixer;
|
||||
public Character CurrentFixer
|
||||
{
|
||||
@@ -83,8 +84,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
this.item = item;
|
||||
header = element.GetAttributeString("name", "");
|
||||
fixDurationLowSkill = element.GetAttributeFloat("fixdurationlowskill", 100.0f);
|
||||
fixDurationHighSkill = element.GetAttributeFloat("fixdurationhighskill", 5.0f);
|
||||
InitProjSpecific(element);
|
||||
}
|
||||
|
||||
@@ -160,7 +159,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
bool wasBroken = !item.IsFullCondition;
|
||||
float fixDuration = MathHelper.Lerp(fixDurationLowSkill, fixDurationHighSkill, successFactor);
|
||||
float fixDuration = MathHelper.Lerp(FixDurationLowSkill, FixDurationHighSkill, successFactor);
|
||||
if (fixDuration <= 0.0f)
|
||||
{
|
||||
item.Condition = item.MaxCondition;
|
||||
@@ -186,26 +185,5 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
character.AnimController.UpdateUseItem(false, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((item.Condition / item.MaxCondition) % 0.1f));
|
||||
}
|
||||
|
||||
public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null)
|
||||
{
|
||||
msg.Write(deteriorationTimer);
|
||||
}
|
||||
|
||||
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
||||
{
|
||||
deteriorationTimer = msg.ReadSingle();
|
||||
}
|
||||
|
||||
public void ClientWrite(NetBuffer msg, object[] extraData = null)
|
||||
{
|
||||
//no need to write anything, just letting the server know we started repairing
|
||||
}
|
||||
|
||||
public void ServerRead(ClientNetObject type, NetBuffer msg, Client c)
|
||||
{
|
||||
if (c.Character == null) return;
|
||||
StartRepairing(c.Character);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
IsActive = value;
|
||||
#if SERVER
|
||||
if (GameMain.Server != null) item.CreateServerEvent(this);
|
||||
if (GameMain.Server != null && GameMain.Server.GameStarted) { item.CreateServerEvent(this); }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,26 +177,21 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 nodePos = refSub == null ?
|
||||
newConnection.Item.Position :
|
||||
newConnection.Item.Position - refSub.HiddenSubPosition;
|
||||
|
||||
|
||||
if (nodes.Count > 0 && nodes[0] == nodePos) break;
|
||||
if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break;
|
||||
|
||||
if (nodes.Count > 0 && nodes[0] == nodePos) break;
|
||||
if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break;
|
||||
|
||||
if (nodes.Count > 0 && nodes[0] == nodePos) break;
|
||||
if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break;
|
||||
|
||||
if (nodes.Count > 0 && nodes[0] == nodePos) break;
|
||||
if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break;
|
||||
|
||||
|
||||
if (nodes.Count > 0 && nodes[0] == nodePos) break;
|
||||
if (nodes.Count > 1 && nodes[nodes.Count - 1] == nodePos) break;
|
||||
|
||||
//make sure we place the node at the correct end of the wire (the end that's closest to the new node pos)
|
||||
int newNodeIndex = 0;
|
||||
if (nodes.Count > 1)
|
||||
{
|
||||
if (Vector2.DistanceSquared(nodes[nodes.Count-1], nodePos) < Vector2.DistanceSquared(nodes[0], nodePos))
|
||||
{
|
||||
newNodeIndex = nodes.Count;
|
||||
}
|
||||
}
|
||||
|
||||
if (newNodeIndex == 0)
|
||||
{
|
||||
nodes.Insert(0, nodePos);
|
||||
}
|
||||
|
||||
@@ -433,9 +433,10 @@ namespace Barotrauma.Items.Components
|
||||
if (usableProjectileCount == 0 || (usableProjectileCount < maxProjectileCount && objective.Option.ToLowerInvariant() != "fireatwill"))
|
||||
{
|
||||
ItemContainer container = null;
|
||||
Item containerItem = null;
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
var containerItem = e as Item;
|
||||
containerItem = e as Item;
|
||||
if (containerItem == null) continue;
|
||||
|
||||
container = containerItem.GetComponent<ItemContainer>();
|
||||
@@ -453,7 +454,7 @@ namespace Barotrauma.Items.Components
|
||||
var containShellObjective = new AIObjectiveContainItem(character, container.ContainableItems[0].Identifiers[0], container);
|
||||
character?.Speak(TextManager.Get("DialogLoadTurret").Replace("[itemname]", item.Name), null, 0.0f, "loadturret", 30.0f);
|
||||
containShellObjective.MinContainedAmount = usableProjectileCount + 1;
|
||||
containShellObjective.IgnoreAlreadyContainedItems = true;
|
||||
containShellObjective.ignoredContainerIdentifiers = new string[] { containerItem.prefab.Identifier };
|
||||
objective.AddSubObjective(containShellObjective);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ namespace Barotrauma
|
||||
public PhysicsBody body;
|
||||
|
||||
public readonly XElement StaticBodyConfig;
|
||||
|
||||
private bool needsPositionUpdate;
|
||||
|
||||
private float lastSentCondition;
|
||||
private float sendConditionUpdateTimer;
|
||||
private bool conditionUpdatePending;
|
||||
@@ -89,7 +88,7 @@ namespace Barotrauma
|
||||
if (hasInGameEditableProperties == null)
|
||||
{
|
||||
hasInGameEditableProperties = false;
|
||||
if (properties.Values.Any(p => p.Attributes.OfType<InGameEditable>().Any()))
|
||||
if (SerializableProperties.Values.Any(p => p.Attributes.OfType<InGameEditable>().Any()))
|
||||
{
|
||||
hasInGameEditableProperties = true;
|
||||
}
|
||||
@@ -98,7 +97,7 @@ namespace Barotrauma
|
||||
foreach (ItemComponent component in components)
|
||||
{
|
||||
if (!component.AllowInGameEditing) { continue; }
|
||||
if (component.properties.Values.Any(p => p.Attributes.OfType<InGameEditable>().Any()))
|
||||
if (component.SerializableProperties.Values.Any(p => p.Attributes.OfType<InGameEditable>().Any()))
|
||||
{
|
||||
hasInGameEditableProperties = true;
|
||||
break;
|
||||
@@ -212,14 +211,14 @@ namespace Barotrauma
|
||||
set { spriteColor = value; }
|
||||
}
|
||||
|
||||
[Serialize("1.0,1.0,1.0,1.0", false), Editable]
|
||||
[Serialize("1.0,1.0,1.0,1.0", true), Editable]
|
||||
public Color InventoryIconColor
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
[Serialize("1.0,1.0,1.0,1.0", false), Editable(ToolTip = "Changes the color of the item this item is contained inside. Only has an effect if either of the UseContainedSpriteColor or UseContainedInventoryIconColor property of the container is set to true.")]
|
||||
[Serialize("1.0,1.0,1.0,1.0", true), Editable(ToolTip = "Changes the color of the item this item is contained inside. Only has an effect if either of the UseContainedSpriteColor or UseContainedInventoryIconColor property of the container is set to true.")]
|
||||
public Color ContainerColor
|
||||
{
|
||||
get;
|
||||
@@ -275,12 +274,11 @@ namespace Barotrauma
|
||||
|
||||
SetActiveSprite();
|
||||
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && lastSentCondition != condition)
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer && !MathUtils.NearlyEqual(lastSentCondition, condition))
|
||||
{
|
||||
if (Math.Abs(lastSentCondition - condition) > 1.0f || condition == 0.0f || condition == Prefab.Health)
|
||||
{
|
||||
GameMain.NetworkMember.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
lastSentCondition = condition;
|
||||
conditionUpdatePending = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -585,10 +583,10 @@ namespace Barotrauma
|
||||
public override MapEntity Clone()
|
||||
{
|
||||
Item clone = new Item(rect, Prefab, Submarine, callOnItemLoaded: false);
|
||||
foreach (KeyValuePair<string, SerializableProperty> property in properties)
|
||||
foreach (KeyValuePair<string, SerializableProperty> property in SerializableProperties)
|
||||
{
|
||||
if (!property.Value.Attributes.OfType<Editable>().Any()) continue;
|
||||
clone.properties[property.Key].TrySetValue(clone, property.Value.GetValue(this));
|
||||
clone.SerializableProperties[property.Key].TrySetValue(clone, property.Value.GetValue(this));
|
||||
}
|
||||
|
||||
if (components.Count != clone.components.Count)
|
||||
@@ -605,7 +603,7 @@ namespace Barotrauma
|
||||
foreach (KeyValuePair<string, SerializableProperty> property in components[i].SerializableProperties)
|
||||
{
|
||||
if (!property.Value.Attributes.OfType<Editable>().Any()) continue;
|
||||
clone.components[i].properties[property.Key].TrySetValue(clone.components[i], property.Value.GetValue(components[i]));
|
||||
clone.components[i].SerializableProperties[property.Key].TrySetValue(clone.components[i], property.Value.GetValue(components[i]));
|
||||
}
|
||||
|
||||
//clone requireditem identifiers
|
||||
@@ -997,6 +995,21 @@ namespace Barotrauma
|
||||
aiTarget.SightRange -= deltaTime * 1000.0f;
|
||||
aiTarget.SoundRange -= deltaTime * 1000.0f;
|
||||
}
|
||||
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
|
||||
{
|
||||
sendConditionUpdateTimer -= deltaTime;
|
||||
if (conditionUpdatePending)
|
||||
{
|
||||
if (sendConditionUpdateTimer <= 0.0f)
|
||||
{
|
||||
GameMain.NetworkMember.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
lastSentCondition = condition;
|
||||
sendConditionUpdateTimer = NetConfig.ItemConditionUpdateInterval;
|
||||
conditionUpdatePending = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.Always, deltaTime, null);
|
||||
|
||||
@@ -1273,7 +1286,11 @@ namespace Barotrauma
|
||||
LastSentSignalRecipients.Clear();
|
||||
if (connections == null) return;
|
||||
|
||||
stepsTaken++;
|
||||
public List<T> GetConnectedComponentsRecursive<T>(Connection c) where T : ItemComponent
|
||||
{
|
||||
List<T> connectedComponents = new List<T>();
|
||||
List<Item> alreadySearched = new List<Item>() { this };
|
||||
GetConnectedComponentsRecursive(c, alreadySearched, connectedComponents);
|
||||
|
||||
if (!connections.TryGetValue(connectionName, out Connection c)) return;
|
||||
|
||||
@@ -1561,12 +1578,15 @@ namespace Barotrauma
|
||||
return isCombined;
|
||||
}
|
||||
|
||||
public void Drop(Character dropper)
|
||||
public void Drop(Character dropper, bool createNetworkEvent = true)
|
||||
{
|
||||
if (parentInventory != null && !parentInventory.Owner.Removed && !Removed &&
|
||||
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
|
||||
if (createNetworkEvent)
|
||||
{
|
||||
parentInventory.CreateNetworkEvent();
|
||||
if (parentInventory != null && !parentInventory.Owner.Removed && !Removed &&
|
||||
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
|
||||
{
|
||||
parentInventory.CreateNetworkEvent();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ItemComponent ic in components) { ic.Drop(dropper); }
|
||||
@@ -1809,8 +1829,20 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
partial void UpdateNetPosition(float deltaTime);
|
||||
|
||||
|
||||
public static Item Load(XElement element, Submarine submarine)
|
||||
{
|
||||
return Load(element, submarine, createNetworkEvent: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiate a new item and load its data from the XML element.
|
||||
/// </summary>
|
||||
/// <param name="element">The element containing the data of the item</param>
|
||||
/// <param name="submarine">The submarine to spawn the item in (can be null)</param>
|
||||
/// <param name="createNetworkEvent">Should an EntitySpawner event be created to notify clients about the item being created.</param>
|
||||
/// <returns></returns>
|
||||
public static Item Load(XElement element, Submarine submarine, bool createNetworkEvent)
|
||||
{
|
||||
string name = element.Attribute("name").Value;
|
||||
string identifier = element.GetAttributeString("identifier", "");
|
||||
@@ -1856,9 +1888,16 @@ namespace Barotrauma
|
||||
linkedToID = new List<ushort>()
|
||||
};
|
||||
|
||||
#if SERVER
|
||||
if (createNetworkEvent)
|
||||
{
|
||||
Spawner.CreateNetworkEvent(item, remove: false);
|
||||
}
|
||||
#endif
|
||||
|
||||
foreach (XAttribute attribute in element.Attributes())
|
||||
{
|
||||
if (!item.properties.TryGetValue(attribute.Name.ToString(), out SerializableProperty property)) continue;
|
||||
if (!item.SerializableProperties.TryGetValue(attribute.Name.ToString(), out SerializableProperty property)) continue;
|
||||
bool shouldBeLoaded = false;
|
||||
foreach (var propertyAttribute in property.Attributes.OfType<Serialize>())
|
||||
{
|
||||
@@ -1902,7 +1941,7 @@ namespace Barotrauma
|
||||
{
|
||||
component.OnItemLoaded();
|
||||
}
|
||||
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ namespace Barotrauma
|
||||
|
||||
public override void CreateNetworkEvent()
|
||||
{
|
||||
int componentIndex = container.Item.GetComponentIndex(container);
|
||||
if (componentIndex == -1)
|
||||
if (!Item.ItemList.Contains(container.Item))
|
||||
{
|
||||
string errorMsg = "Attempted to create a network event for an item (" + container.Item.Name + ") that hasn't been fully initialized yet.";
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
@@ -101,6 +100,13 @@ namespace Barotrauma
|
||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
int componentIndex = container.Item.GetComponentIndex(container);
|
||||
if (componentIndex == -1)
|
||||
{
|
||||
DebugConsole.Log("Creating a network event for the item \"" + container.Item + "\" failed, ItemContainer not found in components");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameMain.NetworkMember != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user