Autorun

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Autorun

by duane » Sat Sep 12, 2015 08:04

If anyone, like myself, misses WoW's autorun key, it's pretty easy to add, if you're willing to compile minetest.

Code: Select all
--- game.cpp    2015-09-12 02:50:54.205681153 -0500
+++ game.cpp.new        2015-09-12 02:46:24.224342387 -0500
@@ -1236,6 +1236,9 @@
                KEYMAP_ID_SPECIAL1,
                KEYMAP_ID_SNEAK,
 
+               //djr
+               KEYMAP_ID_AUTORUN,
+
                // Other
                KEYMAP_ID_DROP,
                KEYMAP_ID_INVENTORY,
@@ -1287,6 +1290,9 @@
        key[KEYMAP_ID_SPECIAL1]     = getKeySetting("keymap_special1");
        key[KEYMAP_ID_SNEAK]        = getKeySetting("keymap_sneak");
 
+       // djr
+       key[KEYMAP_ID_AUTORUN]      = getKeySetting("keymap_autorun");
+
        key[KEYMAP_ID_DROP]         = getKeySetting("keymap_drop");
        key[KEYMAP_ID_INVENTORY]    = getKeySetting("keymap_inventory");
        key[KEYMAP_ID_CHAT]         = getKeySetting("keymap_chat");
@@ -2616,6 +2622,10 @@
 
        if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) {
                dropSelectedItem();
+       // djr
+       } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) {
+               bool autorun_setting = g_settings->getBool("continuous_forward");
+               g_settings->setBool("continuous_forward", !autorun_setting);
        } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) {
                openInventory();
        } else if (input->wasKeyDown(EscapeKey) || input->wasKeyDown(CancelKey)) {


I also added a change to disable the scroll wheel, because I keep activating my trackpad's scroll by mistake.

Code: Select all
@@ -2704,7 +2714,8 @@
         */
        *new_playeritem = client->getPlayerItem();
 
-       s32 wheel = input->getMouseWheel();
+       //s32 wheel = input->getMouseWheel();
+       s32 wheel = 0;
        u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
                                 player->hud_hotbar_itemcount - 1);


You'll also want to add a key setting to your minetest.conf file, replacing the "P" with your key choice.

Code: Select all
keymap_autorun = KEY_KEY_P


This seems to work fine on my system, and I can't imagine any reason why it wouldn't work on windoze, but it's obviously not useful for android. However, I may discover that it screws everything up tomorrow, so use at your own risk.

I'm sure somebody has done this before, but I've searched for days and couldn't find it.
Believe in people and you don't need to believe anything else.
 

nrz
Developer
 
Posts: 130
Joined: Sat Feb 07, 2015 17:16
Location: France
GitHub: nerzhul
IRC: nrzkt
In-game: nrz

Re: Autorun

by nrz » Sat Sep 12, 2015 08:38

I suggest you to do a PR and propose this patch on github, could be useful !
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Sat Sep 12, 2015 11:42

I have the feeling that there's a reason why they never added this. The basic behavior was already there. It was easy to tie it to a key. Maybe they're afraid of people logging in to servers and autorunning across the landscape until the mapgen chokes on it and the whole server crashes.
Believe in people and you don't need to believe anything else.
 

Sokomine
Member
 
Posts: 3890
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Autorun

by Sokomine » Sat Sep 12, 2015 15:04

duane wrote:If anyone, like myself, misses WoW's autorun key, it's pretty easy to add, if you're willing to compile minetest.

That's great! I've wished for an auto-run-key for a long time. It is very annoying to press a key for a long time.

duane wrote:This seems to work fine on my system, and I can't imagine any reason why it wouldn't work on windoze, but it's obviously not useful for android. However, I may discover that it screws everything up tomorrow, so use at your own risk.

It could even be particulary intresting on Android. Maybe in combination with reaction to the motion sensors. Normal walking could still worlk through the keys, but getting to the area of intrest could be a lot easier and more immersive that way.

nrz wrote:I suggest you to do a PR and propose this patch on github, could be useful !

By all means!

duane wrote:I have the feeling that there's a reason why they never added this. The basic behavior was already there. It was easy to tie it to a key. Maybe they're afraid of people logging in to servers and autorunning across the landscape until the mapgen chokes on it and the whole server crashes.

Don't worry. That won't happen in practice on realistic maps. The next hole will be there - and the player will fall into it, forever running against a wall. Or the next best tree. Or drowning in the next ocean. It's just a matter of time.
A list of my mods can be found here.
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Tue Sep 29, 2015 11:38

If anyone is interested in getting this into the main code base, I suggest you comment on this pull request.
Believe in people and you don't need to believe anything else.
 

User avatar
Ferk
Member
 
Posts: 337
Joined: Tue Aug 18, 2015 17:18
GitHub: Ferk

Re: Autorun

by Ferk » Tue Sep 29, 2015 13:28

So this toggles a continue-walking mode? I've never seen something like that, I'll have to test this. But I have a feeling this mostly makes sense for games that are very mouse-oriented, I think there should be a way to open the inventory with the mouse for this to be more interesting.

Btw.. coincidentally F is the key I always use for the inventory. R and E are also assigned. If this gets included as the F key I guess I'll have to use C or X.. I refuse to go to the other side of the keyboard for something I press so much. And I'd rather not reconfigure all the keys. What do you guys use for the inventory key?
{ ☠ Dungeontest ☠ , ᗧ••myarcade•• }
 

