|
|
@@ -39,15 +39,14 @@ namespace TechbloxModdingAPI.Players |
|
|
|
[APITestCase(TestType.Game)] |
|
|
|
public static void SeatEventTestBuild() |
|
|
|
{ |
|
|
|
Player.LocalPlayer.SeatEntered += Assert.CallsBack<PlayerSeatEventArgs>("SeatEntered"); |
|
|
|
Player.LocalPlayer.SeatExited += Assert.CallsBack<PlayerSeatEventArgs>("SeatExited"); |
|
|
|
Block.PlaceNew(BlockIDs.DriverSeat, Player.LocalPlayer.Position); |
|
|
|
} |
|
|
|
|
|
|
|
[APITestCase(TestType.SimulationMode)] |
|
|
|
public static IEnumerator<TaskContract> SeatEventTestSim() |
|
|
|
{ |
|
|
|
yield return new WaitForSecondsEnumerator(1).Continue(); |
|
|
|
Player.LocalPlayer.SeatEntered += Assert.CallsBack<PlayerSeatEventArgs>("SeatEntered"); |
|
|
|
Player.LocalPlayer.SeatExited += Assert.CallsBack<PlayerSeatEventArgs>("SeatExited"); |
|
|
|
Assert.Equal(Player.LocalPlayer.SpawnMachine(), true, "Failed to spawn the player's machine.", "Successfully spawned the player's machine."); |
|
|
|
yield return new WaitForSecondsEnumerator(1).Continue(); |
|
|
|
var seats = Game.CurrentGame().GetBlocksInGame(BlockIDs.DriverSeat); |
|
|
@@ -56,7 +55,7 @@ namespace TechbloxModdingAPI.Players |
|
|
|
{ |
|
|
|
Logging.MetaLog("Waiting for a seat to be spawned..."); |
|
|
|
yield return new WaitForSecondsEnumerator(1).Continue(); |
|
|
|
Console.WriteLine("Spawn machine: " + Player.LocalPlayer.SpawnMachine()); |
|
|
|
Logging.MetaLog("Spawn machine: " + Player.LocalPlayer.SpawnMachine()); |
|
|
|
seats = Game.CurrentGame().GetBlocksInGame(BlockIDs.DriverSeat); |
|
|
|
c++; |
|
|
|
} |
|
|
@@ -68,7 +67,7 @@ namespace TechbloxModdingAPI.Players |
|
|
|
} |
|
|
|
|
|
|
|
if (seats[0] is Seat seat) |
|
|
|
{ //TODO: Actually, the problem is likely that the player ID is different in build and sim |
|
|
|
{ |
|
|
|
Assert.Errorless(() => Player.LocalPlayer.EnterSeat(seat), "Failed to enter seat.", |
|
|
|
"Entered seat successfully."); |
|
|
|
while (Player.LocalPlayer.State != PlayerState.InSeat) |
|
|
|