1window basedefence extends objectinfo 2{ 3 { 4 pos "100 150" 5 size "824 435" 6 dragbutton true 7 closebutton true 8 modal true 9 background "ui/popup_alpha_tile" 10 string "_Equip Defence Weapons" 11 } 12 13 tab defencetype { 14 { 15 pos "17 75" 16 size "791 38" 17 cvar *cvar:mn_bdef_type 18 onChange { 19 if ( *cvar:mn_bdef_type ne "info" ) { 20 *node:root.infopanel@invis = true 21 *node:root.equippanel@invis = false 22 } else { 23 *node:root.infopanel@invis = false 24 *node:root.equippanel@invis = true 25 } 26 cmd "basedef_updatemenu <cvar:mn_bdef_type>;" 27 } 28 } 29 option info { 30 label "_Information" 31 value "info" 32 icon "icons/tab_information" 33 } 34 option missile { 35 label "_Missile Defences" 36 value "missile" 37 icon "icons/tab_missiledefences" 38 } 39 option laser { 40 label "_Laser Defences" 41 value "laser" 42 invis true 43 icon "icons/tab_laserdefences" 44 } 45 } 46 47 /** 48 * @brief sets available defencetypes 49 */ 50 confunc set_defencetypes { 51 *cvar:mn_cvartmp = "<1>" 52 if ( *cvar:mn_cvartmp eq "enable" ) { 53 *node:root.defencetype.missile@disabled = false 54 *node:root.defencetype.missile@invis = false 55 } elif ( *cvar:mn_cvartmp eq "disable" ) { 56 *node:root.defencetype.missile@disabled = true 57 *node:root.defencetype.missile@invis = false 58 } elif ( *cvar:mn_cvartmp eq "na" ) { 59 *node:root.defencetype.missile@invis = true 60 } 61 *cvar:mn_cvartmp = "<2>" 62 if ( *cvar:mn_cvartmp eq "enable" ) { 63 *node:root.defencetype.laser@disabled = false 64 *node:root.defencetype.laser@invis = false 65 } elif ( *cvar:mn_cvartmp eq "disable" ) { 66 *node:root.defencetype.laser@disabled = true 67 *node:root.defencetype.laser@invis = false 68 } elif ( *cvar:mn_cvartmp eq "na" ) { 69 *node:root.defencetype.laser@invis = true 70 } 71 cmd "del mn_cvartmp;" 72 } 73 74 panel equippanel { 75 { 76 pos "15 115" 77 size "794 305" 78 invis true 79 } 80 81 /* @todo: We should check if the slot is empty but can't do from here */ 82 confunc update_buttons { 83 if ( *node:parent.slots.slotlist@lineselected < 0 ) { 84 *node:parent.bt_add@disabled = true 85 *node:parent.bt_remove@disabled = true 86 } elif ( *node:parent.slots.slotlist@lineselected >= *node:parent.slots.slotlist@lines ) { 87 *node:parent.bt_add@disabled = true 88 *node:parent.bt_remove@disabled = true 89 } elif ( *node:parent.store.storelist@lineselected < 0 ) { 90 *node:parent.bt_add@disabled = true 91 *node:parent.bt_remove@disabled = false 92 } elif ( *node:parent.store.storelist@lineselected >= *node:parent.store.storelist@lines ) { 93 *node:parent.bt_add@disabled = true 94 *node:parent.bt_remove@disabled = false 95 } else { 96 *node:parent.bt_add@disabled = false 97 *node:parent.bt_remove@disabled = false 98 } 99 } 100 101 panel slots { 102 { 103 pos "5 5" 104 size "435 115" 105 } 106 107 string slotlist_title 108 { 109 string "_Weapon slots" 110 pos "5 5" 111 size "400 25" 112 font "f_small_bold" 113 } 114 rows slotback { 115 pos "5 30" 116 size "400 80" 117 color1 "0 0.08 0 1" 118 color2 "0 0.16 0 1" 119 lineheight 20 120 } 121 122 /* textlist using tabbed text */ 123 text slotlist 124 { 125 dataid TEXT_BASEDEFENCE_LIST 126 pos "5 30" 127 size "400 80" 128 lineheight 20 129 color "0.60 0.60 0.60 1" 130 selectcolor "1 1 1 1" 131 rows "4" 132 mousefx true 133 longlines LONGLINES_PRETTYCHOP 134 onClick { 135 call *node:root.equippanel.update_buttons 136 cmd "basedef_selectitem <cvar:mn_bdef_type> <lineselected> -1;" 137 } 138 onViewChange { 139 *node:parent.slotlist_scroll@fullsize = <fullsize> 140 *node:parent.slotlist_scroll@current = <viewpos> 141 *node:parent.slotlist_scroll@viewsize = <viewsize> 142 } 143 } 144 vscrollbar slotlist_scroll 145 { 146 image "ui/scrollbar_v_green" 147 pos "410 30" 148 height "80" 149 current 0 150 viewsize 4 151 fullsize 4 152 hidewhenunused true 153 onChange { *node:parent.slotlist@viewpos = <current> } 154 } 155 } 156 157 button bt_add 158 { 159 icon "icons/varrow_swap" 160 string "_Add" 161 tooltip "_Equip the selected slot with this weapon" 162 background "ui/button_green_small" 163 pos "10 130" 164 size "200 32" 165 onClick { 166 cmd "basedef_additem <cvar:mn_bdef_type> <node:parent.slots.slotlist@lineselected>;" 167 } 168 } 169 button bt_remove 170 { 171 icon "icons/varrow_top_bottom" 172 string "_Remove" 173 tooltip "_Remove weapon from the selected slot" 174 background "ui/button_green_small" 175 pos "230 130" 176 size "200 32" 177 onClick { 178 cmd "basedef_removeitem <cvar:mn_bdef_type> <node:parent.slots.slotlist@lineselected>;" 179 } 180 } 181 182 panel store { 183 { 184 pos "5 175" 185 size "435 115" 186 } 187 188 string storelist_title 189 { 190 string "_Stores" 191 pos "5 5" 192 size "400 25" 193 font "f_small_bold" 194 } 195 rows storeback { 196 pos "5 30" 197 size "400 80" 198 color1 "0 0.08 0 1" 199 color2 "0 0.16 0 1" 200 lineheight 20 201 } 202 textlist storelist 203 { 204 dataid TEXT_LIST 205 pos "5 30" 206 size "400 80" 207 lineheight 20 208 color "0.60 0.60 0.60 1" 209 selectcolor "1 1 1 1" 210 rows "4" 211 onClick { 212 call *node:root.equippanel.update_buttons 213 cmd "basedef_selectitem <cvar:mn_bdef_type> -1 <lineselected>;" 214 } 215 onViewChange { 216 *node:parent.storelist_scroll@fullsize = <fullsize> 217 *node:parent.storelist_scroll@current = <viewpos> 218 *node:parent.storelist_scroll@viewsize = <viewsize> 219 } 220 } 221 vscrollbar storelist_scroll 222 { 223 image "ui/scrollbar_v_green" 224 pos "410 30" 225 height "80" 226 current 0 227 viewsize 4 228 fullsize 4 229 hidewhenunused true 230 onChange { *node:parent.storelist@viewpos = <current> } 231 } 232 } 233 234 panel descpanel { 235 { 236 pos "455 5" 237 size "334 285" 238 background "ui/panel_green" 239 } 240 241 string description_title 242 { 243 string "_Selected Item" 244 pos "10 5" 245 size "314 25" 246 contentalign ALIGN_UC 247 font "f_small_bold" 248 } 249 string item_name 250 { 251 string *cvar:mn_itemname 252 pos "10 25" 253 size "314 25" 254 contentalign ALIGN_UC 255 } 256 257 model item_model 258 { 259 src *cvar:mn_upmodel_top 260 angles "-10 160 70" 261 pos "10 50" 262 size "314 140" 263 } 264 265 text description 266 { 267 dataid TEXT_ITEMDESCRIPTION 268 pos "10 195" 269 size "284 80" 270 lineheight 20 271 tabwidth 200 272 color "0.60 0.60 0.60 1" 273 selectcolor "1 1 1 1" 274 onViewChange { 275 *node:parent.description_scroll@fullsize = <fullsize> 276 *node:parent.description_scroll@current = <viewpos> 277 *node:parent.description_scroll@viewsize = <viewsize> 278 } 279 } 280 vscrollbar description_scroll 281 { 282 image "ui/scrollbar_v_green" 283 pos "304 195" 284 height "80" 285 current 0 286 viewsize 4 287 fullsize 4 288 hidewhenunused true 289 onChange { *node:parent.description@viewpos = <current> } 290 } 291 } 292 } 293 294 panel infopanel { 295 { 296 pos "15 115" 297 size "794 305" 298 } 299 300 string infopanel_title 301 { 302 string "_Surface to Air defences" 303 pos "50 30" 304 size "570 35" 305 font "f_normal_bold" 306 } 307 308 string name_title 309 { 310 string "_Name:" 311 pos "50 95" 312 size "250 25" 313 font "f_small_bold" 314 } 315 textentry name 316 { 317 string *cvar:mn_installation_title 318 pos "310 90" 319 size "256 34" 320 background "ui/button_green_verysmall" 321 color "0 .78 0 1" 322 selectcolor "1 1 1 1" 323 contentalign ALIGN_CL 324 padding 8 325 font "f_verysmall" 326 onChange { } 327 clickoutabort true 328 } 329 330 string target_title 331 { 332 string "_Targetted UFO:" 333 pos "50 150" 334 size "250 25" 335 } 336 string target_value 337 { 338 string *cvar:mn_target 339 pos "310 150" 340 size "150 25" 341 } 342 343 string buildtime_label 344 { 345 string "_Time to build:" 346 pos "50 175" 347 size "250 20" 348 } 349 string buildtime 350 { 351 string *cvar:mn_installation_timetobuild 352 pos "310 175" 353 size "100 20" 354 } 355 356 string autofire_title 357 { 358 string "_Autofire" 359 pos "50 200" 360 size "250 25" 361 } 362 checkbox_green autofire 363 { 364 pos "310 200" 365 size "20 20" 366 current 0 367 disabled true 368 onChange { cmd "basedef_autofire <current>;" } 369 } 370 371 button destroy 372 { 373 string "_Destroy" 374 tooltip "_Destroy installation" 375 color "0 0.5 0 1" 376 font "f_menu" 377 background "ui/button_green_small" 378 pos "50 250" 379 size "200 32" 380 onClick { cmd "ui_pop; mn_installation_destroy;" } 381 } 382 button close 383 { 384 string "_Close" 385 color "0 0.5 0 1" 386 font "f_menu" 387 background "ui/button_green_small" 388 pos "549 250" 389 size "200 32" 390 onClick { cmd "ui_pop;" } 391 } 392 393 } 394 395 confunc setautofire { 396 *cvar:tmp = "<1>" 397 if ( *cvar:tmp eq "disable" ) { 398 *node:root.infopanel.autofire@current = 0 399 *node:root.infopanel.autofire@disabled = true 400 } else { 401 *node:root.infopanel.autofire@current = <cvar:tmp> 402 *node:root.infopanel.autofire@disabled = false 403 } 404 delete *cvar:tmp 405 } 406 407 func onWindowOpened { 408 *cvar:mn_itemname = "" 409 *cvar:mn_upmodel_top = "" 410 *cvar:mn_bdef_type = "info" 411 *node:root.infopanel@invis = false 412 *node:root.equippanel@invis = true 413 if ( *cvar:mn_installation_type ne "" ) { 414 *node:root.infopanel.name@string = *cvar:mn_installation_title 415 *node:root.infopanel.name@onChange = { cmd "mn_installation_changename;" } 416 *node:root.infopanel.destroy@invis = false 417 /** Show building time */ 418 if ( *cvar:mn_installation_timetobuild ne "-" ) { 419 *node:root.infopanel.buildtime_label@invis = false 420 *node:root.infopanel.buildtime@invis = false 421 } else { 422 *node:root.infopanel.buildtime_label@invis = true 423 *node:root.infopanel.buildtime@invis = true 424 } 425 } else { 426 *node:root.infopanel.name@string = *cvar:mn_base_title 427 *node:root.infopanel.name@onChange = { cmd "base_changename;" } 428 *node:root.infopanel.buildtime_label@invis = true 429 *node:root.infopanel.buildtime@invis = true 430 *node:root.infopanel.destroy@invis = true 431 } 432 cmd "basedef_updatemenu info;" 433 call *node:root.equippanel.update_buttons 434 } 435} 436