Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only let people join at start of loop #639

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions QSB/Anglerfish/WorldObjects/QSBAngler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public class QSBAngler : LinkedWorldObject<AnglerfishController, AnglerTransform
protected override GameObject NetworkObjectPrefab => QSBNetworkManager.singleton.AnglerPrefab;
protected override bool SpawnWithServerOwnership => false;

public override void SendInitialState(uint to) =>
this.SendMessage(new AnglerDataMessage(this) { To = to });

public void UpdateTargetVelocity()
{
if (TargetTransform == null)
Expand Down
11 changes: 0 additions & 11 deletions QSB/Animation/Player/AnimationSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using QSB.Messaging;
using QSB.Player;
using QSB.Utility;
using QSB.WorldSync;
using System;
using UnityEngine;

Expand All @@ -31,18 +30,8 @@ protected void Awake()
InvisibleAnimator = gameObject.GetRequiredComponent<Animator>();
NetworkAnimator = gameObject.GetRequiredComponent<NetworkAnimator>();
NetworkAnimator.enabled = false;
RequestInitialStatesMessage.SendInitialState += SendInitialState;
}

protected void OnDestroy() => RequestInitialStatesMessage.SendInitialState -= SendInitialState;

/// <summary>
/// This wipes the NetworkAnimator's fields, so it assumes the parameters have changed.
/// Basically just forces it to set all its dirty flags.
/// BUG: this doesnt work for other players because its only called by the host.
/// </summary>
private void SendInitialState(uint to) => NetworkAnimator.Invoke("Awake");

public void Reset() => InSuitedUpState = false;

private void InitCommon(Transform modelRoot)
Expand Down
3 changes: 0 additions & 3 deletions QSB/CampfireSync/Messages/BurnSlideReelMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

namespace QSB.CampfireSync.Messages;

