updated automatic mapmodel menus

This commit is contained in:
ac-stef
2015-05-17 00:24:39 +02:00
parent a8028b87ba
commit 04e3d946bc
2 changed files with 57 additions and 255 deletions
+55 -255
View File
@@ -235,271 +235,71 @@ menuitemtextinput (_ [Make a map backup (.BAK) every: ]) "$numAutoSaveBackups" [
newmenu Mapmodels
menuinit __rebuildmapmodelmenus
tempalias __mapmodelmenulist [
Platforms "" ""
"Bridge (8x8)" _1 makke/platform_bridge
"Platform (8x8)" _1 makke/platform
"Wire platform (8x8)" _1 toca/platformmet
"Ledge (4x1)" _1 toca/ledge/1_4cbs
"Ledge (8x1)" _1 toca/ledge/2_8cbs
"Ledge (16x1)" _1 toca/ledge/3_16cbs
"Ledge Corner" _1 toca/ledge/4_corner
Ladders/Stairs "" ""
"Single ladder rung (1)" _1 makke/ladder_1x
"Ladder(7)" _0 makke/ladder_7x
"Ladder(8)" _0 makke/ladder_8x
"Ladder(10)" _0 makke/ladder_10x
"Ladder(11)" _0 makke/ladder_11x
"Ladder(15)" _0 makke/ladder_15x
"" _0 --
"Hangable Ladder (2)" _1 misterfloppy/hanging_ladder/ladder_2
"Hangable Ladder (6)" _1 misterfloppy/hanging_ladder/ladder_6
"Hangable Ladder (Top, Over)" _1 misterfloppy/hanging_ladder/ladder_top
"Hangable Ladder (Top, Side)" _1 misterfloppy/hanging_ladder/ladder_up
"Hangable Ladder (Bottom)" _1 misterfloppy/hanging_ladder/ladder_low
"" _0 --
"Wire stairs (Top)" _1 toca/stairs1
"Wire stairs (Bottom)" _1 toca/stairs2
Fencing "" ""
"Wire fence" _0 makke/fence_chainlink
"Wire fencepost" _0 makke/fence_chainlink_post
"Open wire fence-gate" _0 makke/fence_chainlink_no_gate
"Closed wire fence-gate" _0 makke/fence_chainlink_closed_gate
"Barbwire fence-top" _0 toca/barbwire
"" _0 --
"Corrugated fence" _0 toca/corrugated/fence1
"Corrugated fence 2" _0 toca/corrugated/fence2
"Corrugated fence post" _0 toca/corrugated/beam
"" _0 --
"Guard rail" _0 toca/guardrail
"Guard rail 2" _0 toca/guardrail2
"Guard rail pole" _0 toca/guardrail2/gr2pole
Plants "" ""
"Grass 1" _0 makke/grass_short
"Grass 1 (Dry)" _0 makke/grass_short_dry
"Grass 1 (Snow)" _0 makke/grass_short_snow
"Grass 2" _0 makke/grass_long
"Grass 2 (Dry)" _0 makke/grass_long_dry
"Grass 2 (Snow)" _0 makke/grass_long_snow
"Plant 1" _0 makke/plant_leafy
"Plant 1 (Dry)" _0 makke/plant_leafy_dry
"Plant 1 (Snow)" _0 makke/plant_leafy_snow
"Tree trunk" _0 toca/treetrunk1
"Tree 1" _2 toca/tree1
"Tree 2" _2 toca/tree2
"Pine tree" _2 toca/pine
"Palm tree" _2 toca/palmtree1
"Bush" _0 toca/plants/bush
"Small tree" _0 toca/plants/smaltree
"Grasses" _0 toca/plants/grass
Lights "" ""
"Strahler" _1 makke/wall_spotlight
"Fluorescent lamp" _1 makke/fluorescent_lamp
"LightBulb" _1 makke/lightbulb
"Hanging lamp" _1 jcdpc/hanginglamp
"Alarm lamp" _1 misterfloppy/alarmlamp
"Plate lamp" _1 misterfloppy/platelamp
"Street light" _0 makke/street_light
"Street light (2)" _0 misterfloppy/streetlamp
Street "" ""
"Park Bench" _0 makke/bench_seat
"Dumpster" _0 makke/dumpster
"Trashbag" _0 toca/trashbag
"Trashcan" _0 toca/trashcan
"Roadblock/Barrier" _0 makke/roadblock
"Roadblock/Barrier 2" _0 makke/roadblock_graffiti
"Barrier 3" _0 toca/cautionsign
"Cone" _0 cleaner/traffic_cones/up
"Fallen cone" _0 cleaner/traffic_cones/down
"Wheel: Vertical" _0 toca/wheel
"Tyre: Horizontal" _0 toca/tyre
"Gray milk crate" _0 toca/milkcrate
"Red milk crate" _0 ratboy/toca_milkcrate_red
"Blue milk crate" _0 ratboy/toca_milkcrate_blue
"Car battery" _0 toca/carbattery
"Antenna" _0 toca/antenna
"Hotel sign" _1 cleaner/hotel_sign
"Fire alarm" _1 cleaner/alarm_bell
"Electric box (1)" _0 cleaner/elecbox/elecbox1
"Electric box (2)" _0 cleaner/elecbox/elecbox2
Pipes "" ""
"Large concrete pipe" _0 toca/pipes/concretepipe
"Medium metal pipe" _0 toca/pipes/metalpipe
"Small metal pipe" _0 toca/pipes/metalpipe2
"Drainpipe" _0 makke/drainpipe
"Closed pipe, horz" _1 toca/pipes/industrialpipes/horz
"Closed pipe, l-down" _1 toca/pipes/industrialpipes/ldwn
"Closed pipe, l-left" _1 toca/pipes/industrialpipes/lleft
"Closed pipe, l-right" _1 toca/pipes/industrialpipes/lright
"Closed pipe, l-up" _1 toca/pipes/industrialpipes/lup
"Closed pipe, vert" _1 toca/pipes/industrialpipes/vert
Office "" ""
"Office chair" _0 makke/office_chair
"Locker" _0 makke/locker
"Air Conditioner (Outer)" _0 toca/airconditioner
"Air Conditioner (Inner)" _0 toca/airconditioner/interior
"Office desk" _0 toca/officedesk
"Ceiling fan" _1 toca/ceilingfan
"Wall switch" _1 toca/electric/switch
"Wall power outlet" _1 toca/electric/outlet
"Pinboard" _1 toca/pinboard
"Fire extinguisher" _0 cleaner/extinguisher
"Fire extinguisher box" _0 cleaner/extinguisher_box
"Dropped ceiling, frame" _1 toca/droppedceiling/frame
"Dropped ceiling, tiles" _1 toca/droppedceiling/tiles
"Dropped ceiling, single" _1 toca/droppedceiling/single
"Dropped ceiling, light 1" _1 toca/droppedceiling/light1
"Dropped ceiling, light 2" _1 toca/droppedceiling/light2
"World map" _1 cleaner/worldmap
Computers "" ""
"Laptop" _0 jcdpc/laptop
"PC" _0 toca/computer/pc
"Computer interfaces" _0 toca/computer/monkeymou
"Communications rack" _0 toca/commrack
"Communications rack 2" _0 toca/commrack2
"Server rack" _0 toca/servercluster/rack
"Server cluster 1" _1 toca/servercluster/U3_1
"Server cluster 2" _1 toca/servercluster/U3_2
"Server cluster 3" _1 toca/servercluster/U3_3
"Server cluster 4" _1 toca/servercluster/U6_1
"Server cluster 5" _1 toca/servercluster/U6_2
"Server cluster 6" _1 toca/servercluster/U6_3
Home "" ""
"Picture frame" _1 makke/picture
"Milk" _0 toca/milkcarton
"CRT TV" _0 toca/tv
"CRT TV in stand" _1 toca/monitor
"Plasma TV" _0 toca/plasmatv
"Power meter" _0 toca/powermeter
"Rack" _0 toca/rack
"Utility table" _0 toca/utilitytable
"Ceiling fan" _1 toca/ceilingfan
"Window" _0 toca/window1
"Shelf" _0 toca/shelf
"Wall switch" _1 toca/electric/switch
"Wall power outlet" _1 toca/electric/outlet
Industrial "" ""
"Barrel" _0 makke/barrel
"Knocked-over barrel" _0 makke/barrel_fallen
"Electric meter" _0 makke/electric_meter
"Pallette" _0 makke/pallet
"Gastank" _0 makke/fuel_tank
"Grate (horizontal)" _0 cleaner/grates/grate_hor
"Grate (vertical)" _0 cleaner/grates/grate_vert
"Wrench" _0 makke/wrench
"Bolt" _0 makke/bolt_nut
"Hook" _0 makke/hook
"Cinderblock" _0 toca/cinderblock
"Radioactive drum" _0 toca/radioactivedrum
"Knocked-over radioactive drum" _0 toca/radioactivedrum2
"Swiveling security camera" _1 toca/securitycam/secucam
"Camera mount (Vertical)" _1 toca/securitycam/vertmount
"Camera mount (Wall)" _1 toca/securitycam/wallmount
"Vent flap" _0 jcdpc/ventflap
"Pickaxe, horz" _0 toca/pickaxe/horz
"Pickaxe, vert" _0 toca/pickaxe/vert
"Shovel, vert" _0 cleaner/shovels/shovel1
"Shovel, free-standing" _0 cleaner/shovels/shovel2
"Shovel, horz" _0 cleaner/shovels/shovel3
Military "" ""
"Bullet" _0 toca/bullet
"Shotgun shell" _0 toca/sgshell
"Target" _0 toca/signs/target
"Radar console" _0 toca/radarconsole
"Razor wire" _0 toca/razorwire
"Guard tower" _0 toca/guardtower
"Weapon rack" _0 cleaner/laundry
Signs "" ""
"Flammable" _1 makke/signs/flammable
"Speed Limit 5" _1 makke/signs/speed
"Maintenance" _1 makke/signs/caution_maintainence
"Caution" _1 makke/signs/caution_voltage
"Biohazard" _1 makke/signs/biohazard
"Toxic" _1 toca/signs/toxic
"Biohazard (2)" _1 toca/signs/biohazard
"Chemicals" _1 toca/signs/chemical
"Confined space" _1 toca/signs/confined
"Do not enter!" _1 toca/signs/donotenter
"Explosives" _1 toca/signs/explosives
"First aid" _1 toca/signs/firstaid
"No entry" _1 toca/signs/noentry
"No smoking" _1 toca/signs/nosmoking
"Radioactive" _1 toca/signs/radioactive
"Restricted area" _1 toca/signs/restricted
"Arab" _1 makke/signs/arab
"Wanted Poster" _1 makke/signs/wanted
Other "" ""
"Cigarette" _0 makke/cigarette
"Can" _0 makke/coke_can
"Fallen Can" _0 makke/coke_can_fallen
"Broken Wood" _0 makke/broken_wood
"Coffee" _0 makke/coffee_mug
"Flyer" _0 makke/flyer_propaganda
"Tree Flyer" _0 makke/flyer_environmental
"Potato box" _0 makke/aardapple_enginebox
"Cardboard box" _0 toca/cardboardbox
"Chinese take-out" _0 toca/takeoutbox
"Plastic bottle" _0 toca/plasticbottles/1
"Squashed plastic bottle" _0 toca/plasticbottles/2
"Plastic bag, white" _0 toca/plasticbags/1
"Plastic bag, yellow" _0 toca/plasticbags/2
"Newspaper (1)" _0 toca/newspaper/1
"Newspaper (2)" _0 toca/newspaper/2
"Paintcan" _0 toca/paintcan
tempalias __mapmodelcategories [
platforms "Platforms"
ladders "Ladders+Stairs"
stairs "Ladders+Stairs"
fencing "Fencing"
plants "Plants"
lamps "Lights+Lamps"
street "Street"
pipes "Pipes"
office "Office"
computers "Computers"
home "Home"
industrial "Industrial"
military "Military"
signs "Signs"
litter "Other/Litter"
misc "Other/Misc"
unsoo "Unsorted/Official"
unsoa "Unsorted/Akimbo"
unsom "Unsorted/Map-Config"
unsorted "Unsorted/Custom"
]
tempalias __treewarning [echo "\f3Trees are expensive mapmodels. Please don't use more than one or two in a map."]
looplist $__mapmodelcategories [key menu] [tempalias (concatword __mm_key_ $key) $menu]
tempalias __mm_unassigned [echo (yellow) sry: mapmodel (addpunct $arg1) has no slot assigned. Please edit your map config file.]
tempalias __mm_showmodel [concat chmenumdl $arg1 $arg2 all 40 3]
tempalias __rebuildmapmodelmenus [
if $mapmodelchanged [
push __mm_menus []
looplist $__mapmodelmenulist [title cmd path] [if (&& (! (strlen $path)) (< (findlist $__mm_menus $title) 0)) [__mm_menus = (concat $__mm_menus $title)]]
push __mm_menus "" // menus with content
push __mm_done "" // done map config slots
push idxs ""
looplist $__mapmodelcategories [key menu] [delmenu $menu]
looplist (getmapmodelattributes explodekeywords sortby: keywords sortby: desc usage distribution) [path keyword desc usage dist] [
path = (concatword "mapmodels/" $path)
idxs = (mapmodelbyname $path)
if (|| (! (strlen $keyword)) (< (findlist $__mapmodelcategories $keyword) 0)) [
keyword = unsorted
if (strcmp $dist "official") [ keyword = unsoo ] // unless someone writes the missing config files ;)
if (strcmp $dist "autodownload") [ keyword = unsoa ] // a.k.a "akimbo"
if (listlen $idxs) [ keyword = unsom ] // has slot in current map config
]
keyword = (concatword __mm_key_ $keyword)
newmenu $$keyword
concatuniq __mm_menus $$keyword
if (strlen $desc) [] [desc = $path]
if (listlen $idxs) [
__mm_done = (concat $__mm_done $idxs)
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $desc (concatword "#" $i)) (concat newent mapmodel $i) (__mm_showmodel $$keyword $path) $usage] // several slots for the same mapmodel
][
menuitem $desc (concat newent mapmodel $idxs) (__mm_showmodel $$keyword $path) $usage // usual case: one slot per model
]
][
menuitem (concatword "\f4" $desc) (concat __mm_unassigned $path) (__mm_showmodel $$keyword $path) $usage // mapmodel has no slot assigned
]
]
delmenu Mapmodels
newmenu Mapmodels
looplist $__mm_menus m [menuitem $m (concat showmenu $m) ; delmenu $m]
push _0 [concat newent mapmodel $arg1]
push _1 [concat saycommand (addpunct (concat /newent mapmodel $arg1))]
push _2 [concat __treewarning [;] newent mapmodel $arg1]
push __mm_done ""
push menu ""
push idxs ""
looplist $__mapmodelmenulist [title cmd path] [
if (! (strlen $path)) [
menu = $title
newmenu $menu
][
if (strlen $title) [
path = (concatword "mapmodels/" $path)
idxs = (mapmodelbyname $path)
if (listlen $idxs) [
__mm_done = (concat $__mm_done $idxs)
if (> (listlen $idxs) 1) [
looplist $idxs i [menuitem (concat $title (concatword "#" $i)) (cmd $i) (__mm_showmodel $menu $path)] // several slots for the same mapmodel
][
menuitem $title (cmd $idxs) (__mm_showmodel $menu $path) // usual case: one slot per model
]
][
menuitem (concatword "\f4" $title) (concat __mm_unassigned $path) (__mm_showmodel $menu $path) // mapmodel has no slot assigned
]
][
menuitem [] -1 (concat chmenumdl $menu) // blank line
]
]
]
push __mm_unsorted 0
delmenu Unsorted
newmenu Unsorted
loop i 256 [
if (&& (< (findlist $__mm_done $i) 0) (strlen (mapmodelname $i))) [
menuitem (format "%1 #%2" (mapmodelname $i) $i) (_1 $i) (__mm_showmodel Unsorted (mapmodelname $i))
__mm_unsorted = 1
]
]
if $__mm_unsorted [newmenu Mapmodels ; menuitem Unsorted "showmenu Unsorted"]
pop menu __mm_menus _0 _1 _2 __mm_done __mm_unsorted idxs
push __mm_sorted ""
looplist $__mapmodelcategories [key menu] [if (>= (findlist $__mm_menus $menu) 0) [concatuniq __mm_sorted $menu]] // create list of non-empty menus in order of list above
looplist $__mm_sorted m [menuitem $m (concat showmenu $m)] // only create non-empty menus
mapmodelchanged 0
pop menu __mm_menus __mm_sorted __mm_done __mm_unsorted idxs
]
]
+2
View File
@@ -158,6 +158,8 @@ const aliasinit [ loop ail (listlen $arg1) [ checkinit (at $arg1 $ail) $ar
const add2list [ if (strcmp [] (getalias $arg1)) [ $arg1 = $arg2 ] [ $arg1 = (concat (getalias $arg1) $arg2) ] ] // works exactly like concat, use as a shortcut to: alias = (concat $alias "some string")
const add2bind [ if (! (strstr (keybind $arg1) $arg2)) [ bind $arg1 (format [%1; %2] (keybind $arg1) $arg2) ] ] // works exactly like add2alias except for used with keybinds
const concatuniq [ if (< (findlist $$arg1 $arg2) 0) [$arg1 = (concat $$arg1 $arg2) ; result 1] [result 0] ] // add item to list, if it's not already been in the list
// Weapon switching/action utilities.
const hasprimary [ result (= (curweapon) (currentprimary)) ]
const primary [ weapon (currentprimary) ]