diff --git a/config/scripts.cfg b/config/scripts.cfg index 9a8f874a..795b939a 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -5,20 +5,18 @@ const MODEALIASES [map lms vip sendmap] // "editent" command: // This command collects all the attributes of the nearest entity, and then -// prompts that into a handy command that allows you to edit that entities -// attributes easily. -// Note: The editent command can NOT define rotation/yaw inside the command! -// However, the current yaw of the player will define the rotation/yaw when -// using the command! +// prompts that into a handy command that allows you to edit that entities attributes easily. +tempalias __editentprefix "" const editent [ if $editing [ - if (strcmp (getenttype) mapmodel) [ saycommand "/entset" (getenttype) (getentattr 1) (getentattr 2) (getentattr 3) (getentattr 4) (getentattr 5) (getentattr 6) (getentattr 7) ] [ - if (> (findlist [light sound clip plclip] (getenttype)) -1) [ - saycommand "/entset" (getenttype) (getentattr 0) (getentattr 1) (getentattr 2) (getentattr 3) (getentattr 4) (getentattr 5) (getentattr 6) (getentattr 7) - ] [ - saycommand "/entset" (getenttype) (getentattr ((> (findlist [playerstart ctf-flag] (getenttype)) -1))) - ] + push n (getclosestent) + if (> $n -1) [ + push cced (editentity $n) + __editentprefix = (concat $n (at $cced 1) (at $cced 2) (at $cced 3)) + saycommand "/editentattr" (at $cced 4) (at $cced 5) (at $cced 6) (at $cced 7) (at $cced 8) (at $cced 9) (at $cced 10) + pop cced ] + pop n ] ] @@ -260,8 +258,6 @@ const toggleshowmap [ showmap 1; onrelease [ showmap 0 ] ] // arg5 1: private mode, 2: match mode // arg6 1: banned, 2: blacklisted 3: both // arg7 "server description" -// TODO: interpret a#3,4,5,6 [ft:any1:2010apr04] - const sbconnect [ tempalias sbdns $arg1; tempalias sbport $arg2; tempalias sbdesc $arg7; tempalias sbpwd []; tempalias sbmsg [] if (>= $arg5 1) [ @@ -296,8 +292,8 @@ const listaverage [ push sum "" ; looplist $arg1 n [ +=f sum $n ] ; if (strlen $ tempalias pasteent [if $editing [echo no entity copied, yet]] const copyent [ if $editing [ - entidx = (getclosestent) - if (> entidx -1) [ + push entidx = (getclosestent) + if (> $entidx -1) [ push n (format2 "%1 %5 %6 %7 %8 %9 %010 %011" (editentity $entidx)) push d (switch (findlist "mapmodel sound" (at $n 0)) [mapmodelslotname (at $n 2)] [at (editmapsoundslot (at $n 1)) 0]) pasteent = [if $editing [if $editmetakeydown [showmenu [Paste entity]] [newent7 @@@n ; echo @@@n @@@d pasted.]]] @@ -306,6 +302,7 @@ const copyent [ echo $n $d copied. pop n d ] + pop entidx ] ] @@ -321,6 +318,20 @@ const newent7 [ // like newent, but setting all seven attributes directly ] ] +// used by editent // editentity requires ent index, coordinates (via tempalias) and all seven attributes (via arguments) +const editentattr [ + if (strlen $__editentprefix) [ + if $numargs [ + loop i 4 [ push [p@i] (if (< $i (listlen $__editentprefix)) [result (at $__editentprefix $i)])] + loop i 7 [ push [a@i] (if (< $i $numargs) [result $arg@(+ $i 1)])] + editentity $p0 $p1 $p2 $p3 $a0 $a1 $a2 $a3 $a4 $a5 $a6 + __editentprefix = "" + loop i 7 [ pop [a@i] ] + loop i 4 [ pop [p@i] ] + ] + ] +] + // countwalls - Counts cubes of a specific type in all selections const countwalls [ push __cnt 0 diff --git a/source/src/world.cpp b/source/src/world.cpp index 67e10ae5..3eadf60f 100644 --- a/source/src/world.cpp +++ b/source/src/world.cpp @@ -535,8 +535,7 @@ void editentity(char **args, int numargs) // index x y z a1 a2 a3 a4 ... } unsavededits++; } - // give back unchanged or new entity properties - formatstring(res)("%s %d %d %d %s", entnames[t], e.x, e.y, e.z, formatentityattributes(e)); + formatstring(res)("%s %d %d %d %s", entnames[t], e.x, e.y, e.z, formatentityattributes(e)); // double space is for human readability; scripts don't care. } result(res); }