add ship to enter/leave

This commit is contained in:
Mister_Nebula 2021-06-19 13:22:05 +01:00
parent cf23dabbd9
commit 1fd0079018
4 changed files with 21 additions and 1 deletions

View File

@ -24,6 +24,8 @@
public static string ExitRoastingMode = "ExitRoastingMode";
public static string EnterFlightConsole = "EnterFlightConsole";
public static string ExitFlightConsole = "ExitFlightConsole";
public static string EnterShip = "EnterShip";
public static string ExitShip = "ExitShip";
// Custom event names -- change if you want! These can be anything, as long as both
// sides of the GlobalMessenger (fireevent and addlistener) reference the same thing.

View File

@ -9,6 +9,8 @@
EnterPlatform = 4,
ExitPlatform = 5,
EnterHeadZone = 6,
ExitHeadZone = 7
ExitHeadZone = 7,
EnterShip = 8,
ExitShip = 9
}
}

View File

@ -21,6 +21,8 @@ namespace QSB.Player.Events
GlobalMessenger<int>.AddListener(EventNames.QSBExitPlatform, (int id) => Handler(EnterLeaveType.ExitPlatform, id));
GlobalMessenger<int>.AddListener(EventNames.QSBEnterHeadZone, (int id) => Handler(EnterLeaveType.EnterHeadZone, id));
GlobalMessenger<int>.AddListener(EventNames.QSBExitHeadZone, (int id) => Handler(EnterLeaveType.ExitHeadZone, id));
GlobalMessenger.AddListener(EventNames.EnterShip, () => Handler(EnterLeaveType.EnterShip));
GlobalMessenger.AddListener(EventNames.ExitShip, () => Handler(EnterLeaveType.ExitShip));
}
public override void CloseListener()

View File

@ -1,9 +1,11 @@
using OWML.Common;
using QSB.Player;
using QSB.ShipSync.TransformSync;
using QSB.Utility;
using QSB.WorldSync;
using QuantumUNET;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@ -33,6 +35,8 @@ namespace QSB.ShipSync
}
}
private List<PlayerInfo> _playersInShip = new List<PlayerInfo>();
private uint _currentFlyer = uint.MaxValue;
public void Start()
@ -82,6 +86,16 @@ namespace QSB.ShipSync
PrintAll(shipHulls);
}
public void AddPlayerToShip(PlayerInfo player)
{
_playersInShip.Add(player);
}
public void RemovePlayerFromShip(PlayerInfo player)
{
_playersInShip.Remove(player);
}
private void PrintAll(Array array)
{
foreach (var item in array)