Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 24.98 KB  |  hits: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * @TODO:
  3.  *   See here: http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=commit;h=6f98e6620c75363f51b7e736052ac80f9ac50b7a
  4.  * - Soldiers
  5.  * - Market
  6.  * - Production
  7.  * - Base summary
  8.  * - Transfers
  9.  * - Aircraft
  10.  * - Clicking on aircraft just leads to aircraft window, but should also select the aircraft the user clicked
  11.  * - Add injured soldiers to employee count list
  12.  * - Icons for UFOPaedia, kill alien (aliencontainment)
  13.  * - Alien containment requires several delete cvar calls on cvars that may not exist, which leads to errors printed in console.
  14.  * LATER IMPROVEMENTS:
  15.  * - Build facility: make building preview appear below each option when clicked
  16.  * - Build facility: make building capacity (+) buttons automatically select that building type
  17.  * - Build facility: Make the add building button turn to a warning if it is
  18.  *   too high/low (low is for antimatter only)
  19.  * - Don't show progress bar in alien containment if alien is already researched
  20.  */
  21.  
  22. window bases
  23. {
  24.         { size  "1024 768" }
  25.  
  26.         // Left base panel
  27.         panel base_container
  28.         {
  29.                 {
  30.                         pos                             "5 5"
  31.                         size                    "723 758"
  32.                         border                  "2"
  33.                         bordercolor             "0.56 0.81 0.76 1"
  34.                 }
  35.  
  36.                 // @TODO: make next/prev base btns work
  37.                 button prev
  38.                 {
  39.                         icon                    "icons/windowprev"
  40.                         tooltip                 "_Previous base"
  41.                         pos                             "90 6"
  42.                         size                    "18     18"
  43.                         onMouseEnter    { *node:this@icon = "icons/windowprev0" }
  44.                         onMouseLeave    { *node:this@icon = "icons/windowprev" }
  45.                         onClick                 { cmd "ui_pop; mn_base_prev;" }
  46.                 }
  47.                 button next
  48.                 {
  49.                         icon                    "icons/windownext"
  50.                         tooltip                 "_Next base"
  51.                         pos                             "115 6"
  52.                         size                    "18     18"
  53.                         onMouseEnter    { *node:this@icon = "icons/windownext0" }
  54.                         onMouseLeave    { *node:this@icon = "icons/windownext" }
  55.                         onClick                 { cmd "ui_pop; mn_base_next;" }
  56.                 }
  57.                 // Base name
  58.                 textentry name
  59.                 {
  60.                         string          *cvar:mn_base_title
  61.                         pos                     "135 0"
  62.                         size            "465 32"
  63.                         font            "f_small_bold"
  64.                         color                   "0.56 0.81 0.76 1"
  65.                         contentalign    ALIGN_CL
  66.                         onChange        { cmd "base_changename" }       // stores the value of the cvar in the base structure
  67.                 }
  68.                 // Base selector
  69.                 panel base_selector
  70.                 {
  71.                         {
  72.                                 pos             "440 7"
  73.                                 size    "160 16"
  74.                                 layout                  LAYOUT_COLUMN
  75.                                 layoutColumns   8
  76.                                 layoutMargin    4
  77.                         }
  78.                         BaseLayoutMini base0 { baseid 0 }
  79.                         BaseLayoutMini base1 { baseid 1 }
  80.                         BaseLayoutMini base2 { baseid 2 }
  81.                         BaseLayoutMini base3 { baseid 3 }
  82.                         BaseLayoutMini base4 { baseid 4 }
  83.                         BaseLayoutMini base5 { baseid 5 }
  84.                         BaseLayoutMini base6 { baseid 6 }
  85.                         BaseLayoutMini base7 { baseid 7 }
  86.                 }
  87.                 string credits
  88.                 {
  89.                         string          *cvar:mn_credits
  90.                         pos                     "600 0"
  91.                         size            "120 32"
  92.                         font            "f_small_bold"
  93.                         color                   "0.56 0.81 0.76 1"
  94.                         contentalign    ALIGN_CR
  95.                 }
  96.  
  97.                 // The base map
  98.                 panel base_map_container
  99.                 {
  100.                         {
  101.                                 pos                             "4 30"
  102.                                 size                    "715 670"
  103.                                 border                  "2"
  104.                                 bordercolor             "0.527 0.6 0.21 1"
  105.                         }
  106.                         basemap thebasemap
  107.                         {
  108.                                 pos                             "1 1"
  109.                                 size                    "715 667"
  110.                         }
  111.                 }
  112.  
  113.                 // Employee panel
  114.                 // @TODO: add support for injured soldiers
  115.                 panel cur_employees
  116.                 {
  117.                         {
  118.                                 pos             "0 705"
  119.                                 size    "400 48"
  120.                         }
  121.                         EmployeeCount scientists
  122.                         {
  123.                                 {
  124.                                         pos             "0 0"
  125.                                         onClick { cmd "ui_push research;" }
  126.                                 }
  127.                                 string label { string "_Scientists" }
  128.                                 button icon { icon "icons/head_scientist" }
  129.                         }
  130.                         EmployeeCount workers
  131.                         {
  132.                                 {
  133.                                         pos             "120 0"
  134.                                         onClick { cmd "ui_push production;" }
  135.                                 }
  136.                                 string label { string "_Engineers" }
  137.                                 button icon { icon "icons/head_worker" }
  138.                         }
  139.                         EmployeeCount soldiers
  140.                         {
  141.                                 {
  142.                                         pos             "240 0"
  143.                                 }
  144.                                 string label { string "_Soldiers" }
  145.                                 button icon { icon "icons/head_soldier" }
  146.                         }
  147.                 }
  148.  
  149.                 // Base summary, transfers, options, UFOpaedia
  150.                 panel buttons
  151.                 {
  152.                         {
  153.                                 pos             "400 705"
  154.                                 size    "323 48"
  155.                         }
  156.                         button basesummary
  157.                         {
  158.                                 pos             "270 0"
  159.                                 size    "48 48"
  160.                                 icon            "icons/stats"
  161.                                 background      "icons/circle0"
  162.                                 onMouseEnter    { *node:this@background = "icons/circle" }
  163.                                 onMouseLeave    { *node:this@background = "icons/circle0" }
  164.                                 onClick                 { cmd "ui_push basesummary;" }
  165.                         }
  166.                         button transfers
  167.                         {
  168.                                 pos             "215 0"
  169.                                 size    "48 48"
  170.                                 icon            "icons/transfer"
  171.                                 background      "icons/circle0"
  172.                                 onMouseEnter    { *node:this@background = "icons/circle" }
  173.                                 onMouseLeave    { *node:this@background = "icons/circle0" }
  174.                                 onClick                 { cmd "ui_push basesummary;" }
  175.                         }
  176.                         button ufopaedia
  177.                         {
  178.                                 pos             "160 0"
  179.                                 size    "48 48"
  180.                                 icon            "icons/info"
  181.                                 background      "icons/circle0"
  182.                                 onMouseEnter    { *node:this@background = "icons/circle" }
  183.                                 onMouseLeave    { *node:this@background = "icons/circle0" }
  184.                         }
  185.                         button options
  186.                         {
  187.                                 pos             "105 0"
  188.                                 size    "48 48"
  189.                                 icon            "icons/options"
  190.                                 background      "icons/circle0"
  191.                                 onMouseEnter    { *node:this@background = "icons/circle" }
  192.                                 onMouseLeave    { *node:this@background = "icons/circle0" }
  193.                         }
  194.                 }
  195.  
  196.                 // Alien containment
  197.                 panel alien_containment
  198.                 {
  199.                         {
  200.                                 pos                             "4 30"
  201.                                 size                    "715 720"
  202.                                 border                  "2"
  203.                                 bordercolor             "0.527 0.6 0.21 1"
  204.                                 invis                   true
  205.                         }
  206.                         // Title bar
  207.                         panel header
  208.                         {
  209.                                 {
  210.                                         pos                     "1 1"
  211.                                         size            "713 32"
  212.                                         bgcolor         "0.527 0.6 0.21 0.2"
  213.                                 }
  214.                                 string title
  215.                                 {
  216.                                         string                  "_Alien Containment"
  217.                                         pos                             "90 1"
  218.                                         size                    "593 32"
  219.                                         contentalign    ALIGN_CL
  220.                                         color                   "0.56 0.81 0.76 1"
  221.                                 }
  222.                                 button back
  223.                                 {
  224.                                         icon                    "icons/windownext"
  225.                                         tooltip                 "_Back to base"
  226.                                         pos                             "683 7"
  227.                                         size                    "18     18"
  228.                                         onMouseEnter    { *node:this@icon = "icons/windownext0" }
  229.                                         onMouseLeave    { *node:this@icon = "icons/windownext" }
  230.                                         onClick                 { cmd "alien_containment false;" }
  231.                                 }
  232.                         }
  233.                         // List of aliens
  234.                         panel aliens
  235.                         {
  236.                                 {
  237.                                         pos                             "10 60"
  238.                                         size                    "425 650"
  239.                                         layout                  LAYOUT_TOP_DOWN_FLOW
  240.                                         layoutMargin    10
  241.                                 }
  242.                         }
  243.                         // Alien autopsy image and body counts
  244.                         panel info
  245.                         {
  246.                                 {
  247.                                         pos                     "442 60"
  248.                                         size            "263 650"
  249.                                         onClick         { cmd "aliencont_pedia <node:this.selected@integer>;" }
  250.                                         invis           true
  251.                                 }
  252.                                 data selected { integer 0 }
  253.                                 image autopsy_image
  254.                                 {
  255.                                         src             *cvar:mn_al_alienimage
  256.                                         pos             "0 0"
  257.                                         size    "263 600"
  258.                                         ghost   true
  259.                                 }
  260.                                 string label
  261.                                 {
  262.                                         string                  *cvar:mn_al_alientype
  263.                                         pos                             "0 570"
  264.                                         size                    "263 30"
  265.                                         font                    "f_small_bold"
  266.                                         color                   "0.56 0.81 0.76 1"
  267.                                         bgcolor                 "0 0 0 0.6"
  268.                                         contentalign    ALIGN_CC
  269.                                         ghost                   true
  270.                                 }
  271.                                 button ufopedia
  272.                                 {
  273.                                         icon            "icons/bordered_magnifying_glass"
  274.                                         tooltip         "_UFOpaedia"
  275.                                         pos                     "240 577"
  276.                                         size            "16 16"
  277.                                         ghost           true
  278.                                 }
  279.                                 panel stats
  280.                                 {
  281.                                         {
  282.                                                 pos             "0 610"
  283.                                                 size    "263 40"
  284.                                         }
  285.                                         string living_label
  286.                                         {
  287.                                                 string                  "_Alive"
  288.                                                 pos                             "0 0"
  289.                                                 size                    "70 20"
  290.                                                 color                   "0.56 0.81 0.76 1"
  291.                                                 contentalign    ALIGN_CL
  292.                                         }
  293.                                         string living_data
  294.                                         {
  295.                                                 string                  *cvar:mn_al_alive
  296.                                                 pos                             "100 0"
  297.                                                 size                    "163 20"
  298.                                                 color                   "0.56 0.81 0.76 1"
  299.                                                 contentalign    ALIGN_CR
  300.                                         }
  301.                                         string dead_label
  302.                                         {
  303.                                                 string                  "_Dead"
  304.                                                 pos                             "0 20"
  305.                                                 size                    "70 20"
  306.                                                 color                   "0.56 0.81 0.76 1"
  307.                                                 contentalign    ALIGN_CL
  308.                                         }
  309.                                         string dead_data
  310.                                         {
  311.                                                 string                  *cvar:mn_al_dead
  312.                                                 pos                             "100 20"
  313.                                                 size                    "163 20"
  314.                                                 color                   "0.56 0.81 0.76 1"
  315.                                                 contentalign    ALIGN_CR
  316.                                         }
  317.                                 }
  318.                         }
  319.                 }
  320.         }
  321.  
  322.         // Main base sections
  323.         panel sections
  324.         {
  325.                 {
  326.                         pos                     "726 5"
  327.                         size            "298 672"
  328.                         layout          LAYOUT_TOP_DOWN_FLOW
  329.                         layoutMargin    2
  330.                 }
  331.                 BaseSection facilities
  332.                 {
  333.                         {
  334.                                 onClick         { cmd "alien_containment false; show_facility <node:this.state@string>;" }
  335.                         }
  336.                         string label { string "_Facilities" }
  337.                         button icon { icon "icons/facilities" }
  338.                         data state { string "true" }
  339.                        
  340.                         panel bld_panel
  341.                         {
  342.                                 {
  343.                                         pos                     "29 48"
  344.                                         size                    "298 0"
  345.                                         layout                  LAYOUT_TOP_DOWN_FLOW
  346.                                         layoutMargin    0
  347.                                 }
  348.                                 data height { integer 0 }
  349.                                
  350.                                 // Current and maximum building capacity for buildings
  351.                                 // Shows living space, production, lab, storage, antimatter storage
  352.                                 // OR shows all when facilities tab is clicked on.
  353.                                 panel bld_space
  354.                                 {
  355.                                         {
  356.                                                 pos                             "0 0"
  357.                                                 size                    "298 0"
  358.                                                 layout                  LAYOUT_TOP_DOWN_FLOW
  359.                                                 layoutMargin    0
  360.                                         }
  361.                                         data height { integer 0 }
  362.                                 }
  363.                                 // Preview of currently selected building
  364.                                 panel preview
  365.                                 {
  366.                                         {
  367.                                                 size            "298 185"
  368.                                                 onClick         { cmd "building_ufopedia;" }
  369.                                         }
  370.                                         image bld_image
  371.                                         {
  372.                                                 src                             *cvar:mn_building_image
  373.                                                 preventratio    true
  374.                                                 pos                             "29 0"
  375.                                                 size                    "224 90"
  376.                                                 contentalign    ALIGN_UL
  377.                                                 ghost                   true
  378.                                         }
  379.                                         /*
  380.                                         button ufopedia
  381.                                         {
  382.                                                 icon            "icons/bordered_magnifying_glass"
  383.                                                 tooltip         "_UFOpaedia"
  384.                                                 pos                     "29 74"
  385.                                                 size            "16 16"
  386.                                                 ghost           true
  387.                                         }
  388.                                         */
  389.                                         text info
  390.                                         {
  391.                                                 pos                             "29 100"
  392.                                                 size                    "224 60"
  393.                                                 lineheight              15
  394.                                                 tabwidth                140
  395.                                                 font                    "f_verysmall"
  396.                                                 color                   "0.56 0.81 0.76 1"
  397.                                                 dataid                  TEXT_BUILDING_INFO
  398.                                                 rows                    4
  399.                                                 contentalign    ALIGN_UL
  400.                                                 ghost                   true
  401.                                         }
  402.                                         string status
  403.                                         {
  404.                                                 string                  *cvar:mn_building_status
  405.                                                 pos                             "29 160"
  406.                                                 size                    "224 20"
  407.                                                 font                    "f_verysmall"
  408.                                                 color                   "0.56 0.81 0.76 1"
  409.                                                 contentalign    ALIGN_UL
  410.                                                 ghost                   true
  411.                                         }
  412.                                 }
  413.                         }
  414.                 }
  415.  
  416.  
  417.                
  418.                
  419.                 BaseSection aircraft
  420.                 {
  421.                         {
  422.                                 onClick         { cmd "alien_containment false; show_facility false; ui_push aircraft;" }
  423.                         }
  424.                         string label { string "_Aircraft" }
  425.                         button icon { icon "icons/aircraft" }
  426.  
  427.                         // Aircraft added as child nodes to this panel
  428.                         panel aircraft_list
  429.                         {
  430.                                 {
  431.                                         pos                     "29 48"
  432.                                         size                    "250 48"
  433.                                         invis                   true
  434.                                         layout                  LAYOUT_COLUMN
  435.                                         layoutColumns   5
  436.                                         layoutMargin    0
  437.                                 }
  438.                         }
  439.                 }
  440.                 BaseSection soldiers
  441.                 {
  442.                         {
  443.                                 onClick         { cmd "alien_containment false; show_facility false; echo soldiers_pushed;" }
  444.                         }
  445.                         string label { string "_Soldiers" }
  446.                         button icon { icon "icons/crouch" }
  447.                 }
  448.                 BaseSection buysell
  449.                 {
  450.                         {
  451.                                 onClick         { cmd "alien_containment false; show_facility false; ui_push market;" }
  452.                         }
  453.                         string label { string "_Market" }
  454.                         button icon { icon "icons/market" }
  455.                 }
  456.                 BaseSection research
  457.                 {
  458.                         {
  459.                                 onClick         { cmd "alien_containment false; show_facility false; ui_push research;" }
  460.                         }
  461.                         string label { string "_Research" }
  462.                         button icon { icon "icons/research" }
  463.  
  464.                         // Aircraft added as child nodes to this panel
  465.                         panel research_list
  466.                         {
  467.                                 {
  468.                                         pos                     "29 48"
  469.                                         size                    "250 28"
  470.                                         layout                  LAYOUT_TOP_DOWN_FLOW
  471.                                         layoutMargin    0
  472.                                         ghost                   true
  473.                                 }
  474.                         }
  475.                 }
  476.                 BaseSection production
  477.                 {
  478.                         {
  479.                                 onClick         { cmd "alien_containment false; show_facility false; ui_push production;" }
  480.                         }
  481.                         string label { string "_Production" }
  482.                         button icon { icon "icons/wrench" }
  483.  
  484.                         // Production added as child nodes to this panel
  485.                         panel production_list
  486.                         {
  487.                                 {
  488.                                         pos                     "29 48"
  489.                                         size                    "250 28"
  490.                                         layout                  LAYOUT_TOP_DOWN_FLOW
  491.                                         layoutMargin    0
  492.                                         ghost                   true
  493.                                 }
  494.                         }
  495.                 }
  496.                 BaseSection containment
  497.                 {
  498.                         {
  499.                                 onClick         { cmd "show_facility false; aliencont_init; alien_containment <node:this.state@string>;" }
  500.                         }
  501.                         string label { string "_Alien Containment" }
  502.                         button icon { icon "icons/aliens" }
  503.                         data state { string "true" }
  504.                 }
  505.  
  506.         }
  507.  
  508.         // Back to geoscape
  509.         Geoscape geoscape_button { }
  510.  
  511.  
  512.         // Used to enable/disable the overall base buttons
  513.         // param1: button
  514.         // param2: state
  515.         // param3: tooltip
  516.         // @TODO: handle hospital/transfer
  517.         // @TODO: some buttons don't have windows
  518.         // @TODO: Check tooltips only show when disabled
  519.         confunc update_basebutton
  520.         {
  521.                 if (param2 eq "true") {
  522.                         if (param1 eq "hire") {
  523.                                 *node:parent.sections.soldiers.bg@bgcolor = "1 1 1 0.2"
  524.                                 *node:parent.sections.soldiers@onMouseEnter = { }
  525.                                 *node:parent.sections.soldiers@onMouseLeave = { }
  526.                                 *node:parent.sections.soldiers@onClick = { }
  527.                                 *node:parent.sections.soldiers@tooltip = "_<3>"
  528.                         } elif (param1 eq "hospital") {
  529.                         } elif (param1 eq "transfer") {
  530.                         } else {
  531.                                 *node:parent.sections.<1>.bg@bgcolor = "1 1 1 0.2"
  532.                                 *node:parent.sections.<1>@onMouseEnter = { }
  533.                                 *node:parent.sections.<1>@onMouseLeave = { }
  534.                                 *node:parent.sections.<1>@onClick = { }
  535.                                 *node:parent.sections.<1>@tooltip = "_<3>"
  536.                         }
  537.                 } else {
  538.                         if (param1 eq "hire") {
  539.                                 *node:parent.sections.soldiers.bg@bgcolor = "0.527 0.6 0.21 0.2"
  540.                                 *node:parent.sections.soldiers@onMouseEnter = { *node:this.bg@bgcolor = "0.527 0.6 0.21 0.4" *node:this.icon@background = "icons/circle" }
  541.                                 *node:parent.sections.soldiers@onMouseLeave = { *node:this.bg@bgcolor = "0.527 0.6 0.21 0.2" *node:this.icon@background = "icons/circle0" }
  542.                                 *node:parent.sections.soldiers@onClick = { cmd "alien_containment false; show_facility false; ui_push aliencont;" }
  543.                                 *node:parent.sections.soldiers@tooltip = ""
  544.                         } elif (param1 eq "hospital") {
  545.                         } elif (param1 eq "transfer") {
  546.                         } else {
  547.                                 *node:parent.sections.<1>.bg@bgcolor = "0.527 0.6 0.21 0.2"
  548.                                 *node:parent.sections.<1>@onMouseEnter = { *node:this.bg@bgcolor = "0.527 0.6 0.21 0.4" *node:this.icon@background = "icons/circle" }
  549.                                 *node:parent.sections.<1>@onMouseLeave = { *node:this.bg@bgcolor = "0.527 0.6 0.21 0.2" *node:this.icon@background = "icons/circle0" }
  550.                                 *node:parent.sections.<1>@tooltip = ""
  551.                                 if (param1 eq "aircraft") {
  552.                                         *node:parent.sections.<1>@onClick = { cmd "alien_containment false; show_facility false; ui_push aircraft;" }
  553.                                 } elif (param1 eq "buysell") {
  554.                                         *node:parent.sections.<1>@onClick = { cmd "alien_containment false; show_facility false; ui_push market;" }
  555.                                 } elif (param1 eq "research") {
  556.                                         *node:parent.sections.<1>@onClick = { cmd "alien_containment false; show_facility false; ui_push research;" }
  557.                                 } elif (param1 eq "production") {
  558.                                         *node:parent.sections.<1>@onClick = { cmd "alien_containment false; show_facility false; ui_push production;" }
  559.                                 } elif (param1 eq "containment") {
  560.                                         *node:parent.sections.<1>@onClick = { cmd "show_facility false; aliencont_init; alien_containment <node:this.state@string>;" }
  561.                                 }
  562.                         }
  563.                 }
  564.         }
  565.  
  566.         /*
  567.          * Passes information on capacity for available buildings
  568.          * param1 = building name
  569.          * param2 = building id (building_lab, building_quarters, building_storage, etc.)
  570.          * param3 = currently used capacity
  571.          * param4 = actual max capacity
  572.          * param5 = number of buildings built of this type
  573.          * param5 = max number of buildings can be built from this type
  574.          */
  575.         confunc show_bld_space
  576.         {
  577.                 // Set the appropriate size of the panel
  578.                 *node:parent.sections.facilities.bld_panel.bld_space.height@integer = (<node:parent.sections.facilities.bld_panel.bld_space.height@integer> + 30)
  579.                 *node:parent.sections.facilities.bld_panel.bld_space@size = "298 <node:parent.sections.facilities.bld_panel.bld_space.height@integer>"
  580.                 *node:parent.sections.facilities.bld_panel.height@integer = (<node:parent.sections.facilities.bld_panel.bld_space.height@integer> + 185)
  581.                 *node:parent.sections.facilities.bld_panel@size = "298 <node:parent.sections.facilities.bld_panel.height@integer>"
  582.  
  583.                 // Add the capacity bar
  584.                 call *node:parent.sections.facilities.bld_panel.bld_space@createChild ( "<2>", "BuildingSpace" )
  585.                 *node:parent.sections.facilities.bld_panel.bld_space.<2>.id@string = "<2>"
  586.                 *node:parent.sections.facilities.bld_panel.bld_space.<2>.smlicon@icon = "icons/<2>"
  587.                 *node:parent.sections.facilities.bld_panel.bld_space.<2>@tooltip = "<1>"
  588.                 *node:parent.sections.facilities.bld_panel.bld_space.<2>.data_bar@current = <3>
  589.                 *node:parent.sections.facilities.bld_panel.bld_space.<2>.data_bar@max = <4>
  590.  
  591.                 // Only show the capacity string if max isn't 0
  592.                 if (param4 ne 0) {
  593.                         *node:parent.sections.facilities.bld_panel.bld_space.<2>.data@string = <3>/<4>
  594.                 } elif (param6 > 0) {
  595.                         // Show current/max number of buildings of a type if limited
  596.                         *node:parent.sections.facilities.bld_panel.bld_space.<2>.data@string = <5>/<6>
  597.                 }
  598.                 // Show/Hide "add" building button
  599.                 if (param5 == param6 ) {
  600.                         *node:parent.sections.facilities.bld_panel.bld_space.<2>.alert@invis = true
  601.                 } else {
  602.                         *node:parent.sections.facilities.bld_panel.bld_space.<2>.alert@invis = false
  603.                 }
  604.         }
  605.  
  606.         /*
  607.          * Clear building space indicators in preparation for updating the list
  608.          */
  609.         confunc clear_bld_space
  610.         {
  611.                 call *node:parent.sections.facilities.bld_panel.bld_space@removeAllChild
  612.                 *node:parent.sections.facilities.bld_panel.bld_space@size = "298 0"
  613.                 *node:parent.sections.facilities.bld_panel.bld_space.height@integer = 0
  614.         }
  615.  
  616.         /*
  617.          * Current employees of a particular base
  618.          * param1 = number of soldiers
  619.          * param2 = number of scientists
  620.          * param3 = number of workers
  621.          */
  622.         confunc current_employees
  623.         {
  624.                 *node:parent.base_container.cur_employees.soldiers.data@string = "<1>"
  625.                 *node:parent.base_container.cur_employees.scientists.data@string = "<2>"
  626.                 *node:parent.base_container.cur_employees.workers.data@string = "<3>"
  627.         }
  628.  
  629.         /*
  630.          * Show the base's aircraft (not currently used in default UI)
  631.          * param1 = id (in list of aircraft in base -- not global idx)
  632.          * param2 = name
  633.          * param3 = aircraft type
  634.          * param4 = status
  635.          * param5 = aircraft in base?
  636.          */
  637.         confunc clear_aircraft {
  638.                 *node:parent.sections.aircraft@size     = "298 48"
  639.                 *node:parent.sections.aircraft.aircraft_list@invis = true
  640.                 call *node:parent.sections.aircraft.aircraft_list@removeAllChild
  641.         }
  642.         confunc show_aircraft
  643.         {
  644.                 *node:parent.sections.aircraft@size     = "298 96"
  645.                 call *node:parent.sections.aircraft.aircraft_list@createChild("<1>", "AircraftIcon")
  646.                 *node:parent.sections.aircraft.aircraft_list.<1>.icon@tooltip = "<2> (<4>)"
  647.                 if (param5 eq 1) {
  648.                         *node:parent.sections.aircraft.aircraft_list.<1>.icon@icon = "icons/<3>"
  649.                 } else {
  650.                         *node:parent.sections.aircraft.aircraft_list.<1>.icon@icon = "icons/<3>_off"
  651.                 }
  652.                 *node:parent.sections.aircraft.aircraft_list.<1>.aircraft_id@string = <1>
  653.                 *node:parent.sections.aircraft.aircraft_list.<1>.icon@onClick = { cmd "ui_push aircraft <node:parent.aircraft_id@string>;" }
  654.                 *node:parent.sections.aircraft.aircraft_list@invis = false
  655.                  /*
  656.                         THEN ADD THIS TO AIRCRAFT onWindowOpened
  657.                         if (<1> ne "") {
  658.                                 *cvar:mn_aircraft_id = <1>
  659.                                 cmd "mn_select_aircraft \"<1>\";"
  660.                         }
  661.                  */
  662.         }
  663.  
  664.         /*
  665.          * Show a research item in the base overview (not used in default UI)
  666.          * param1 = name
  667.          * param2 = number of scientists working on it
  668.          * param3 = percent complete
  669.          * @TODO: to work properly, research window must call base_init when it
  670.          *        closes. Currently, it will not update after research changed
  671.          */
  672.         confunc clear_research
  673.         {
  674.                 *node:parent.sections.research@size     = "298 48"
  675.                 call *node:parent.sections.research.research_list@removeAllChild
  676.         }
  677.         confunc show_research
  678.         {
  679.                 *node:parent.sections.research@size     = "298 80"
  680.                 call *node:parent.sections.research.research_list@createChild("<1>", "ProgressBar")
  681.                 *node:parent.sections.research.research_list.<1>.label@string = _<1>
  682.                 *node:parent.sections.research.research_list.<1>.data_bar@current = <3>
  683.         }
  684.  
  685.         /*
  686.          * Show the production item closest to completion in the base overview (not used in default UI)
  687.          * param1 = name
  688.          * param2 = percent complete
  689.          */
  690.         confunc clear_production
  691.         {
  692.                 *node:parent.sections.production@size   = "298 48"
  693.                 call *node:parent.sections.production.production_list@removeAllChild
  694.         }
  695.         confunc show_production
  696.         {
  697.                 *node:parent.sections.production@size   = "298 80"
  698.                 call *node:parent.sections.production.production_list@createChild("<1>", "ProgressBar")
  699.                 *node:parent.sections.production.production_list.<1>.label@string = _<1>
  700.                 *node:parent.sections.production.production_list.<1>.data_bar@current = <2>
  701.         }
  702.  
  703.         /*
  704.          * Show the facilities panel
  705.          * param1 = true (show) or false (hide)
  706.          */
  707.         confunc show_facility
  708.         {
  709.                 if (param1 eq "true") {
  710.  
  711.                         // Show capacity for all base buildings
  712.                         cmd "base_building_space;"
  713.  
  714.                         // Set the state for subsequent clicks
  715.                         *node:parent.sections.facilities.state@string = "false"
  716.                 } else {
  717.  
  718.                         // Resets list selection
  719.                         cmd "reset_building_current 0;"
  720.  
  721.                         // Set the state/invis for subsequent clicks
  722.                         *node:parent.sections.facilities.state@string = "true"
  723.  
  724.                         // Show capacity for just main base buildings
  725.                         cmd "base_init;"
  726.                 }
  727.  
  728.                 // Hide/show the other base sections
  729.                 *node:parent.sections.aircraft@invis = <1>
  730.                 *node:parent.sections.soldiers@invis = <1>
  731.                 *node:parent.sections.buysell@invis = <1>
  732.                 *node:parent.sections.research@invis = <1>
  733.                 *node:parent.sections.production@invis = <1>
  734.                 *node:parent.sections.containment@invis = <1>
  735.         }
  736.  
  737.         /*
  738.          * Show and hide the alien containment panel
  739.          * param1 = true (show alien containment), false (hide alien containment)
  740.          */
  741.         confunc alien_containment
  742.         {
  743.  
  744.                 if (param1 eq "true") {
  745.  
  746.                         // Show the alien containment area
  747.                         *node:parent.base_container.alien_containment@invis = false
  748.  
  749.                         // Show the aliens
  750.                         *cvar:i = 0;
  751.                         while ( *cvar:i < 8 ) {
  752.                                 if (*cvar:mn_ac_name<cvar:i> ne "None") {
  753.                                         call *node:parent.base_container.alien_containment.aliens@createChild("<cvar:i>", "AlienPanel")
  754.                                         *node:parent.base_container.alien_containment.aliens.<cvar:i>.label@string = *cvar:mn_ac_name<cvar:i>
  755.                                         *node:parent.base_container.alien_containment.aliens.<cvar:i>.status@string = *cvar:mn_ac_statusstr<cvar:i>
  756.                                         *node:parent.base_container.alien_containment.aliens.<cvar:i>.data_bar@current = *cvar:mn_ac_progress<cvar:i>
  757.                                         *node:parent.base_container.alien_containment.aliens.<cvar:i>.alien_num@string = <cvar:i>
  758.                                         if (*cvar:mn_alien<cvar:i>_option eq "autopsy") {
  759.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@tooltip = "_Perform Autopsy"
  760.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@icon = "icons/autopsy0"
  761.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onMouseEnter = { *node:this@icon = "icons/autopsy" }
  762.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onMouseLeave = { *node:this@icon = "icons/autopsy0" }
  763.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onClick = { cmd "aliencont_research <node:parent.alien_num@string>;" }
  764.                                         } elif (*cvar:mn_alien<cvar:i>_option eq "kill") {
  765.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@tooltip = "_Kill Alien"
  766.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@icon = "icons/alien_kill"
  767.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onMouseEnter = { *node:this@icon = "icons/alien_kill" }
  768.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onMouseLeave = { *node:this@icon = "icons/alien_kill" }
  769.                                                 *node:parent.base_container.alien_containment.aliens.<cvar:i>.action@onClick = { cmd "aliencont_killone <node:parent.alien_num@string>;" }
  770.                                         } else {
  771.                                                 *node:parent.base_container.alien_containment.aliens.<1>.action@invis = true
  772.                                         }
  773.                                 }
  774.                                 *cvar:i = ( *cvar:i + 1 )
  775.                         }
  776.                         delete *cvar:mn_alien0_option
  777.                         delete *cvar:mn_alien1_option
  778.                         delete *cvar:mn_alien2_option
  779.                         delete *cvar:mn_alien3_option
  780.                         delete *cvar:mn_alien4_option
  781.                         delete *cvar:mn_alien5_option
  782.                         delete *cvar:mn_alien6_option
  783.                         delete *cvar:mn_alien7_option
  784.  
  785.                         // Set the state for subsequent clicks
  786.                         *node:parent.sections.containment.state@string = false
  787.                 } else {
  788.  
  789.                         // Remove alien panels and hide the image/info when loaded
  790.                         call *node:parent.base_container.alien_containment.aliens@removeAllChild
  791.                         *node:parent.base_container.alien_containment.info@invis = true
  792.  
  793.                         // Hide the alien containment area
  794.                         *node:parent.base_container.alien_containment@invis = true
  795.  
  796.                         // Set the state for subsequent clicks
  797.                         *node:parent.sections.containment.state@string = true
  798.                 }
  799.  
  800.                 // Show or hide the base map, employees and buttons under the map
  801.                 *node:parent.base_container.base_map_container@invis = <1>
  802.                 *node:parent.base_container.cur_employees@invis = <1>
  803.                 *node:parent.base_container.buttons@invis = <1>
  804.         }
  805.  
  806.         /*
  807.          * Clear the alien containment panel
  808.          */
  809.         confunc aliencont_clear { }
  810.  
  811.         /*
  812.          * Place the correct button by each alien in containment (kill or autopsy)
  813.          * param1 = id of the alien slot in the UI
  814.          */
  815.         confunc aliencontneedautopsy
  816.         {
  817.                 *cvar:mn_alien<1>_option = "autopsy"
  818.         }
  819.         confunc aliencontkill
  820.         {
  821.                 *cvar:mn_alien<1>_option = "kill"
  822.         }
  823.  
  824.         /*
  825.          * Select an alien in containment
  826.          * param1 = id of the alien
  827.          */
  828.         confunc select_alien
  829.         {
  830.                 *node:parent.base_container.alien_containment.info.selected@integer = <1>
  831.                 *node:parent.base_container.alien_containment.info@invis = false
  832.         }
  833.  
  834.         /*
  835.          * Reset base status/display info when the player switches to a new base
  836.          * or comes back from another window
  837.          */
  838.         confunc reset_base
  839.         {
  840.                 cmd "show_facility false; alien_containment false;"
  841.         }
  842.  
  843.         // Fuzzy screen effect (see assets.ufo)
  844.         screen overlay { }
  845.  
  846.         func onWindowOpened
  847.         {
  848.                 // Get the parameters needed for this window
  849.                 cmd "base_init;"
  850.  
  851.                 // Close all panels and reset base to default position
  852.                 cmd "reset_base;"
  853.         }
  854. }