Skip to content

Commit

Permalink
refactor: clean up new trigger mod
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Feb 3, 2024
1 parent a592374 commit 934a873
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions lc-hax/Scripts/Helpers/Grabbables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ static void DropSFX(this GrabbableObject item) {
);
}

public static void InteractWithProp(this GrabbableObject item, bool playSFX = false) {
if (Helper.LocalPlayer is PlayerControllerB localPlayer && !item.IsOwner) {
item.ChangeOwnershipOfProp(localPlayer.actualClientId);
public static void InteractWithProp(this GrabbableObject grabbable, bool playSFX = false) {
if (Helper.LocalPlayer is PlayerControllerB localPlayer && !grabbable.IsOwner) {
grabbable.ChangeOwnershipOfProp(localPlayer.actualClientId);
}

if (playSFX) {
item.DropSFX();
grabbable.DropSFX();
}

if (item.TryGetComponent(out AnimatedItem animated)) {
animated.EquipItem();
if (grabbable.TryGetComponent(out AnimatedItem animatedItem)) {
animatedItem.EquipItem();
return;
}

if (item.TryGetComponent(out NoisemakerProp noiseprop)) {
noiseprop.ItemActivate(true, true);
if (grabbable.TryGetComponent(out NoisemakerProp noisemakerProp)) {
noisemakerProp.ItemActivate(true, true);
return;
}

if (item.TryGetComponent(out BoomboxItem BoomBox)) {
BoomBox.ItemActivate(true, true);
if (grabbable.TryGetComponent(out BoomboxItem boomboxItem)) {
boomboxItem.ItemActivate(true, true);
return;
}

if (item.TryGetComponent(out WhoopieCushionItem fartcushion)) {
fartcushion.Fart();
if (grabbable.TryGetComponent(out WhoopieCushionItem whoopieCushionItem)) {
whoopieCushionItem.Fart();
return;
}

item.UseItemOnClient(true);
grabbable.UseItemOnClient(true);
}

public static void ShootShotgun(this ShotgunItem item, Transform origin) {
Expand Down
6 changes: 3 additions & 3 deletions lc-hax/Scripts/Modules/TriggerMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ void Fire() {
doorLock.UnlockDoorSyncWithServer();
break;
}
if (collider.TryGetComponent(out GrabbableObject prop)) {
prop.InteractWithProp(true);

if (collider.TryGetComponent(out GrabbableObject grabbable)) {
grabbable.InteractWithProp(true);
break;
}


if (collider.TryGetComponent(out PlayerControllerB player)) {
Helper.GetEnemy<CentipedeAI>()?.ClingToPlayerServerRpc(player.playerClientId);
this.PromptEnemiesToTarget(player, this.FunnyReviveEnabled)
Expand Down

0 comments on commit 934a873

Please sign in to comment.