Define new keys with mod?

User avatar
mrf
Member
 
Posts: 11
Joined: Fri Aug 01, 2014 17:08

Define new keys with mod?

by mrf » Sun May 24, 2015 19:35

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
 

prestidigitator
Member
 
Posts: 640
Joined: Thu Feb 21, 2013 23:54

Re: Define new keys with mod?

by prestidigitator » Sun May 24, 2015 21:05

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.
Last edited by prestidigitator on Sun May 24, 2015 21:06, edited 1 time in total.
 

User avatar
Don
Member
 
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Define new keys with mod?

by Don » Sun May 24, 2015 21:05

Edit. Deleted due to thinking wrong
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
mrf
Member
 
Posts: 11
Joined: Fri Aug 01, 2014 17:08

Re: Define new keys with mod?

by mrf » Sun May 24, 2015 21:53

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.
 

User avatar
oleastre
Member
 
Posts: 81
Joined: Wed Aug 13, 2014 21:39
GitHub: oleastre
In-game: oleastre

Re: Define new keys with mod?

by oleastre » Mon May 25, 2015 20:31

I remember reading some discussions about custom mappable keys... (but cannot remember where)

Something already asked here: https://github.com/minetest/minetest/issues/560
 

blert2112
Member
 
Posts: 244
Joined: Sat Apr 25, 2015 04:05
GitHub: blert2112

Re: Define new keys with mod?

by blert2112 » Wed May 27, 2015 14:49

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.
 


Return to General Discussion



Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 12 guests