diff --git a/code/LockedPositionController.cs b/code/LockedPositionController.cs index f325964..a391e47 100644 --- a/code/LockedPositionController.cs +++ b/code/LockedPositionController.cs @@ -14,6 +14,7 @@ public override void Simulate() EyeRot = Input.Rotation; if ( GroundBody == null ) { + Pawn.Inventory.SetActiveSlot(-1, true); var trace = TraceBBox( Position, Position + Velocity * Time.Delta - new Vector3( 0, 0, 5 ) ); if ( trace.Hit && trace.Body != null ) { GroundBody = trace.Body; diff --git a/code/Player.wire.cs b/code/Player.wire.cs index 7b7b9d3..53baedb 100644 --- a/code/Player.wire.cs +++ b/code/Player.wire.cs @@ -19,4 +19,11 @@ public void OnFrame() } } } + public override void OnAnimEventFootstep( Vector3 pos, int foot, float volume ) + { + if ( GetActiveController().GetType() == typeof( LockedPositionController ) ) { + return; + } + base.OnAnimEventFootstep( pos, foot, volume ); + } } diff --git a/code/entities/WireGateEntity.cs b/code/entities/WireGateEntity.cs index 873bd7e..09d2bdb 100644 --- a/code/entities/WireGateEntity.cs +++ b/code/entities/WireGateEntity.cs @@ -17,7 +17,7 @@ public partial class WireGateEntity : Prop, WireInputEntity, WireOutputEntity, I public static IEnumerable GetGates() { - return new string[] { "Constant", "Add", "Subtract", "Negate", "Not", "And", "Or" }; + return new string[] { "Constant", "Add", "Subtract", "Multiply", "Divide", "Negate", "Not", "And", "Or" }; } public void WireInitialize() { @@ -50,6 +50,26 @@ public void WireInitialize() this.WireTriggerOutput( "Out", outValue ); }, new string[] { "A", "B", "C", "D", "E", "F", "G", "H" } ); } + else if ( GateType == "Multiply" ) { + BulkRegisterInputHandlers( ( float value ) => { + var connectedInputs = inputs.Values.Where((input) => input.connectedOutput != null); + float outValue = 1; + foreach(var input in connectedInputs) { + outValue *= Convert.ToSingle(input.value); + } + this.WireTriggerOutput( "Out", outValue ); + }, new string[] { "A", "B", "C", "D", "E", "F", "G", "H" } ); + } + else if ( GateType == "Divide" ) { + BulkRegisterInputHandlers( ( float value ) => { + var b = Convert.ToSingle( inputs["B"].value ); + if (b == 0) { + this.WireTriggerOutput( "Out", 0 ); + } else { + this.WireTriggerOutput( "Out", Convert.ToSingle( inputs["A"].value ) / b ); + } + }, new string[] { "A", "B" } ); + } else if ( GateType == "Negate" ) { this.RegisterInputHandler( "A", ( float value ) => { this.WireTriggerOutput( "Out", -value );