/// <summary>
/// TODO: initial state on campfire and item
/// </summary>
public class BurnSlideReelMessage : QSBWorldObjectMessage<QSBSlideReelItem, int>
{
public BurnSlideReelMessage(QSBCampfire campfire) : base(campfire.ObjectId) { }
Expand Down
3 changes: 0 additions & 3 deletions QSB/CampfireSync/WorldObjects/QSBCampfire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ namespace QSB.CampfireSync.WorldObjects;

public class QSBCampfire : WorldObject<Campfire>
{
public override void SendInitialState(uint to) =>
this.SendMessage(new CampfireStateMessage(GetState()) { To = to });

public void StartRoasting()
=> AttachedObject.StartRoasting();

Expand Down
50 changes: 0 additions & 50 deletions QSB/ConversationSync/Messages/RemoteDialogueInitialStateMessage.cs

This file was deleted.

10 changes: 0 additions & 10 deletions QSB/ConversationSync/WorldObjects/QSBCharacterDialogueTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ public override void OnRemoval()
QSBPlayerManager.OnRemovePlayer -= OnRemovePlayer;
}

public override void SendInitialState(uint to)
{
var playerId = ConversationManager.Instance.GetPlayerTalkingToTree(AttachedObject);
if (playerId != uint.MaxValue)
{
this.SendMessage(new ConversationStartEndMessage(playerId, true) { To = to });
}
// TODO: maybe also sync the dialogue box and player box?
}

private void OnRemovePlayer(PlayerInfo player)
{
if (player.CurrentCharacterDialogueTree == this)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using QSB.ConversationSync.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using QSB.WorldSync;

namespace QSB.ConversationSync.WorldObjects;

public class QSBRemoteDialogueTrigger : WorldObject<RemoteDialogueTrigger>
{
public override void SendInitialState(uint to) =>
this.SendMessage(new RemoteDialogueInitialStateMessage(AttachedObject) { To = to });

public void RemoteEnterDialogue(int dialogueIndex)
{
var dialogueCondition = AttachedObject._listDialogues[dialogueIndex];
Expand Down

This file was deleted.

16 changes: 2 additions & 14 deletions QSB/EchoesOfTheEye/AirlockSync/WorldObjects/QSBGhostAirlock.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
using QSB.EchoesOfTheEye.AirlockSync.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using QSB.WorldSync;

namespace QSB.EchoesOfTheEye.AirlockSync.WorldObjects;

public class QSBGhostAirlock : WorldObject<GhostAirlock>
{
public override void SendInitialState(uint to)
=> this.SendMessage(
new AirlockInitialStateMessage(
AttachedObject._innerDoor.IsOpen(),
AttachedObject._outerDoor.IsOpen(),
AttachedObject._pressurized
)
);
}
public class QSBGhostAirlock : WorldObject<GhostAirlock> { }
11 changes: 1 addition & 10 deletions QSB/EchoesOfTheEye/AlarmTotemSync/WorldObjects/QSBAlarmTotem.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using QSB.EchoesOfTheEye.AlarmTotemSync.Messages;
using QSB.Messaging;
using QSB.OwnershipSync;
using QSB.OwnershipSync;

namespace QSB.EchoesOfTheEye.AlarmTotemSync.WorldObjects;

public class QSBAlarmTotem : OwnedWorldObject<AlarmTotem>
{
public override bool CanOwn => AttachedObject.enabled;

public override void SendInitialState(uint to)
{
base.SendInitialState(to);

this.SendMessage(new SetVisibleMessage(AttachedObject._isPlayerVisible) { To = to });
}
}
10 changes: 2 additions & 8 deletions QSB/EchoesOfTheEye/DreamCandles/WorldObjects/QSBDreamCandle.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using QSB.EchoesOfTheEye.DreamCandles.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using QSB.WorldSync;

namespace QSB.EchoesOfTheEye.DreamCandles.WorldObjects;

public class QSBDreamCandle : WorldObject<DreamCandle>
{
public override void SendInitialState(uint to) =>
this.SendMessage(new SetLitMessage(AttachedObject._lit, false, true) { To = to });
}
public class QSBDreamCandle : WorldObject<DreamCandle> { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Cysharp.Threading.Tasks;
using QSB.EchoesOfTheEye.DreamLantern.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using System.Threading;

Expand All @@ -19,13 +17,5 @@ public override async UniTask Init(CancellationToken ct)
}
}

public override void SendInitialState(uint to)
{
this.SendMessage(new SetLitMessage(AttachedObject._lit) { To = to });
this.SendMessage(new SetConcealedMessage(AttachedObject._concealed) { To = to });
this.SendMessage(new SetFocusMessage(AttachedObject._focus) { To = to });
this.SendMessage(new SetRangeMessage(AttachedObject._minRange, AttachedObject._maxRange) { To = to });
}

public bool IsGhostLantern => AttachedObject.name == "GhostLantern"; // it's as shrimple as that
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using QSB.EchoesOfTheEye.DreamObjectProjectors.Messages;
using QSB.Messaging;
using QSB.WorldSync;
using QSB.WorldSync;

namespace QSB.EchoesOfTheEye.DreamObjectProjectors.WorldObject;

public class QSBDreamObjectProjector : WorldObject<DreamObjectProjector>
{
public override void SendInitialState(uint to)
=> this.SendMessage(new ProjectorLitMessage(AttachedObject._lit) { To = to });
}
public class QSBDreamObjectProjector : WorldObject<DreamObjectProjector> { }
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

namespace QSB.EchoesOfTheEye.DreamWorld.Messages;

/// <summary>
/// todo SendInitialState
/// </summary>
public class EnterDreamWorldMessage : QSBWorldObjectMessage<QSBDreamLanternItem>
{
static EnterDreamWorldMessage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

namespace QSB.EchoesOfTheEye.DreamWorld.Messages;

/// <summary>
/// todo SendInitialState
/// </summary>
public class ExitDreamWorldMessage : QSBMessage
{
static ExitDreamWorldMessage()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public class QSBEclipseCodeController : WorldObject<EclipseCodeController4>
{
public PlayerInfo PlayerInControl;

public override void SendInitialState(uint to)
{
this.SendMessage(new InitialStateMessage(AttachedObject) { To = to });
this.SendMessage(new UseControllerMessage(PlayerInControl?.PlayerId ?? 0) { To = to });
}

public override async UniTask Init(CancellationToken ct)
{
QSBPlayerManager.OnRemovePlayer += OnPlayerLeave;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@

namespace QSB.EchoesOfTheEye.EclipseElevators.WorldObjects;

public class QSBElevatorDestination : WorldObject<ElevatorDestination>
{
public override void SendInitialState(uint to)
{
// todo : implement
}
}
public class QSBElevatorDestination : WorldObject<ElevatorDestination> { }
5 changes: 0 additions & 5 deletions QSB/EchoesOfTheEye/Ghosts/WorldObjects/QSBGhostBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
{
#region World Object Stuff

public override void SendInitialState(uint to)
{
// todo SendInitialState
}

public override async UniTask Init(CancellationToken ct)
{
Awake();
Expand Down
5 changes: 0 additions & 5 deletions QSB/EchoesOfTheEye/Ghosts/WorldObjects/QSBGhostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace QSB.EchoesOfTheEye.Ghosts.WorldObjects;

public class QSBGhostController : WorldObject<GhostController>, IGhostObject
{
public override void SendInitialState(uint to)
{
// todo SendInitialState
}

public QSBGhostEffects _effects;

public void Initialize(GhostNode.NodeLayer layer, QSBGhostEffects effects)
Expand Down
5 changes: 0 additions & 5 deletions QSB/EchoesOfTheEye/Ghosts/WorldObjects/QSBGhostEffects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ namespace QSB.EchoesOfTheEye.Ghosts.WorldObjects;

public class QSBGhostEffects : WorldObject<GhostEffects>, IGhostObject
{
public override void SendInitialState(uint to)
{
// todo SendInitialState
}

public override bool ShouldDisplayDebug() => false;

private QSBGhostData _data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ namespace QSB.EchoesOfTheEye.Ghosts.WorldObjects;

public class QSBGhostGrabController : WorldObject<GhostGrabController>
{
public override void SendInitialState(uint to)
{
// todo SendInitialState
}

public void GrabPlayer(float speed, GhostPlayer player, bool remote = false)
{
if (!remote)
Expand Down
Loading