Spoiler
Show
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<!--<mdscript name="add drone to station" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">-->
<mdscript name="add drone to station"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Config">
<actions>
<include_actions ref="reset_drones"/>
</actions>
</cue>
<library name="reset_drones">
<actions>
<set_value name="Drone.$Sort" exact="table[
$cargo = null,
$defense = null,
$repair = null,
$build = null,
]"
/>
</actions>
</library>
<cue name="add_drones_Action" instantiate="true">
<conditions>
<event_cue_signalled cue="md.Interact_Menu_API.Get_Actions" />
</conditions>
<actions>
<set_value name="$target" type="station" exact="class.station"/>
<do_if value="$target.isclass.[class.station]">
<signal_cue_instantly
cue = "md.Interact_Menu_API.Add_Action"
param = "table[
$id = 'Add_drones',
$text = 'Добавить дроны на станцию',
$icon = 'widget_arrow_right_01',
$section = 'interaction',
$callback = add_drones_menu,
]"/>
</do_if>
<set_value name="$targetStation" type="station" exact="event.param.$object"/>
</actions>
</cue>
<cue name="add_drones_menu" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly
cue = "md.Simple_Menu_API.Create_Menu"
param = "table[
$title = 'Добавить дроны на станцию',
$columns = 4,
$width = 300
]" />
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Text"
param = "table[
$text = 'Грузовые дроны',
$col = 1,
$colSpan = 2,
$height = 25,
$y = 5,
$halign = 'right',
$scaling = true
]" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Slider"
param = "table[
$id = '$cargo',
$col = 3,
$colSpan = 2,
$height = 25,
$min = 0,
$minSelect = 0,
$max = 100,
$maxSelect = 100,
$start = 0,
$step = 1,
$callback = OnChange
]" />
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row"/>
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Text"
param = "table[
$text = 'Защитные дроны',
$col = 1,
$colSpan = 2,
$height = 25,
$y = 5,
$halign = 'right',
$scaling = true
]" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Slider"
param = "table[
$id = '$defense',
$col = 3,
$colSpan = 2,
$height = 25,
$min = 0,
$minSelect = 0,
$max = 100,
$maxSelect = 100,
$start = 0,
$step = 1,
$callback = OnChange
]" />
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row"/>
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Text"
param = "table[
$text = 'Ремонтные дроны',
$col = 1,
$colSpan = 2,
$height = 25,
$y = 5,
$halign = 'right',
$scaling = true
]" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Slider"
param = "table[
$id = '$repair',
$col = 3,
$colSpan = 2,
$height = 25,
$min = 0,
$minSelect = 0,
$max = 100,
$maxSelect = 100,
$start = 0,
$step = 1,
$callback = OnChange
]" />
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row"/>
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Text"
param = "table[
$text = 'Строительные дроны',
$col = 1,
$colSpan = 2,
$height = 25,
$y = 5,
$halign = 'right',
$scaling = true
]" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Slider"
param = "table[
$id = '$build',
$col = 3,
$colSpan = 2,
$height = 25,
$min = 0,
$minSelect = 0,
$max = 100,
$maxSelect = 100,
$start = 0,
$step = 1,
$callback = OnChange
]" />
<signal_cue_instantly cue="md.Simple_Menu_API.Add_Row" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Button"
param = "table[
$id = 'add_drones_button',
$col = 1,
$colSpan = 2,
$scaling = true,
$height = 25,
$onClick = add_drones,
$text = table[
$text = 'Добавить',
$color = 'Helper.color.white',
$halign = 'center'
]
]" />
<signal_cue_instantly
cue = "md.Simple_Menu_API.Make_Button"
param = "table[
$col = 3,
$colSpan = 2,
$scaling = true,
$height = 25,
$onClick = close_add_drones_menu,
$text = table[
$text = 'Отмена',
$color = 'Helper.color.white',
$halign = 'center'
]
]" />
</actions>
</cue>
<cue name="OnChange" instantiate="true">
<conditions>
<event_cue_signalled />
</conditions>
<actions>
<set_value name="Drone.$Sort.{event.param.$id}" exact="event.param.$value" />
</actions>
</cue>
<cue name="add_drones" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<add_units object="event.param.$object" category="unitcategory.transport" mk="1" exact="$cargo" />
<add_units object="$targetStation" category="unitcategory.defence" mk="1" exact="$defense" />
<add_units object="$targetStation" category="unitcategory.repair" mk="1" exact="$repair" />
<add_units object="$targetStation" category="unitcategory.build" mk="1" exact="$build" />
<signal_cue_instantly cue = "close_add_drones_menu" />
</actions>
</cue>
<cue name="close_add_drones_menu" instantiate="true">
<conditions>
<event_cue_signalled/>
</conditions>
<actions>
<signal_cue_instantly
cue = "md.Simple_Menu_API.Send_Command"
param = "table[
$command = 'Close_Menu'
]" />
</actions>
</cue>
</cues>
</mdscript>