Page 1 of 1
Define new keys with mod?

Posted:
Sun May 24, 2015 19:35
by mrf
Howdy,
Is it possible to define a new key mapping using a mod? A specific example: I would like to add a self-destruct key to the game. When the key is pressed, my character dies immediately. I don't want this functionality attached to any thing in the world and I do want it globally available to all players. I would also like a key mapping that reduces health each time it is pressed. (This could be a preferred alternative to the instantaneous self-destruct key.)
Thx-mrf
Re: Define new keys with mod?

Posted:
Sun May 24, 2015 21:05
by prestidigitator
Not generally. There's exactly one key which isn't used by the engine and typically isn't used by tools/mods. It's the "use/aux1" key, usually mapped to 'E' on the keyboard. You'd also have to poll for whether the key is currently depressed or not, because there are no events delivered.
Re: Define new keys with mod?

Posted:
Sun May 24, 2015 21:05
by Don
Edit. Deleted due to thinking wrong
Re: Define new keys with mod?

Posted:
Sun May 24, 2015 21:53
by mrf
OK, well that's sort of a relief. I've added 9 new keys to the game already, defining 10 different speeds. Those were easy since they were just extensions to the forward key. Adding the self-destruct key has been difficult and the whole time I've been experimenting I've had this nagging feeling I should be using a mod for it but I never saw anything in the modding API that made it look possible.
Then this afternoon I was hoping I could use a mod for it since that would have to be easier than what I'm doing.
Re: Define new keys with mod?

Posted:
Mon May 25, 2015 20:31
by oleastre
I remember reading some discussions about custom mappable keys... (but cannot remember where)
Something already asked here:
https://github.com/minetest/minetest/issues/560
Re: Define new keys with mod?

Posted:
Wed May 27, 2015 14:49
by blert2112
Just asking...
Why not just register a new chat command to do this for you. Set it with a priv so it can be granted.
If you really need it bound to a single key there are many apps out there for key bindings (are they still called macros?). Mayhaps I am not understanding what you are trying to accomplish.