From 88320bd095053171ef5f85deb2e5fbd9e1970dff Mon Sep 17 00:00:00 2001 From: ac-stef Date: Thu, 3 Nov 2016 18:02:45 +0100 Subject: [PATCH] add script and keybind to cycle through spawn points in edit mode If the assigned key is pressed, the mousewheel can be used to cycle through player spawn points, sorted by groups CLA, RVSF and FFA. No default key is assigned. gotonextplayerstart can be used, to manually jump to the next spawn. --- config/menus_edit.cfg | 5 ++++- config/resetbinds.cfg | 1 + config/scripts.cfg | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/config/menus_edit.cfg b/config/menus_edit.cfg index 09494a40..e6514d39 100644 --- a/config/menus_edit.cfg +++ b/config/menus_edit.cfg @@ -63,6 +63,7 @@ newmenu Entities menuitem "RVSF Spawn point" [ newent playerstart 1 ] menuitem "CLA Spawn point" [ newent playerstart 0 ] menuitem "FFA Spawn point" [ newent playerstart 100 ] +menuitemcheckbox "Show all spawn points: " "$showplayerstarts" [ showplayerstarts $arg1 ] menuitem "" -1 menuitem "RVSF CTF Flag" [ newent ctf-flag 1 ] menuitem "CLA CTF Flag" [ newent ctf-flag 0 ] @@ -317,6 +318,7 @@ menuinit [ menuitem "Entity statistics" [ showmenu [Entity statistics] ] menuitem "Check mapmodels with unconfigured custom textures" [ showmenu [Walk mapmodel entities with unconfigured custom textures] ] menuitem "Show most visible textures" [ showmenu [Most visible textures] ] + menuitem "Cycle through spawn points" [ gotonextplayerstart ] ] [ menuitem "menu only available in edit mode" -1 ] @@ -693,7 +695,7 @@ newmenu [Editing settings] menuitemslider "Grid/Selection style: " 0 1 "$oldselstyle" 1 [triangles "squares (default)"] [ oldselstyle $arg1 ] menuitemcheckbox "Show mapmodel clippings: " "$showmodelclipping" [ showmodelclipping $arg1 ] menuitemcheckbox "Show ladder entities: " "$showladderentities" [ showladderentities $arg1 ] -menuitemcheckbox "Show all playerstarts: " "$showplayerstarts" [ showplayerstarts $arg1 ] +menuitemcheckbox "Show all playerstarts (spawn points): " "$showplayerstarts" [ showplayerstarts $arg1 ] menuitemslider "Fly speeds multiplier: " 1 5 "$flyspeed" 1 [] [ flyspeed $arg1 ] // opt/autosave.cfg may add some entries @@ -757,6 +759,7 @@ menuitemeditkeyinput [Delete entity: ] editkey_delete_entity menuitemeditkeyinput [Copy entity: ] copyent menuitemeditkeyinput [Paste entity: ] pasteent menuitemeditkeyinput [Edit entity: ] editent +menuitemeditkeyinput [Cycle through spawns: ] editkey_scroll_spawns menuitem "" -1 menuitem "\f2Tag clips:" -1 menuitemeditkeyinput [Show tag clip volume: ] showtagclipfocus diff --git a/config/resetbinds.cfg b/config/resetbinds.cfg index 3c124848..a1cd47fc 100644 --- a/config/resetbinds.cfg +++ b/config/resetbinds.cfg @@ -64,6 +64,7 @@ alias editkey_uppertex_dn [ edittex 3 -1 ] alias editkey_tagclip_none [ edittagclip none ] alias editkey_tagclip_plclip [ edittagclip plclip ] alias editkey_tagclip_clip [ edittagclip clip ] +alias editkey_scroll_spawns [ domodifier spawns ] _defaultbinds 1 // do not save the following binds to saved.cfg _resetallbinds diff --git a/config/scripts.cfg b/config/scripts.cfg index 86870c47..de53b903 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -241,6 +241,8 @@ delta_edit_attr4 = [ entproperty 3 $arg2 $editmeta2down ] // Changes the fourth delta_edit_attr5 = [ entproperty 4 $arg2 $editmeta2down ] // Changes the fifth value on entities... delta_edit_attr6 = [ entproperty 5 $arg2 $editmeta2down ] // Changes the sixth value on entities... delta_edit_attr7 = [ entproperty 6 $arg2 $editmeta2down ] // Changes the seventh value on entities... +delta_edit_spawns = [ gotonextplayerstart $arg1 ] +delta_game_spawns = [] // Scroll console (in all modes) delta_game_conscroll = [ __scrolled = $conopen ; conskip (* 4 $arg1) ] @@ -344,6 +346,27 @@ const gencl [ ] [ echo (red)Error: (white)You must be in edit mode for (blue)gencl (white)to function. ] ] +// cycle through all playerstarts +const gotonextplayerstart [ + if (&& (!= $arg1 1) (!= $arg1 -1)) [ arg1 = 1 ] + if (! (checkalias __gotonextplayerstart)) [ tempalias __gotonextplayerstart -1 ] + push sl "" + looplist [0 1 100] t [ + looplist (enumentities playerstart) i [ + if (= $t (at (editentity $i) 5)) [ + sl = (concat $sl $i) + ] + ] + ] + push n (listlen $sl) + if (&& $n $editing) [ + __gotonextplayerstart = (mod (+ $n $n $arg1 $__gotonextplayerstart) $n) + gotoentity (at $sl $__gotonextplayerstart) + edittoggle ; sleep 50 edittoggle + ] + pop n sl +] + // select whole map const selectall [ select 2 2 (- (powf 2 (mapsize)) 4) (- (powf 2 (mapsize)) 4)