script "mapmodelzoff" to allow negative z-offsets for mapmodels

A mapmodel entity is placed at a z-coordinate that is based on the floor
height of map geometry and a z-offset. The z-offset is a sum of the
entity attribute 3 and the third mapmodel slot parameter. The entity
z-offset can range from 0 to 255 while the mapmodel slot parameter can
be any integer including negative numbers. So, to place a mapmodel below
floor height, the mapmodel slot parameter has to be negative.

This script decreases the mapmodel slot parameter by one and increases
the z-offset of every mapmodel which uses that slot also by one. This
means, that all mapmodel are exact in the same place afterwards - but
the entity z-offset now has room to lower the mapmodel by one more cube.

The script requires one parameter: the mapmodel slot number.

If you need more z-offset available, run the script several times.

DOCREF mapmodelzoff
This commit is contained in:
ac-stef
2015-05-18 14:46:03 +02:00
parent fe478d13ca
commit 3733b7e9ba
+12
View File
@@ -36,6 +36,18 @@ const convertclips [
]
]
// increase legroom for mapmodels by decreasing the z-offset of a map config mapmodel slot
// and simultaneously increasing the z-offset of all affected map model entities
// (this is to counteract the fact, that the z-offset of an entity can only hold positive numbers - using the ability of the slot config to use negative numbers))
// this will not change anything visible in the map - but allow a mapmodel to be lowered further than before
// the only argument is the slot number - for more leg room, repeat the script
const mapmodelzoff [
if (strlen (editmapmodelslot $arg1)) [ // invalid slot returns empty string
looplist (editmapmodelslot $arg1) [rad h zoff snap path] [editmapmodelslot $arg1 "" "" (- $zoff 1) ; echo $path in slot # $arg1 : new z-offset (- $zoff 1)]
looplist (mapmodelslotusage $arg1) ii [editentity $ii "" "" "" "" "" (+ 1 (at (editentity $ii) 6)) ; echo adjusted entity # $ii]
]
]
// "gibsgore" command:
// This command controls gib Speed/Number/TTL all in one variable.
const gibsgore [