wiremod / wirebox

Wire for S&Box. Early WIP.
MIT License
37 stars 8 forks source link

Better input handling #1

Closed thegrb93 closed 3 years ago

thegrb93 commented 3 years ago

Instead of the crappy old way,

if ( inputName == "ForceMultiplier" ) {

How about a Dictionary<string, delegate>?

Nebual commented 3 years ago

Good point; in addressing this, I got a chance to start tracking input types too. Registering now looks like:

((WireInputEntity)this).RegisterInputHandler( "On", ( bool value ) => {
    Enabled = value;
} );
thegrb93 commented 3 years ago

Nice, much better