Skip to content

Commit

Permalink
improves fabricator interface
Browse files Browse the repository at this point in the history
  • Loading branch information
quardbreak committed Dec 31, 2021
1 parent e83fe02 commit b8cb208
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 121 deletions.
12 changes: 6 additions & 6 deletions code/modules/fabrication/fabricator_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
data["network"] = (D.network_id && D.network_tag)
data["category"] = show_category
data["functional"] = is_functioning()
data["filtering"] = filter_string || "No filter set."
data["filtering"] = filter_string || "No filter set"

if(is_functioning())
data["color_selectable"] = color_selectable
Expand All @@ -32,7 +32,7 @@
current_build["multiplier"] = currently_building.multiplier
current_build["progress"] = "[100-round((currently_building.remaining_time/currently_building.target_recipe.build_time)*100)]%"
else
current_build["name"] = "Nothing."
current_build["name"] = "Nothing"
current_build["multiplier"] = "-"
current_build["progress"] = "-"

Expand All @@ -46,7 +46,7 @@
data["build_queue"] += list(order_data)
else
var/list/order_data = list()
order_data["name"] = "Nothing."
order_data["name"] = "Nothing"
order_data["multiplier"] = "-"
data["build_queue"] += list(order_data)

Expand All @@ -64,7 +64,7 @@
build_option["reference"] = "\ref[R]"
build_option["illegal"] = R.hidden
if(!length(R.resources))
build_option["cost"] = "No resources required."
build_option["cost"] = "No resources required"
max_sheets = 100
else
//Make sure it's buildable and list required resources.
Expand All @@ -76,7 +76,7 @@
if(stored_material[material] < round(R.resources[material]*mat_efficiency))
build_option["unavailable"] = 1
material_components += "[round(R.resources[material] * mat_efficiency)][SHEET_UNIT] [stored_substances_to_names[material]]"
build_option["cost"] = "[capitalize(jointext(material_components, ", "))]."
build_option["cost"] = "[capitalize(jointext(material_components, ", "))]"
if(R.max_amount >= PRINT_MULTIPLIER_DIVISOR && max_sheets >= PRINT_MULTIPLIER_DIVISOR)
build_option["multiplier"] = list()
for(var/i = 1 to FLOOR(min(R.max_amount, max_sheets)/PRINT_MULTIPLIER_DIVISOR))
Expand All @@ -86,7 +86,7 @@

ui = SSnano.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "fabricator.tmpl", "[capitalize(name)]", 480, 410, state = state)
ui = new(user, src, ui_key, "fabricator.tmpl", "[capitalize(name)]", 680, 480, state = state)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
Expand Down
249 changes: 134 additions & 115 deletions nano/templates/fabricator.tmpl
Original file line number Diff line number Diff line change
@@ -1,130 +1,149 @@
{{if data.functional}}
<table width = '100%'>
{{if data.color_selectable}}
<table>
<tr>
<td>
<font color = {{:data.color}}>Color</font>
</td>
<td>
{{:helper.link('(Set)', null, {'color_select' : 1})}}
</td>
{{if data.network}}
<td>
<div style="float: left">Connected to local network:</div>
<div style="float: right">{{:helper.link(data.network, null, { 'settings': 1 }, null)}}</div>
</td>
{{/if}}
{{if data.color_selectable}}
<td>
<div style="float: left"><font color="{{:data.color}}">Color:</font></div>
<div style="float: right">{{:helper.link('(Set)', null, {'color_select' : 1})}}</div>
</td>
{{/if}}
</tr>
{{/if}}
{{if data.network}}
<tr>
<td>
Connected to local network.
</td>
{{:helper.link(data.network, null, { 'settings': 1 }, null)}}
</td>
<td>
</tr>
{{/if}}
<tr>
<td colspan = 2>
<table width = '85%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Resource</b></th>
<th><b>Storage</b></th>
<th><b>Options</b></th>
</tr>
{{for data.material_storage}}
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.name}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.stored}}/{{:value.max}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:helper.link(value.eject_label, null, {'eject_mat' : value.eject_key})}}</td>
</tr>
{{/for}}
</table>
</td>
</tr>
<tr>
<td width = '50%' style = 'vertical-align: top;'>
<table width = '100%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Current Build</b></th>
<th><b>Units</b></th>
<th><b>Progress</b></th>
</tr>
<td style="vertical-align: top">
<table width="100%">
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.name}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.multiplier}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.progress}}</td>
</tr>
</table>
</td>
<td width = '50%'>
<table width = '85%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Pending</b></th>
<th><b>Units</b></th>
<th><b>Options</b></th>
</tr>
{{for data.build_queue}}
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.name}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.multiplier}}</td>
{{if value.reference}}
<td align = 'center' style = 'border:1px solid #777777;'>{{:helper.link('Cancel', null, {'cancel' : value.reference})}}</td>
{{else}}
<td align = 'center' style = 'border:1px solid #777777;'>-</td>
{{/if}}
<td colspan = 2>
<table width = '100%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Resource</b></th>
<th><b>Storage</b></th>
<th><b>Options</b></th>
</tr>
{{for data.material_storage}}
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>
<div style="display: inline-block;">
{{:value.name}}
</div>
</td>
<td align = 'center' style = 'border:1px solid #777777;'>
<div style="display: inline-block;">
{{:value.stored}}/{{:value.max}}
</div>
</td>
<td align = 'center' style = 'border:1px solid #777777;'>
<div style="display: inline-block;">
{{:helper.link(value.eject_label, null, {'eject_mat' : value.eject_key})}}
</div>
</td>
</tr>
{{/for}}
</table>
</td>
</tr>
{{/for}}
</table>
</td>
</tr>
<tr><td colspan = 2 align = 'center'>
<tr><td colspan = 2 align = 'center'>