User avatar
kaadmy
Member
 
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Autorun

by kaadmy » Tue Sep 29, 2015 17:16

I use a laptop, so the side of the keyboard doesn't matter much at all for me, moving my hand a few inches isn't a problem :)
Maybe pressing any normal movement key should disable autorun? With duane's build, it got turned on and I couldn't figure out why :)
Never paint white stripes on roads near Zebra crossings.

Pixture
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Tue Sep 29, 2015 18:38

kaadmy wrote:Maybe pressing any normal movement key should disable autorun? With duane's build, it got turned on and I couldn't figure out why :)


I think so too, but that's more work than I'm willing to put into it right now. This patch only attaches the existing feature to a key. I have a lot of trouble following the game code.

I dislike putting any default at all on it, but the standard check for a key setting uses the version that throws errors rather than just dropping out gracefully. I'm probably missing something there.
Believe in people and you don't need to believe anything else.
 

User avatar
kaadmy
Member
 
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Autorun

by kaadmy » Tue Sep 29, 2015 18:50

duane wrote:I dislike putting any default at all on it, but the standard check for a key setting uses the version that
throws errors rather than just dropping out gracefully. I'm probably missing something there.

Would assigning autorun to an empty setting break anything, or would it assume nothing's bound to it and peacefully continue?
Never paint white stripes on roads near Zebra crossings.

Pixture
 

Amaz
Member
 
Posts: 348
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Autorun

by Amaz » Tue Sep 29, 2015 19:51

toggle_camera_update is assigned to no key in non-debug builds, maybe this helps?
https://github.com/minetest/minetest/bl ... pp#L57-L62
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Tue Sep 29, 2015 21:05

That does work, thanks. I set the default after someone pointed out that minetest crashed when there was no default or setting in minetest.conf. It didn't occur to me to make it blank.
Believe in people and you don't need to believe anything else.
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Tue Oct 27, 2015 22:36

The pull request on github has gone 19 days without comment. Autorun is not a universally desired feature, so if anyone else wants to see this, now would be a good time to comment on github.
Believe in people and you don't need to believe anything else.
 

User avatar
Linuxdirk
Member
 
Posts: 2200
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Autorun

by Linuxdirk » Wed Oct 28, 2015 06:36

duane wrote:The pull request on github has gone 19 days without comment

Sometimes it feels like that pull requests get ignored until there is a multi-page discussion about it in the forums.
 

User avatar
rubenwardy
Moderator
 
Posts: 5862
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Autorun

by rubenwardy » Wed Oct 28, 2015 09:25

19 days is typical for a new feature, you need to pester core devs in #minetest-dev to approve it.
 

User avatar
sfan5
Moderator
 
Posts: 3816
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Autorun

by sfan5 » Thu Oct 29, 2015 20:51

(づ。◕‿‿◕。)づ commit b6dfae0
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Thu Oct 29, 2015 23:12

sfan5 wrote:(づ。◕‿‿◕。)づ commit b6dfae0


Woot!
Believe in people and you don't need to believe anything else.
 

User avatar
lightonflux
Member
 
Posts: 384
Joined: Mon Nov 11, 2013 07:22
Location: Germany
In-game: lof

Re: Autorun

by lightonflux » Fri Oct 30, 2015 08:52

When autorun is toggle and i press the forward key the char runs with fast walking speed is this intended behaviour?

Edit: And there is no walking animation. So i prepare for interesting discussions on servers. :)
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Sun Nov 01, 2015 10:25

lightonflux wrote:When autorun is toggle and i press the forward key the char runs with fast walking speed is this intended behaviour?

Edit: And there is no walking animation. So i prepare for interesting discussions on servers. :)


The "autorun" is actually the continuous_forward function, so it lacks a lot of amenities. It was easy to implement since it only required toggling an existing setting. I considered making the forward key toggle it off, but that would affect its original uses as well.
Believe in people and you don't need to believe anything else.
 

User avatar
Linuxdirk
Member
 
Posts: 2200
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Autorun

by Linuxdirk » Sun Nov 01, 2015 15:58

duane wrote:but that would affect its original uses as well.

Don't break the game for the majority of players to implement a feature only a few would actually use.
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Autorun

by duane » Mon Nov 02, 2015 01:20

Linuxdirk wrote:Don't break the game for the majority of players to implement a feature only a few would actually use.


Absolutely. Although, I doubt that there were as many people using continuous_forward as there are using autorun (i.e. a few developers, at most).
Believe in people and you don't need to believe anything else.
 

Sokomine
Member
 
Posts: 3890
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Autorun

by Sokomine » Fri Nov 06, 2015 20:34

A long awaited feature has finally made it into the game! Thank you! That will help my fingers and my keyboard a lot. Pressing a key for such a long time was very tiring. That's diffrent from steering now and then!

Only issue, though: I wouldn't have noticed that the feature got finally added to the game without reading the thread (or taking a look at the commits). Adding it to the keymap setting and documentation would be good.

For those intrested: I mapped it to Q in my minetest.conf (close to w; and dropping is on L for loose item anyway).

Again: Thanks! And thanks to the devs for merging!
A list of my mods can be found here.
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 2 guests