Skip to content

Commit

Permalink
NanoUI Caching and SMES tweaks
Browse files Browse the repository at this point in the history
* Made NanoUI caching code neater, added check for directories (which are ignored).
* Moved SET to between MIN and MAX on SMES UI.
  • Loading branch information
Faerdan committed Jan 12, 2014
1 parent 214fbee commit c9191fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
29 changes: 12 additions & 17 deletions code/modules/nano/nanomanager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,18 @@
* @return nothing
*/

#define NANO_CSS_PATH "nano/css/"
#define NANO_IMAGES_PATH "nano/images/"
#define NANO_JS_PATH "nano/js/"
#define NANO_TEMPLATES_PATH "nano/templates/"

/datum/nanomanager/proc/send_resources(client)
var/list/css = flist(NANO_CSS_PATH)
var/list/images = flist(NANO_IMAGES_PATH)
var/list/js = flist(NANO_JS_PATH)
var/list/templates = flist(NANO_TEMPLATES_PATH)
var/list/nano_asset_dirs = list(\
"nano/css/",\
"nano/images/",\
"nano/js/",\
"nano/templates/"\
)

for(var/file in css)
client << browse_rsc(file(NANO_CSS_PATH + file))
for(var/file in images)
client << browse_rsc(file(NANO_IMAGES_PATH + file))
for(var/file in js)
client << browse_rsc(file(NANO_JS_PATH + file))
for(var/file in templates)
client << browse_rsc(file(NANO_TEMPLATES_PATH + file))
var/list/files = null
for (var/path in nano_asset_dirs)
files = flist(path)
for(var/file in files)
if(copytext(file, length(file)) != "/") // files which end in "/" are actually directories, which we want to ignore
client << browse_rsc(file(path + file)) // send the file to the client

4 changes: 2 additions & 2 deletions nano/templates/smes.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
{{:~displayBar(chargeLevel, 0, chargeMax)}}
<div style="clear: both; padding-top: 4px;">
{{:~link('MIN', null, {'input' : 'min'}, (chargeLevel > 0) ? null : 'disabled')}}
{{:~link('MAX', null, {'input' : 'max'}, (chargeLevel < chargeMax) ? null : 'disabled')}}
{{:~link('SET', null, {'input' : 'set'}, null)}}
{{:~link('MAX', null, {'input' : 'max'}, (chargeLevel < chargeMax) ? null : 'disabled')}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:chargeLevel}} W&nbsp;</div>
</div>
</div>
Expand All @@ -59,8 +59,8 @@
{{:~displayBar(outputLevel, 0, outputMax)}}
<div style="clear: both; padding-top: 4px;">
{{:~link('MIN', null, {'output' : 'min'}, (outputLevel > 0) ? null : 'disabled')}}
{{:~link('MAX', null, {'output' : 'max'}, (outputLevel < outputMax) ? null : 'disabled')}}
{{:~link('SET', null, {'output' : 'set'}, null)}}
{{:~link('MAX', null, {'output' : 'max'}, (outputLevel < outputMax) ? null : 'disabled')}}
<div style="float: left; width: 80px; text-align: center;">&nbsp;{{:outputLevel}} W&nbsp;</div>
</div>
</div>
Expand Down

0 comments on commit c9191fa

Please sign in to comment.