<div class="item">
<div class="itemLabel">
Category
</div>
<div class="itemContent">
{{:helper.link(data.category, null, {'change_category' : 1})}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Category
</div>
<div class="itemContent">
{{:helper.link(data.category, null, {'change_category' : 1})}}
</div>
</div>

<div class="item">
<div class="itemLabel">
Filter
</div>
<div class="itemContent">
{{:helper.link(data.filtering, null, {'set_filter' : 1})}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Filter
</div>
<div class="itemContent">
{{:helper.link(data.filtering, null, {'set_filter' : 1})}}
</div>
</div>

</td></tr>
<tr>
<td colspan = 2>
<table width = '100%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Design</b></th>
<th><b>Cost</b></th>
<th><b>Options</b></th>
</tr>
{{for data.build_options}}
</td></tr>
<tr>
{{if value.illegal}}
<td align = 'center' style = 'border:1px solid #999999;'><span class = 'bad'>{{:value.name}}</span></td>
{{else}}
<td align = 'center' style = 'border:1px solid #999999;'>{{:value.name}}</td>
{{/if}}
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.cost}}</td>
<td align = 'center' style = 'border:1px solid #999999;'>
{{if !value.unavailable}}
{{:helper.link('Queue', null, {'make' : value.reference, 'multiplier' : 1})}}
{{for value.multiplier :multValue:multIndex}}
{{:helper.link(multValue.label, null, {'make' : value.reference, 'multiplier' : multValue.multiplier})}}
{{/for}}
{{else}}
Insufficient resources.
{{/if}}
<td colspan = 2>
<table width = '100%' style = 'border:1px solid #333333;'>
<tr>
<th><b>Design</b></th>
<th><b>Cost</b></th>
<th><b>Options</b></th>
</tr>
{{for data.build_options}}
<tr>
{{if value.illegal}}
<td align = 'center' style = 'border:1px solid #999999;'>
<span class = 'bad'>
{{:value.name}}
</span>
</td>
{{else}}
<td align = 'center' style = 'border:1px solid #999999;'>
{{:value.name}}
</td>
{{/if}}
<td align = 'center' style = 'border:1px solid #777777;'>
{{:value.cost}}
</td>
<td align = 'center' style = 'border:1px solid #999999;'>
{{if !value.unavailable}}
<div style="display: inline-block">
{{:helper.link('Queue', null, {'make' : value.reference, 'multiplier' : 1})}}
</div>
{{for value.multiplier :multValue:multIndex}}
<div style="display: inline-block">
{{:helper.link(multValue.label, null, {'make' : value.reference, 'multiplier' : multValue.multiplier})}}
</div>
{{/for}}
{{else}}
Insufficient resources.
{{/if}}
</td>
</tr>
{{/for}}
</table>
</td>
</tr>
{{/for}}
</table>
</td>
</table>
</td>
<td style="vertical-align: top">
<table width = '100%' style = 'border:1px solid #333333; margin: 3px 0;'>
<tr>
<th><b>Current Build</b></th>
<th><b>Units</b></th>
<th><b>Progress</b></th>
</tr>
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.name}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.multiplier}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:data.current_build.progress}}</td>
</tr>
</table>
<table width = '100%' style = 'border:1px solid #333333; margin: 10px 0;'>
<tr>
<th><b>Pending</b></th>
<th><b>Units</b></th>
<th><b>Options</b></th>
</tr>
{{for data.build_queue}}
<tr>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.name}}</td>
<td align = 'center' style = 'border:1px solid #777777;'>{{:value.multiplier}}</td>
{{if value.reference}}
<td align = 'center' style = 'border:1px solid #777777;'>{{:helper.link('Cancel', null, {'cancel' : value.reference})}}</td>
{{else}}
<td align = 'center' style = 'border:1px solid #777777;'>-</td>
{{/if}}
</tr>
{{/for}}
</table>
</tr>
</table>
{{else}}
Expand Down

0 comments on commit b8cb208

Please sign in to comment.