mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 23:39:22 +00:00
[LuaNetworkVariables] Remove exp stuff, fix context properties
This commit is contained in:
parent
ece15e0dfc
commit
e85c1e2f25
10 changed files with 95 additions and 514 deletions
|
@ -1,6 +1,6 @@
|
|||
using MoonSharp.Interpreter;
|
||||
using ABI_RC.Core.Networking;
|
||||
using MoonSharp.Interpreter;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
|
||||
namespace NAK.LuaNetVars;
|
||||
|
||||
|
@ -12,9 +12,9 @@ public struct LuaEventContext
|
|||
private double TimeSinceLastInvoke { get; set; }
|
||||
private bool IsLocal { get; set; }
|
||||
|
||||
public static LuaEventContext Create(string senderId, DateTime lastInvokeTime)
|
||||
public static LuaEventContext Create(bool isLocal, string senderId, DateTime lastInvokeTime)
|
||||
{
|
||||
var playerName = CVRPlayerManager.Instance.TryGetPlayerName(senderId);
|
||||
var playerName = isLocal ? AuthManager.Username : CVRPlayerManager.Instance.TryGetPlayerName(senderId);
|
||||
|
||||
return new LuaEventContext
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public struct LuaEventContext
|
|||
SenderName = playerName ?? "Unknown",
|
||||
LastInvokeTime = lastInvokeTime,
|
||||
TimeSinceLastInvoke = (DateTime.Now - lastInvokeTime).TotalSeconds,
|
||||
IsLocal = senderId == MetaPort.Instance.ownerId
|
||||
IsLocal = isLocal
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,11 @@ public struct LuaEventContext
|
|||
{
|
||||
Table table = new(script)
|
||||
{
|
||||
["senderId"] = SenderId,
|
||||
["senderName"] = SenderName,
|
||||
["lastInvokeTime"] = LastInvokeTime.ToUniversalTime().ToString("O"),
|
||||
["timeSinceLastInvoke"] = TimeSinceLastInvoke,
|
||||
["isLocal"] = IsLocal
|
||||
["SenderId"] = SenderId,
|
||||
["SenderName"] = SenderName,
|
||||
["LastInvokeTime"] = LastInvokeTime.ToUniversalTime().ToString("O"),
|
||||
["TimeSinceLastInvoke"] = TimeSinceLastInvoke,
|
||||
["IsLocal"] = IsLocal
|
||||
};
|
||||
return table;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue