refactoring things out, removing unused additions
This commit is contained in:
+2
-15
@@ -5,19 +5,6 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable
|
||||
{
|
||||
public void UpdateClients()
|
||||
{
|
||||
|
||||
//notify all clients of the new state
|
||||
GameMain.Server.CreateEntityEvent(item, new object[]
|
||||
{
|
||||
NetEntityEvent.Type.ComponentState,
|
||||
item.GetComponentIndex(this)
|
||||
});
|
||||
|
||||
item.CreateServerEvent(this);
|
||||
}
|
||||
|
||||
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
|
||||
{
|
||||
bool[] elementStates = new bool[customInterfaceElementList.Count];
|
||||
@@ -83,7 +70,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
msg.Write(customInterfaceElementList[i].Signal);
|
||||
}
|
||||
else if(customInterfaceElementList[i].ContinuousSignal)
|
||||
else if (customInterfaceElementList[i].ContinuousSignal)
|
||||
{
|
||||
msg.Write(customInterfaceElementList[i].State);
|
||||
}
|
||||
@@ -94,4 +81,4 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using MoonSharp.Interpreter;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -52,6 +53,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
using Barotrauma.Networking;
|
||||
|
||||
partial class CharacterInfo
|
||||
{
|
||||
public static CharacterInfo Create(string speciesName, string name = "", JobPrefab jobPrefab = null, string ragdollFileName = null, int variant = 0, Rand.RandSync randSync = Rand.RandSync.Unsynced, string npcIdentifier = "")
|
||||
@@ -59,4 +62,69 @@ namespace Barotrauma
|
||||
return new CharacterInfo(speciesName, name, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
partial class Item
|
||||
{
|
||||
public void AddToRemoveQueue(Item item)
|
||||
{
|
||||
EntitySpawner.Spawner.AddToRemoveQueue(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
partial class ItemPrefab
|
||||
{
|
||||
public void AddToSpawnQueue(ItemPrefab itemPrefab, Vector2 position, object spawned = null)
|
||||
{
|
||||
EntitySpawner.Spawner.AddToSpawnQueue(itemPrefab, position, onSpawned: (Item item) => {
|
||||
GameMain.Lua.CallFunction(spawned, new object[] { item });
|
||||
});
|
||||
}
|
||||
|
||||
public void AddToSpawnQueue(ItemPrefab itemPrefab, Inventory inventory, object spawned = null)
|
||||
{
|
||||
EntitySpawner.Spawner.AddToSpawnQueue(itemPrefab, inventory, onSpawned: (Item item) => {
|
||||
GameMain.Lua.CallFunction(spawned, new object[] { item });
|
||||
});
|
||||
}
|
||||
|
||||
public static ItemPrefab GetItemPrefab(string itemNameOrId)
|
||||
{
|
||||
ItemPrefab itemPrefab =
|
||||
(MapEntityPrefab.Find(itemNameOrId, identifier: null, showErrorMessages: false) ??
|
||||
MapEntityPrefab.Find(null, identifier: itemNameOrId, showErrorMessages: false)) as ItemPrefab;
|
||||
|
||||
return itemPrefab;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
using Barotrauma.Networking;
|
||||
|
||||
partial class CustomInterface
|
||||
{
|
||||
public void UpdateClients()
|
||||
{
|
||||
|
||||
//notify all clients of the new state
|
||||
GameMain.Server.CreateEntityEvent(item, new object[]
|
||||
{
|
||||
NetEntityEvent.Type.ComponentState,
|
||||
item.GetComponentIndex(this)
|
||||
});
|
||||
|
||||
item.CreateServerEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
partial struct Signal
|
||||
{
|
||||
public static Signal Create(string value, int stepsTaken = 0, Character sender = null, Item source = null, float power = 0.0f, float strength = 1.0f)
|
||||
{
|
||||
return new Signal(value, stepsTaken, sender, source, power, strength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,11 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
|
||||
public object CallFunction(object function, object[] arguments)
|
||||
{
|
||||
return lua.Call(function, arguments);
|
||||
}
|
||||
|
||||
public void SetModulePaths(string[] str)
|
||||
{
|
||||
luaScriptLoader.ModulePaths = str;
|
||||
|
||||
Reference in New Issue
Block a user