pasting *all* attributes is now possible
This commit is contained in:
@@ -1571,6 +1571,11 @@ docargument [B] [boolean] [1:yes=>ignore min 0/max 1/default 0];
|
||||
docremark [If during mapload textureslots can't be filled and this is not set to 1 a "missing media" error is raised.];
|
||||
docremark [It is used in the optional cubescript config/opt/convmap.cfg];
|
||||
docref [loadnotexture];
|
||||
docident [_nextentityispasted] [Set to 1 just before calling a newent command where all attributes are meant to be kept.];
|
||||
docargument [B] [boolean] [1:yes=>keep attribute values min 0/max 1/default 0];
|
||||
docremark [It is used in the pasteent scripting.];
|
||||
docremark [When creating a new entity of type mapmodel, playerstart or CTF flag the orientation is taken from your current viewing angle. To disable this behaviour for one call only you set the value to of this to 1 and then issue your newentity call with all attributes given.];
|
||||
docref [loadnotexture];
|
||||
docident [addentity] [Adds an entity of the specified type at the current camera position.];
|
||||
docargument [E] [the entity type or number] [light (1), playerstart (2), pistol (3), ammobox (4), grenades (5), health (6), helmet (7), armour (8), akimbo (9), mapmodel (10), ladder (12), ctf-flag (13), sound (14), clip (15), plclip (16)] [0];
|
||||
docremark [It also returns the index number of the new entity, so that the other attributes can be set by editentity.];
|
||||
|
||||
+2
-2
@@ -315,9 +315,9 @@ const copyent [
|
||||
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]] [newent @@@n ; echo @@@n @@@d pasted.]]]
|
||||
pasteent = [if $editing [if $editmetakeydown [showmenu [Paste entity]] [_nextentityispasted 1 ; newent @@@n ; echo @@@n @@@d pasted.]]]
|
||||
newmenu [Paste entity]
|
||||
menuitem [paste: @n @d] [newent @n ; echo @n @d pasted.]
|
||||
menuitem [paste: @n @d] [_nextentityispasted 1 ; newent @n ; echo @n @d pasted.]
|
||||
echo $n $d copied.
|
||||
pop n d
|
||||
]
|
||||
|
||||
@@ -7650,6 +7650,18 @@ name="AssaultCube Documentation" version="Current" xsi:schemaLocation="xml/cuber
|
||||
<value token="B" description="boolean" minValue="0" maxValue="1" valueNotes="1:debug output" defaultValue="0"/>
|
||||
</variable>
|
||||
|
||||
<variable name="_nextentityispasted">
|
||||
<description>Set to 1 just before calling a newent command where all attributes are meant to be kept.</description>
|
||||
<value token="B" description="boolean" minValue="0" maxValue="1" valueNotes="1:yes=>keep attribute values" defaultValue="0"/>
|
||||
<remarks>
|
||||
<remark>It is used in the pasteent scripting.</remark>
|
||||
<remark>When creating a new entity of type mapmodel, playerstart or CTF flag the orientation is taken from your current viewing angle. To disable this behaviour for one call only you set the value to of this to 1 and then issue your newentity call with all attributes given.</remark>
|
||||
</remarks>
|
||||
<references>
|
||||
<identifierReference identifier="loadnotexture"/>
|
||||
</references>
|
||||
</variable>
|
||||
|
||||
</identifiers>
|
||||
</section>
|
||||
|
||||
|
||||
+22
-14
@@ -366,25 +366,33 @@ int findtype(const char *what)
|
||||
return t;
|
||||
}
|
||||
|
||||
VAR(_nextentityispasted,0,0,1);// so copyent/pasteent can keep all attributes
|
||||
void newentity(int index, int x, int y, int z, const char *what, float v1f, float v2f, float v3f, float v4f, float v5f, float v6f, float v7f) // add an entity or overwrite an existing one
|
||||
{
|
||||
int type = findtype(what);
|
||||
if(type == NOTUSED) return;
|
||||
if (index >= 0 && ents[index].type == SOUND) deletesoundentity(ents[index]); // overwriting sound entity
|
||||
switch(type)
|
||||
{ // MAPMODEL, PLAYERSTART and CTF-FLAG use the current camera direction as value for attr1, so attr23456 need to be moved
|
||||
case MAPMODEL:
|
||||
v6f = v5f;
|
||||
v5f = v4f;
|
||||
v4f = v3f;
|
||||
v3f = v2f;
|
||||
case PLAYERSTART:
|
||||
case CTF_FLAG:
|
||||
v2f = v1f;
|
||||
int y = camera1->yaw;
|
||||
if(type != PLAYERSTART) y = y + 7 - (y + 7) % 15;
|
||||
v1f = y;
|
||||
break;
|
||||
if(_nextentityispasted)
|
||||
{
|
||||
_nextentityispasted = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(type)
|
||||
{ // MAPMODEL, PLAYERSTART and CTF-FLAG use the current camera direction as value for attr1, so attr23456 need to be moved
|
||||
case MAPMODEL:
|
||||
v6f = v5f;
|
||||
v5f = v4f;
|
||||
v4f = v3f;
|
||||
v3f = v2f;
|
||||
case PLAYERSTART:
|
||||
case CTF_FLAG:
|
||||
v2f = v1f;
|
||||
int y = camera1->yaw;
|
||||
if(type != PLAYERSTART) y = y + 7 - (y + 7) % 15;
|
||||
v1f = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int v1 = v1f * entscale[type][0], v2 = v2f * entscale[type][1], v3 = v3f * entscale[type][2], v4 = v4f * entscale[type][3], v5 = v5f * entscale[type][4], v6 = v6f * entscale[type][5], v7 = v7f * entscale[type][6];
|
||||
|
||||
Reference in New Issue
Block a user