From e80f19c901aff765963bf7a28fdf4652aeb79630 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Sat, 2 Jan 2021 23:58:06 +0100
Subject: [PATCH] [MIRROR] tgui: Auxiliary Base Management Console (#2453)
* tgui: Auxiliary Base Management Console
* rebuild tgui
Co-authored-by: Jordan Brown "+e+"
"
- if(M)
- var/destination_found
- for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
- if(!options.Find(S.id))
- continue
- if(!M.check_dock(S, silent=TRUE))
- continue
- destination_found = 1
- dat += "Send to [S.name]
"
- if(!destination_found && is_station_level(z)) //Only available if miners are lazy and did not set an LZ using the remote.
- dat += "Prepare for blind drop? (Dangerous)
"
+ data["type"] = shuttleId == "colony_drop" ? "base" : "shuttle"
+ data["docked_location"] = M ? M.get_status_text_tgui() : "Unknown"
+ data["locations"] = list()
+ data["locked"] = FALSE
+ data["timer_str"] = M ? M.getTimerStr() : "00:00"
+ data["destination"] = destination
+ data["blind_drop"] = blind_drop_ready
+ data["turrets"] = list()
if(LAZYLEN(turrets))
- dat += "
Perimeter Defense System: Enable All / Disable All
\
- Units connected: [LAZYLEN(turrets)]
\
- Unit | Condition | Status | Direction | Distance
"
- for(var/PDT in turrets)
- var/obj/machinery/porta_turret/aux_base/T = PDT
- var/integrity = max((T.obj_integrity-T.integrity_failure * T.max_integrity)/(T.max_integrity-T.integrity_failure * max_integrity)*100, 0)
- var/status
- if(T.machine_stat & BROKEN)
- status = "ERROR"
- else if(!T.on)
- status = "Disabled"
- else if(T.raised)
- status = "Firing"
+ for(var/turret in turrets)
+ var/obj/machinery/porta_turret/aux_base/base_turret = turret
+ var/turret_integrity = max((base_turret.obj_integrity - base_turret.integrity_failure * base_turret.max_integrity) / (base_turret.max_integrity - base_turret.integrity_failure * max_integrity) * 100, 0)
+ var/turret_status
+ if(base_turret.machine_stat & BROKEN)
+ turret_status = "ERROR"
+ else if(!base_turret.on)
+ turret_status = "Disabled"
+ else if(base_turret.raised)
+ turret_status = "Firing"
else
- status = "All Clear"
- dat += "[T.name] | [integrity]% | [status] | [dir2text(get_dir(src, T))] | [get_dist(src, T)]m Toggle Power
"
+ turret_status = "All Clear"
+ var/list/turret_data = list(
+ name = base_turret.name,
+ integrity = turret_integrity,
+ status = turret_status,
+ direction = dir2text(get_dir(src, base_turret)),
+ distance = get_dist(src, base_turret),
+ ref = REF(base_turret)
+ )
+ data["turrets"] += list(turret_data)
+ if(!M)
+ data["status"] = "Missing"
+ return data
+ switch(M.mode)
+ if(SHUTTLE_IGNITING)
+ data["status"] = "Igniting"
+ if(SHUTTLE_IDLE)
+ data["status"] = "Idle"
+ if(SHUTTLE_RECHARGING)
+ data["status"] = "Recharging"
+ else
+ data["status"] = "In Transit"
+ for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
+ if(!options.Find(S.port_destinations))
+ continue
+ if(!M.check_dock(S, silent = TRUE))
+ continue
+ var/list/location_data = list(
+ id = S.id,
+ name = S.name
+ )
+ data["locations"] += list(location_data)
+ if(length(data["locations"]) == 1)
+ for(var/location in data["locations"])
+ destination = location["id"]
+ data["destination"] = destination
+ if(!length(data["locations"]))
+ data["locked"] = TRUE
+ data["status"] = "Locked"
+ return data
+/**
+ * Checks if we are allowed to launch the base
+ *
+ * Arguments:
+ * * user - The mob trying to initiate the launch
+ */
+/obj/machinery/computer/auxiliary_base/proc/launch_check(mob/user)
+ if(!is_station_level(z) && shuttleId == "colony_drop")
+ to_chat(user, "You can't move the base again!")
+ return FALSE
+ return TRUE
- dat += "Close"
-
- var/datum/browser/popup = new(user, "computer", "base management", 550, 300) //width, height
- popup.set_content("
+
+ )}
+
/gi,"\n").replace(/<\/?[a-z0-9-_]+[^>]*>/gi,"").replace(/&(nbsp|amp|quot|lt|gt|apos);/g,(function(e,n){return t[n]})).replace(/?([0-9]+);/gi,(function(e,t){var n=parseInt(t,10);return String.fromCharCode(n)})).replace(/?([0-9a-f]+);/gi,(function(e,t){var n=parseInt(t,16);return String.fromCharCode(n)}))};t.buildQueryString=function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}},function(e,t,n){"use strict";t.__esModule=!0,t.Box=t.computeBoxClassName=t.computeBoxProps=t.halfUnit=t.unit=void 0;var r=n(6),o=n(0),i=n(467),a=n(42);var u=function(e){return"string"==typeof e?e.endsWith("px")&&!Byond.IS_LTE_IE8?parseFloat(e)/12+"rem":e:"number"==typeof e?Byond.IS_LTE_IE8?12*e+"px":e+"rem":void 0};t.unit=u;var c=function(e){return"string"==typeof e?u(e):"number"==typeof e?u(.5*e):void 0};t.halfUnit=c;var s=function(e){return"string"==typeof e&&a.CSS_COLORS.includes(e)},l=function(e){return function(t,n){"number"!=typeof n&&"string"!=typeof n||(t[e]=n)}},f=function(e,t){return function(n,r){"number"!=typeof r&&"string"!=typeof r||(n[e]=t(r))}},d=function(e,t){return function(n,r){r&&(n[e]=t)}},p=function(e,t,n){return function(r,o){if("number"==typeof o||"string"==typeof o)for(var i=0;ic||n!=n?l*Infinity:l*n}},function(e,t,n){"use strict";var r=n(4),o=Math.hypot,i=Math.abs,a=Math.sqrt;r({target:"Math",stat:!0,forced:!!o&&o(Infinity,NaN)!==Infinity},{hypot:function(e,t){for(var n,r,o=0,u=0,c=arguments.length,s=0;u
\n":"'+(n?e:ee(e,!0))+"
\n"}return e}(),t.blockquote=function(){function e(e){return""+(n?e:ee(e,!0))+"\n"+e+"
\n"}return e}(),t.html=function(){function e(e){return e}return e}(),t.heading=function(){function e(e,t,n,r){return this.options.headerIds?"
\n":"
\n"}return e}(),t.list=function(){function e(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"}return e}(),t.listitem=function(){function e(e){return"\n\n"+e+"\n"+t+"
\n"}return e}(),t.tablerow=function(){function e(e){return"\n"+e+" \n"}return e}(),t.tablecell=function(){function e(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"}return e}(),t.strong=function(){function e(e){return""+e+""}return e}(),t.em=function(){function e(e){return""+e+""}return e}(),t.codespan=function(){function e(e){return""+e+""}return e}(),t.br=function(){function e(){return this.options.xhtml?"
":"
"}return e}(),t.del=function(){function e(e){return""+e+""}return e}(),t.link=function(){function e(e,t,n){if(null===(e=J(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"+n+""}return e}(),t.image=function(){function e(e,t,n){if(null===(e=J(this.options.sanitize,this.options.baseUrl,e)))return n;var r='":">"}return e}(),t.text=function(){function e(e){return e}return e}(),e}(),ne=function(){function e(){}var t=e.prototype;return t.strong=function(){function e(e){return e}return e}(),t.em=function(){function e(e){return e}return e}(),t.codespan=function(){function e(e){return e}return e}(),t.del=function(){function e(e){return e}return e}(),t.html=function(){function e(e){return e}return e}(),t.text=function(){function e(e){return e}return e}(),t.link=function(){function e(e,t,n){return""+n}return e}(),t.image=function(){function e(e,t,n){return""+n}return e}(),t.br=function(){function e(){return""}return e}(),e}(),re=function(){function e(){this.seen={}}return e.prototype.slug=function(){function e(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t}return e}(),e}(),oe=a.defaults,ie=I.unescape,ae=function(){function e(e){this.options=e||oe,this.options.renderer=this.options.renderer||new te,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ne,this.slugger=new re}e.parse=function(){function t(t,n){return new e(n).parse(t)}return t}();var t=e.prototype;return t.parse=function(){function e(e,t){void 0===t&&(t=!0);var n,r,o,i,a,u,c,s,l,f,d,p,h,g,v,m,y,b,x="",w=e.length;for(n=0;n
"+se(c.message+"",!0)+"";throw c}}return pe.options=pe.setOptions=function(e){return ue(pe.defaults,e),fe(pe.defaults),pe},pe.getDefaults=le,pe.defaults=de,pe.use=function(e){var t=ue({},e);if(e.renderer&&function(){var n=pe.defaults.renderer||new te,r=function(){function t(t){var r=n[t];n[t]=function(){for(var o=arguments.length,i=new Array(o),a=0;a
'+(n?e:ee(e,!0))+"\n":""+(n?e:ee(e,!0))+"\n"}return e}(),t.blockquote=function(){function e(e){return"\n"+e+"\n"}return e}(),t.html=function(){function e(e){return e}return e}(),t.heading=function(){function e(e,t,n,r){return this.options.headerIds?"
"+e+"
\n"}return e}(),t.table=function(){function e(e,t){return t&&(t=""+t+""),""+e+""}return e}(),t.br=function(){function e(){return this.options.xhtml?""+se(c.message+"",!0)+"";throw c}}return pe.options=pe.setOptions=function(e){return ue(pe.defaults,e),fe(pe.defaults),pe},pe.getDefaults=le,pe.defaults=de,pe.use=function(e){var t=ue({},e);if(e.renderer&&function(){var n=pe.defaults.renderer||new te,r=function(){function t(t){var r=n[t];n[t]=function(){for(var o=arguments.length,i=new Array(o),a=0;a