diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89635f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.vmdl_c +*.vpcf_c +*.vmat_c +*.vtex_c diff --git a/code/entities/ThrusterEntity.wire.cs b/code/entities/ThrusterEntity.wire.cs index 140b046..1770bb9 100755 --- a/code/entities/ThrusterEntity.wire.cs +++ b/code/entities/ThrusterEntity.wire.cs @@ -2,9 +2,6 @@ public partial class ThrusterEntity : WireInputEntity { - // todo: the vanilla ThrusterEntity is just on/off, so we'll probably want to just replace it entirely, rather than this extending... - [Net] - public float ForceMultiplier { get; set; } = 1.0f; WirePortData IWireEntity.WirePorts { get; } = new WirePortData(); public void WireInitialize() { diff --git a/code/entities/WireGateEntity.cs b/code/entities/WireGateEntity.cs index 78bebcf..873bd7e 100644 --- a/code/entities/WireGateEntity.cs +++ b/code/entities/WireGateEntity.cs @@ -4,11 +4,21 @@ using System.Linq; [Library( "ent_wiregate", Title = "Wire Gate" )] -public partial class WireGateEntity : Prop, WireInputEntity, WireOutputEntity +public partial class WireGateEntity : Prop, WireInputEntity, WireOutputEntity, IUse { [Net] public string GateType { get; set; } = "Add"; + + private int constantValue = 3; + + [Net] + public string DebugText { get; set; } = ""; WirePortData IWireEntity.WirePorts { get; } = new WirePortData(); + + public static IEnumerable GetGates() + { + return new string[] { "Constant", "Add", "Subtract", "Negate", "Not", "And", "Or" }; + } public void WireInitialize() { var inputs = ((IWireEntity)this).WirePorts.inputs; @@ -67,6 +77,10 @@ public void WireInitialize() this.WireTriggerOutput( "Out", outValue ); }, new string[] { "A", "B", "C", "D", "E", "F", "G", "H" } ); } + else if ( GateType == "Constant" ) { + DebugText = $" value: {constantValue}"; + this.WireTriggerOutput( "Out", constantValue ); + } } protected void BulkRegisterInputHandlers( Action handler, string[] inputNames ) @@ -88,6 +102,19 @@ public string[] WireGetOutputs() string IWireEntity.GetOverlayText() { - return $"Gate: {GateType}"; + return $"Gate: {GateType}{DebugText}"; + } + + public bool OnUse( Entity user ) + { + if ( GateType == "Constant" && Host.IsServer ) { + constantValue += Input.Down( InputButton.Run ) ? -1 : 1; + } + return false; + } + + public bool IsUsable( Entity user ) + { + return this.GateType == "Constant"; } } diff --git a/code/tools/Wiring.cs b/code/tools/Wiring.cs index bb6976c..49085df 100644 --- a/code/tools/Wiring.cs +++ b/code/tools/Wiring.cs @@ -301,7 +301,7 @@ public partial class WireGatePanel : Panel { public WireGatePanel() { - foreach ( var name in new string[] { "Add", "Subtract", "Negate", "Not", "And", "Or" } ) { + foreach ( var name in WireGateEntity.GetGates() ) { Add.Button( name, () => { ConsoleSystem.Run( "wire_spawn_gate", name ); } ); diff --git a/models/wirebox/katlatze/button.vmdl_c b/models/wirebox/katlatze/button.vmdl_c deleted file mode 100755 index ac620c1..0000000 Binary files a/models/wirebox/katlatze/button.vmdl_c and /dev/null differ diff --git a/models/wirebox/katlatze/spoon.vmdl_c b/models/wirebox/katlatze/spoon.vmdl_c deleted file mode 100755 index 083c906..0000000 Binary files a/models/wirebox/katlatze/spoon.vmdl_c and /dev/null differ