more stuff

This commit is contained in:
Mister_Nebula 2020-08-08 13:27:49 +01:00
parent 3e6adf984c
commit a3e3dff725
5 changed files with 54 additions and 7 deletions

View File

@ -16,7 +16,7 @@ namespace QSB.Events
EventList.Add(new PlayerFlashlightEvent());
EventList.Add(new PlayerSignalscopeEvent());
EventList.Add(new PlayerTrasnlatorEvent());
//EventList.Add(new PlayerProbeLauncherEvent());
EventList.Add(new PlayerProbeLauncherEvent());
//EventList.Add(new PlayerProbeEvent());
//EventList.Add(new PlayerSectorChange());
EventList.Add(new PlayerJoinEvent());

View File

@ -22,7 +22,10 @@ namespace QSB.Events
public override void OnReceiveLocal(object[] data)
{
return;
var player = PlayerRegistry.CreatePlayer(PlayerTransformSync.LocalInstance.netId.Value);
player.Name = (string)data[0];
player.IsReady = true;
DebugLog.ToAll($"{player.Name} joined!");
}
}
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace QSB.Events
{
class PlayerProbeLauncherEvent : QSBEvent
{
public override EventType Type => EventType.ProbeLauncherActiveChange;
public override void SetupListener()
{
GlobalMessenger<ProbeLauncher>.AddListener("ProbeLauncherEquipped", var => EventSender.SendEvent(this, PlayerRegistry.LocalPlayer.NetId, true));
GlobalMessenger<ProbeLauncher>.AddListener("ProbeLauncherUnequipped", var => EventSender.SendEvent(this, PlayerRegistry.LocalPlayer.NetId, false));
}
public override void OnReceive(uint sender, object[] data)
{
var player = PlayerRegistry.GetPlayer(sender);
var tool = player.ProbeLauncher;
player.UpdateState(State.ProbeLauncher, (bool)data[0]);
if ((bool)data[0] == true)
{
tool.EquipTool();
}
else
{
tool.UnequipTool();
}
}
public override void OnReceiveLocal(object[] data)
{
var tool = PlayerRegistry.LocalPlayer.ProbeLauncher;
if ((bool)data[0] == true)
{
tool.EquipTool();
}
else
{
tool.UnequipTool();
}
}
}
}

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QSB.Messaging;
namespace QSB.Events
{
@ -11,6 +8,6 @@ namespace QSB.Events
public abstract void SetupListener();
public abstract void OnReceive(uint sender, object[] data);
public abstract void OnReceiveLocal(object[] data);
public virtual void OnReceiveLocal(object[] data) { }
}
}

View File

@ -115,6 +115,7 @@
<Compile Include="Animation\AnimTrigger.cs" />
<Compile Include="Events\PlayerFlashlightEvent.cs" />
<Compile Include="Events\PlayerJoinEvent.cs" />
<Compile Include="Events\PlayerProbeLauncherEvent.cs" />
<Compile Include="Events\PlayerSignalscopeEvent.cs" />
<Compile Include="Events\PlayerTranslatorEvent.cs" />
<Compile Include="Events\QSBEvent.cs" />