Skip to content

Commit

Permalink
feat: try closing the door every frame
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Dec 9, 2023
1 parent 2e5073a commit dec4af5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lc-hax/Scripts/Commands/LockCommand.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@

using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace Hax;

public class LockCommand : ICommand {
public void Execute(string[] _) {
public void Execute(string[] args) {
List<DoorLock> doors = [.. Object.FindObjectsOfType<DoorLock>()];

_ = Helper.CreateComponent<TransientBehaviour>().Init((_) => {
doors.ForEach(door => {
AnimatedObjectTrigger animatedObjectTrigger = door.gameObject.GetComponent<AnimatedObjectTrigger>();
animatedObjectTrigger.boolValue = false;
animatedObjectTrigger.TriggerAnimation(Helper.GetPlayer(0));
});
}, 60.0f);

Object.FindObjectsOfType<TerminalAccessibleObject>()
.ToList()
.ForEach(terminalAccessibleObject => terminalAccessibleObject.SetDoorOpenServerRpc(false));

}
}

0 comments on commit dec4af5

Please sign in to comment.