plenty of new things
This commit is contained in:
@@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma;
|
||||
using MoonSharp.Interpreter;
|
||||
#if CLIENT
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Barotrauma.Sounds;
|
||||
@@ -432,8 +434,18 @@ namespace Barotrauma.Items.Components
|
||||
//called then the item is dropped or dragged out of a "limbslot"
|
||||
public virtual void Unequip(Character character) { }
|
||||
|
||||
|
||||
Dictionary<string, string> lastSignal = new Dictionary<string, string>();
|
||||
public virtual void ReceiveSignal(Signal signal, Connection connection)
|
||||
{
|
||||
#if SERVER
|
||||
if (!lastSignal.ContainsValue(connection.Name) || lastSignal[connection.Name] != signal.value)
|
||||
{
|
||||
GameMain.Lua.hook.Call("signalReceived", new DynValue[] { UserData.Create(signal), UserData.Create(connection) });
|
||||
|
||||
lastSignal[connection.Name] = signal.value;
|
||||
}
|
||||
#endif
|
||||
switch (connection.Name)
|
||||
{
|
||||
case "activate":
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
public struct Signal
|
||||
struct Signal
|
||||
{
|
||||
internal string value;
|
||||
internal int stepsTaken;
|
||||
internal Character sender;
|
||||
internal Item source;
|
||||
internal float power;
|
||||
internal float strength;
|
||||
public string value;
|
||||
public int stepsTaken;
|
||||
public Character sender;
|
||||
public Item source;
|
||||
public float power;
|
||||
public float strength;
|
||||
|
||||
internal Signal(string value, int stepsTaken = 0, Character sender = null,
|
||||
Item source = null, float power = 0.0f, float strength = 1.0f)
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
@@ -185,6 +186,13 @@ namespace Barotrauma.Items.Components
|
||||
var senderComponent = signal.source?.GetComponent<WifiComponent>();
|
||||
if (senderComponent != null && !CanReceive(senderComponent)) { return; }
|
||||
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("wifiSignalTransmitted", new DynValue[] { UserData.Create(this), UserData.Create(signal), DynValue.NewBoolean(sentFromChat) });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
return;
|
||||
#endif
|
||||
|
||||
bool chatMsgSent = false;
|
||||
|
||||
var receivers = GetReceiversInRange();
|
||||
@@ -243,6 +251,7 @@ namespace Barotrauma.Items.Components
|
||||
Client recipientClient = GameMain.Server.ConnectedClients.Find(c => c.Character == wifiComp.item.ParentInventory.Owner);
|
||||
if (recipientClient != null)
|
||||
{
|
||||
|
||||
GameMain.Server.SendDirectChatMessage(
|
||||
ChatMessage.Create(signal.source?.Name ?? "", chatMsg, ChatMessageType.Radio, null), recipientClient);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using MoonSharp.Interpreter;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -648,6 +649,13 @@ namespace Barotrauma
|
||||
if (Math.Max(hull1.WorldSurface + hull1.WaveY[hull1.WaveY.Length - 1], hull2.WorldSurface + hull2.WaveY[0]) > WorldRect.Y) { return; }
|
||||
}
|
||||
|
||||
#if SERVER
|
||||
var should = GameMain.Lua.hook.Call("gapOxygenUpdate", new DynValue[] { UserData.Create(this), UserData.Create(hull1), UserData.Create(hull2) });
|
||||
|
||||
if (should != null && should.CastToBool())
|
||||
return;
|
||||
#endif
|
||||
|
||||
float totalOxygen = hull1.Oxygen + hull2.Oxygen;
|
||||
float totalVolume = (hull1.Volume + hull2.Volume);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Barotrauma.Networking
|
||||
new Color(255, 128, 0) //order
|
||||
};
|
||||
|
||||
public readonly string Text;
|
||||
public string Text;
|
||||
|
||||
private string translatedText;
|
||||
public string TranslatedText
|
||||
@@ -74,8 +74,8 @@ namespace Barotrauma.Networking
|
||||
public PlayerConnectionChangeType ChangeType;
|
||||
public string IconStyle;
|
||||
|
||||
public readonly Character Sender;
|
||||
public readonly Client SenderClient;
|
||||
public Character Sender;
|
||||
public Client SenderClient;
|
||||
|
||||
public readonly string SenderName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user