Skip to content
Open
Changes from all 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
14 changes: 9 additions & 5 deletions CelesteNet.Client/Entities/Ghost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public class Ghost : Actor, ITickReceiver {
public Holdable Holdable;
private bool HoldableAdded;

public bool MutualInteractable => CelesteNetClientModule.Session.UseInteractions && Interactive;
public bool Grabable => IdleTag == null && MutualInteractable;

public GhostNameTag? NameTag;
public GhostEmote? IdleTag;

Expand Down Expand Up @@ -80,7 +83,7 @@ public Ghost(CelesteNetClientContext? context, DataPlayerInfo playerInfo, Player
OnRelease = OnRelease
};

Collidable = true;
Collidable = MutualInteractable;
Collider = new Hitbox(8f, 11f, -4f, -11f);
Add(new PlayerCollider(OnPlayer));

Expand Down Expand Up @@ -115,7 +118,7 @@ public void OnPickup() {
}

public void OnPlayer(Player player) {
if (!Interactive || GrabCooldown > 0f || !CelesteNetClientModule.Session.UseInteractions || Context?.Main.GrabbedBy == this)
if (!MutualInteractable || GrabCooldown > 0f || Context?.Main.GrabbedBy == this)
return;

if (player.StateMachine.State == Player.StNormal &&
Expand All @@ -137,7 +140,7 @@ public void OnPlayer(Player player) {
}

public void OnCarry(Vector2 position) {
if (!Interactive || GrabCooldown > 0f || !CelesteNetClientModule.Session.UseInteractions || IdleTag != null)
if (!Grabable || GrabCooldown > 0f)
return;

Position = position;
Expand All @@ -159,7 +162,7 @@ public void OnCarry(Vector2 position) {
public void OnRelease(Vector2 force) {
Collidable = true;

if (!Interactive || GrabCooldown > 0f || !CelesteNetClientModule.Session.UseInteractions || IdleTag != null)
if (!Grabable || GrabCooldown > 0f)
return;

CelesteNetClient? client = Context?.Client;
Expand Down Expand Up @@ -189,7 +192,8 @@ public override void Update() {
return;
}

bool holdable = Interactive && GrabCooldown <= 0f && CelesteNetClientModule.Session.UseInteractions && IdleTag == null;
bool holdable = Grabable && GrabCooldown <= 0f;
Collidable = Holdable.Holder == null && MutualInteractable; //Not sure it is save or not

GrabCooldown -= Engine.RawDeltaTime;
if (GrabCooldown < 0f)
Expand Down