mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
Allow relabeling any canister; port MULEbot to tgui
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
/atom/proc/attack_hand(mob/user)
|
||||
return
|
||||
|
||||
/atom/proc/interact(mob/user)
|
||||
return
|
||||
|
||||
/*
|
||||
/mob/living/carbon/human/RestrainedClickOn(var/atom/A) ---carbons will handle this
|
||||
return
|
||||
|
||||
@@ -13,18 +13,6 @@ var/const/WIRE_REMOTE_RX = 64 // remote recv functions
|
||||
var/const/WIRE_REMOTE_TX = 128 // remote trans status
|
||||
var/const/WIRE_BEACON_RX = 256 // beacon ping recv
|
||||
|
||||
/datum/wires/mulebot/CanUse(mob/living/L)
|
||||
var/mob/living/simple_animal/bot/mulebot/M = holder
|
||||
if(M.open)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
// So the wires do not open a new window, handle the interaction ourselves.
|
||||
/datum/wires/mulebot/Interact(mob/living/user)
|
||||
if(CanUse(user))
|
||||
var/mob/living/simple_animal/bot/mulebot/M = holder
|
||||
M.update_controls()
|
||||
|
||||
/datum/wires/mulebot/UpdatePulsed(index)
|
||||
switch(index)
|
||||
if(WIRE_POWER1, WIRE_POWER2)
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
var/valve_open = 0
|
||||
var/release_pressure = ONE_ATMOSPHERE
|
||||
var/canister_color = "yellow"
|
||||
var/can_label = 1
|
||||
var/filled = 0.5
|
||||
pressure_resistance = 7*ONE_ATMOSPHERE
|
||||
var/temperature_resistance = 1000 + T0C
|
||||
@@ -37,42 +36,36 @@
|
||||
desc = "Nitrous oxide gas. Known to cause drowsiness."
|
||||
icon_state = "redws"
|
||||
canister_color = "redws"
|
||||
can_label = 0
|
||||
gas_type = "n2o"
|
||||
/obj/machinery/portable_atmospherics/canister/nitrogen
|
||||
name = "n2 canister"
|
||||
desc = "Nitrogen gas. Reportedly useful for something."
|
||||
icon_state = "red"
|
||||
canister_color = "red"
|
||||
can_label = 0
|
||||
gas_type = "n2"
|
||||
/obj/machinery/portable_atmospherics/canister/oxygen
|
||||
name = "o2 canister"
|
||||
desc = "Oxygen. Necessary for human life."
|
||||
icon_state = "blue"
|
||||
canister_color = "blue"
|
||||
can_label = 0
|
||||
gas_type = "o2"
|
||||
/obj/machinery/portable_atmospherics/canister/toxins
|
||||
name = "plasma canister"
|
||||
desc = "Plasma gas. The reason YOU are here. Highly toxic."
|
||||
icon_state = "orange"
|
||||
canister_color = "orange"
|
||||
can_label = 0
|
||||
gas_type = "plasma"
|
||||
/obj/machinery/portable_atmospherics/canister/carbon_dioxide
|
||||
name = "co2 canister"
|
||||
desc = "Carbon dioxide. What the fuck is carbon dioxide?"
|
||||
icon_state = "black"
|
||||
canister_color = "black"
|
||||
can_label = 0
|
||||
gas_type = "co2"
|
||||
/obj/machinery/portable_atmospherics/canister/air
|
||||
name = "air canister"
|
||||
desc = "Pre-mixed air."
|
||||
icon_state = "grey"
|
||||
canister_color = "grey"
|
||||
can_label = 0
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/proc/check_change()
|
||||
var/old_flag = update_flag
|
||||
@@ -193,13 +186,7 @@ update_flag
|
||||
else
|
||||
loc.assume_air(removed)
|
||||
air_update_turf()
|
||||
src.update_icon()
|
||||
|
||||
|
||||
if(air_contents.return_pressure() < 1)
|
||||
can_label = 1
|
||||
else
|
||||
can_label = 0
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/process()
|
||||
src.updateDialog()
|
||||
@@ -290,13 +277,12 @@ update_flag
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "canister", name, 405, 405, master_ui, state)
|
||||
ui = new(user, src, ui_key, "canister", name, 415, 405, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/get_ui_data()
|
||||
var/data = list()
|
||||
data["name"] = name
|
||||
data["canLabel"] = can_label ? 1 : 0
|
||||
data["portConnected"] = connected_port ? 1 : 0
|
||||
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["releasePressure"] = round(release_pressure ? release_pressure : 0)
|
||||
@@ -318,12 +304,13 @@ update_flag
|
||||
|
||||
switch(action)
|
||||
if("relabel")
|
||||
if(can_label)
|
||||
var/label = input("Label canister:", "Gas Canister") as null|anything in label2types
|
||||
var/newtype = label2types[label]
|
||||
if(newtype)
|
||||
new newtype (loc, 0)
|
||||
qdel(src)
|
||||
var/label = input("Label canister:", "Gas Canister") as null|anything in label2types
|
||||
var/newtype = label2types[label]
|
||||
if(newtype)
|
||||
var/obj/machinery/portable_atmospherics/canister/replacement = new newtype(loc)
|
||||
replacement.air_contents = air_contents
|
||||
replacement.ui_interact(usr)
|
||||
qdel(src)
|
||||
if("pressure")
|
||||
switch(params["pressure"])
|
||||
if("custom")
|
||||
@@ -368,12 +355,10 @@ update_flag
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/machinery/portable_atmospherics/canister/New(loc, fill = 1)
|
||||
/obj/machinery/portable_atmospherics/canister/New(loc)
|
||||
..()
|
||||
|
||||
if(fill)
|
||||
create_gas()
|
||||
|
||||
create_gas()
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
@@ -98,8 +98,6 @@
|
||||
if(ui_interact(user) != -1)
|
||||
return
|
||||
..()
|
||||
/obj/proc/interact(mob/user)
|
||||
return
|
||||
|
||||
/obj/proc/container_resist()
|
||||
return
|
||||
|
||||
@@ -86,7 +86,8 @@
|
||||
return "<span class='average'>[mode_name[mode]]</span>"
|
||||
|
||||
/mob/living/simple_animal/bot/proc/turn_on()
|
||||
if(stat) return 0
|
||||
if(stat)
|
||||
return 0
|
||||
on = 1
|
||||
SetLuminosity(initial(luminosity))
|
||||
update_icon()
|
||||
@@ -202,20 +203,20 @@
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
if(!locked)
|
||||
open = !open
|
||||
user << "<span class='notice'>Maintenance panel is now [open ? "opened" : "closed"].</span>"
|
||||
user << "<span class='notice'>The maintenance panel is now [open ? "opened" : "closed"].</span>"
|
||||
else
|
||||
user << "<span class='warning'>Maintenance panel is locked.</span>"
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
user << "<span class='warning'>The maintenance panel is locked.</span>"
|
||||
else if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(bot_core.allowed(user) && !open && !emagged)
|
||||
locked = !locked
|
||||
user << "Controls are now [locked ? "locked." : "unlocked."]"
|
||||
else
|
||||
if(emagged)
|
||||
user << "<span class='warning'>ERROR</span>"
|
||||
user << "<span class='danger'>ERROR</span>"
|
||||
if(open)
|
||||
user << "<span class='danger'>Please close the access panel before locking it.</span>"
|
||||
user << "<span class='warning'>Please close the access panel before locking it.</span>"
|
||||
else
|
||||
user << "<span class='danger'>Access denied.</span>"
|
||||
user << "<span class='warning'>Access denied.</span>"
|
||||
else
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent != "harm")
|
||||
|
||||
@@ -28,10 +28,6 @@ var/global/mulebot_count = 0
|
||||
bot_type = MULE_BOT
|
||||
model = "MULE"
|
||||
bot_core_type = /obj/machinery/bot_core/mulebot
|
||||
window_id = "mulebot"
|
||||
window_name = "M.U.L.E. Mk. V"
|
||||
window_width = 350
|
||||
window_height = 600
|
||||
|
||||
suffix = ""
|
||||
|
||||
@@ -40,7 +36,7 @@ var/global/mulebot_count = 0
|
||||
var/turf/target // this is turf to navigate to (location of beacon)
|
||||
var/loaddir = 0 // this the direction to unload onto/load from
|
||||
var/home_destination = "" // tag of home beacon
|
||||
|
||||
|
||||
var/reached_target = 1 //true if already reached the target
|
||||
|
||||
var/auto_return = 1 // true if auto return to home beacon after unload
|
||||
@@ -49,9 +45,7 @@ var/global/mulebot_count = 0
|
||||
|
||||
var/obj/item/weapon/stock_parts/cell/cell
|
||||
var/datum/wires/mulebot/wires = null
|
||||
// the installed power cell
|
||||
|
||||
var/bloodiness = 0 // count of bloodiness
|
||||
var/bloodiness = 0
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/New()
|
||||
..()
|
||||
@@ -63,11 +57,10 @@ var/global/mulebot_count = 0
|
||||
cell.charge = 2000
|
||||
cell.maxcharge = 2000
|
||||
|
||||
spawn(5) // must wait for map loading to finish
|
||||
spawn(10) // must wait for map loading to finish
|
||||
mulebot_count += 1
|
||||
if(!suffix)
|
||||
suffix = "#[mulebot_count]"
|
||||
name = "\improper Mulebot ([suffix])"
|
||||
set_suffix("#[mulebot_count]")
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/Destroy()
|
||||
unload(0)
|
||||
@@ -75,48 +68,47 @@ var/global/mulebot_count = 0
|
||||
wires = null
|
||||
return ..()
|
||||
|
||||
mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
/mob/living/simple_animal/bot/mulebot/proc/set_suffix(suffix)
|
||||
src.suffix = suffix
|
||||
name = "\improper MULEbot ([suffix])"
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
..()
|
||||
reached_target = 0
|
||||
|
||||
// attack by item
|
||||
// emag : lock/unlock,
|
||||
// screwdriver: open/close hatch
|
||||
// cell: insert it
|
||||
// other: chance to knock rider off bot
|
||||
/mob/living/simple_animal/bot/mulebot/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I,/obj/item/weapon/stock_parts/cell) && open && !cell)
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
..()
|
||||
if(open)
|
||||
on = FALSE
|
||||
icon_state="mulebot-hatch"
|
||||
else
|
||||
icon_state = "mulebot0"
|
||||
else if(istype(I,/obj/item/weapon/stock_parts/cell) && open && !cell)
|
||||
if(!user.drop_item())
|
||||
return
|
||||
var/obj/item/weapon/stock_parts/cell/C = I
|
||||
C.loc = src
|
||||
cell = C
|
||||
update_controls()
|
||||
else if(istype(I,/obj/item/weapon/screwdriver))
|
||||
if(locked)
|
||||
user << "<span class='warning'>The maintenance hatch cannot be opened or closed while the controls are locked!</span>"
|
||||
return
|
||||
|
||||
open = !open
|
||||
if(open)
|
||||
visible_message("[user] opens the maintenance hatch of [src]", "<span class='notice'>You open [src]'s maintenance hatch.</span>")
|
||||
on = 0
|
||||
icon_state="mulebot-hatch"
|
||||
visible_message("[user] inserts a cell into [src].",
|
||||
"<span class='notice'>You insert the new cell into [src].</span>")
|
||||
else if(istype(I, /obj/item/weapon/crowbar) && open && cell)
|
||||
cell.add_fingerprint(usr)
|
||||
cell.loc = loc
|
||||
cell = null
|
||||
visible_message("[user] crowbars out the power cell from [src].",
|
||||
"<span class='notice'>You pry the powercell out of [src].</span>")
|
||||
else if(wires.IsInteractionTool(I) && open)
|
||||
return attack_hand(user)
|
||||
else if(load && ismob(load)) // chance to knock off rider
|
||||
if(prob(1 + I.force * 2))
|
||||
unload(0)
|
||||
user.visible_message("<span class='danger'>[user] knocks [load] off [src] with \the [I]!</span>",
|
||||
"<span class='danger'>You knock [load] off [src] with \the [I]!</span>")
|
||||
else
|
||||
visible_message("[user] closes the maintenance hatch of [src]", "<span class='notice'>You close [src]'s maintenance hatch.</span>")
|
||||
icon_state = "mulebot0"
|
||||
|
||||
update_controls()
|
||||
else if(istype(I, /obj/item/device/multitool) || istype(I, /obj/item/weapon/wirecutters))
|
||||
if(open)
|
||||
attack_hand(usr)
|
||||
user << "<span class='warning'>You hit [src] with \the [I] but to no effect!</span>"
|
||||
..()
|
||||
else
|
||||
if(load && ismob(load)) // chance to knock off rider
|
||||
if(prob(1+I.force * 2))
|
||||
unload(0)
|
||||
user.visible_message("<span class='danger'>[user] knocks [load] off [src] with \the [I]!</span>", "<span class='danger'>You knock [load] off [src] with \the [I]!</span>")
|
||||
else
|
||||
user << "<span class='warning'>You hit [src] with \the [I] but to no effect!</span>"
|
||||
..()
|
||||
return
|
||||
|
||||
@@ -127,7 +119,6 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
playsound(loc, 'sound/effects/sparks1.ogg', 100, 0)
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/update_icon()
|
||||
//UNFINISHED
|
||||
switch(mode)
|
||||
if(BOT_IDLE)
|
||||
icon_state = "mulebot0"
|
||||
@@ -163,133 +154,66 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
visible_message("<span class='danger'>Something shorts out inside [src]!</span>")
|
||||
wires.RandomCut()
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/attack_hand(mob/user)
|
||||
interact(user)
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/attack_ai(mob/user)
|
||||
show_controls(user)
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/get_controls(mob/user)
|
||||
var/ai = issilicon(user)
|
||||
var/dat
|
||||
dat += "<h3>Multiple Utility Load Effector Mk. V</h3>"
|
||||
dat += "<b>ID:</b> [suffix]<BR>"
|
||||
dat += "<b>Power:</b> [on ? "On" : "Off"]<BR>"
|
||||
|
||||
if(!open)
|
||||
|
||||
dat += "<h3>Status</h3>"
|
||||
|
||||
dat += "<div class='statusDisplay'>"
|
||||
switch(mode)
|
||||
if(BOT_IDLE)
|
||||
dat += "<span class='good'>Ready</span>"
|
||||
if(BOT_DELIVER)
|
||||
dat += "<span class='good'>[mode_name[BOT_DELIVER]]</span>"
|
||||
if(BOT_GO_HOME)
|
||||
dat += "<span class='good'>[mode_name[BOT_GO_HOME]]</span>"
|
||||
if(BOT_BLOCKED)
|
||||
dat += "<span class='average'>[mode_name[BOT_BLOCKED]]</span>"
|
||||
if(BOT_NAV,BOT_WAIT_FOR_NAV)
|
||||
dat += "<span class='average'>[mode_name[BOT_NAV]]</span>"
|
||||
if(BOT_NO_ROUTE)
|
||||
dat += "<span class='bad'>[mode_name[BOT_NO_ROUTE]]</span>"
|
||||
dat += "</div>"
|
||||
|
||||
dat += "<b>Current Load:</b> [load ? load.name : "<i>none</i>"]<BR>"
|
||||
dat += "<b>Destination:</b> [!destination ? "<i>none</i>" : destination]<BR>"
|
||||
dat += "<b>Power level:</b> [cell ? cell.percent() : 0]%"
|
||||
|
||||
if(locked && !ai && !IsAdminGhost(user))
|
||||
dat += " <br /><div class='notice'>Controls are locked</div><A href='byond://?src=\ref[src];op=unlock'>Unlock Controls</A>"
|
||||
else
|
||||
dat += " <br /><div class='notice'>Controls are unlocked</div><A href='byond://?src=\ref[src];op=lock'>Lock Controls</A><BR><BR>"
|
||||
|
||||
dat += "<A href='byond://?src=\ref[src];op=power'>Toggle Power</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=stop'>Stop</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=go'>Proceed</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=home'>Return to Home</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=destination'>Set Destination</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=setid'>Set Bot ID</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=sethome'>Set Home</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autoret'>Toggle Auto Return Home</A> ([auto_return ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autopick'>Toggle Auto Pickup Crate</A> ([auto_pickup ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=report'>Toggle Delivery Reporting</A> ([report_delivery ? "On" : "Off"])<BR>"
|
||||
if(load)
|
||||
dat += "<A href='byond://?src=\ref[src];op=unload'>Unload Now</A><BR>"
|
||||
dat += "<div class='notice'>The maintenance hatch is closed.</div>"
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/interact(mob/user)
|
||||
if(open && !istype(user, /mob/living/silicon/ai))
|
||||
wires.Interact(user)
|
||||
else
|
||||
if(!ai)
|
||||
dat += "<div class='notice'>The maintenance hatch is open.</div><BR>"
|
||||
dat += "<b>Power cell:</b> "
|
||||
if(cell)
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellremove'>Installed</A><BR>"
|
||||
else
|
||||
dat += "<A href='byond://?src=\ref[src];op=cellinsert'>Removed</A><BR>"
|
||||
ui_interact(user)
|
||||
|
||||
dat += wires()
|
||||
/mob/living/simple_animal/bot/mulebot/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "mulebot", name, 600, 375, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/get_ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["on"] = on
|
||||
data["locked"] = locked
|
||||
data["siliconUser"] = user.has_unlimited_silicon_privilege
|
||||
data["mode"] = mode ? mode_name[mode] : "Ready"
|
||||
data["modeStatus"] = ""
|
||||
switch(mode)
|
||||
if(BOT_IDLE, BOT_DELIVER, BOT_GO_HOME)
|
||||
data["modeStatus"] = "good"
|
||||
if(BOT_BLOCKED, BOT_NAV, BOT_WAIT_FOR_NAV)
|
||||
data["modeStatus"] = "average"
|
||||
if(BOT_NO_ROUTE)
|
||||
data["modeStatus"] = "bad"
|
||||
else
|
||||
dat += "<div class='notice'>The bot is in maintenance mode and cannot be controlled.</div><BR>"
|
||||
data["load"] = load ? load.name : null
|
||||
data["destination"] = destination ? destination : null
|
||||
data["cell"] = cell ? TRUE : FALSE
|
||||
data["cellPercent"] = cell ? cell.percent() : null
|
||||
data["autoReturn"] = auto_return
|
||||
data["autoPickup"] = auto_pickup
|
||||
data["reportDelivery"] = report_delivery
|
||||
return data
|
||||
|
||||
return dat
|
||||
|
||||
// returns the wire panel text
|
||||
/mob/living/simple_animal/bot/mulebot/proc/wires()
|
||||
return wires.GetInteractWindow()
|
||||
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/Topic(href, href_list)
|
||||
if(..())
|
||||
/mob/living/simple_animal/bot/mulebot/ui_act(action, params)
|
||||
if(locked && !usr.has_unlimited_silicon_privilege)
|
||||
return
|
||||
if (usr.stat)
|
||||
return
|
||||
if ((in_range(src, usr) && istype(loc, /turf)) || (istype(usr, /mob/living/silicon)) || IsAdminGhost(usr))
|
||||
switch(href_list["op"])
|
||||
|
||||
if("lock", "unlock")
|
||||
switch(action)
|
||||
if("lock")
|
||||
if(usr.has_unlimited_silicon_privilege)
|
||||
locked = !locked
|
||||
update_controls()
|
||||
|
||||
if("power")
|
||||
if (on)
|
||||
turn_off()
|
||||
else if (cell && !open)
|
||||
if (!turn_on())
|
||||
usr << "<span class='warning'>You can't switch on [src]!</span>"
|
||||
return
|
||||
else
|
||||
if("power")
|
||||
if(on)
|
||||
turn_off()
|
||||
else if(cell && !open)
|
||||
if(!turn_on())
|
||||
usr << "<span class='warning'>You can't switch on [src]!</span>"
|
||||
return
|
||||
visible_message("[usr] switches [on ? "on" : "off"] [src].")
|
||||
update_controls()
|
||||
else
|
||||
bot_control(action, usr)
|
||||
return 1
|
||||
|
||||
|
||||
if("cellremove")
|
||||
if(open && cell && !usr.get_active_hand())
|
||||
cell.updateicon()
|
||||
usr.put_in_active_hand(cell)
|
||||
cell.add_fingerprint(usr)
|
||||
cell = null
|
||||
|
||||
usr.visible_message("[usr] removes the power cell from [src].", "<span class='notice'>You remove the power cell from [src].</span>")
|
||||
update_controls()
|
||||
|
||||
if("cellinsert")
|
||||
if(open && !cell)
|
||||
var/obj/item/weapon/stock_parts/cell/C = usr.get_active_hand()
|
||||
if(istype(C))
|
||||
if(!usr.drop_item())
|
||||
return
|
||||
cell = C
|
||||
C.loc = src
|
||||
C.add_fingerprint(usr)
|
||||
|
||||
usr.visible_message("[usr] inserts a power cell into [src].", "<span class='notice'>You insert the power cell into [src].</span>")
|
||||
update_controls()
|
||||
else
|
||||
bot_control(href_list["op"], usr)
|
||||
update_controls()
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, pda= 0)
|
||||
/mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, pda = 0)
|
||||
if(pda && !wires.RemoteRX()) //MULE wireless is controlled by wires.
|
||||
return
|
||||
|
||||
@@ -297,58 +221,85 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
if("stop")
|
||||
if(mode >= BOT_DELIVER)
|
||||
bot_reset()
|
||||
update_controls()
|
||||
|
||||
if("go")
|
||||
if(mode == BOT_IDLE)
|
||||
start()
|
||||
update_controls()
|
||||
|
||||
if("home")
|
||||
if(mode == BOT_IDLE || mode == BOT_DELIVER)
|
||||
start_home()
|
||||
update_controls()
|
||||
|
||||
if("destination")
|
||||
var/new_dest = input(user, "Select M.U.L.E. Destination", "Mulebot [suffix ? "([suffix])" : ""]", destination) as null|anything in deliverybeacontags
|
||||
var/new_dest = input(user, "Enter Destination:", name, destination) as null|anything in deliverybeacontags
|
||||
if(new_dest)
|
||||
set_destination(new_dest)
|
||||
update_controls()
|
||||
|
||||
|
||||
if("setid")
|
||||
var/new_id = stripped_input(user, "Enter new bot ID", "Mulebot [suffix ? "([suffix])" : ""]", suffix, MAX_NAME_LEN)
|
||||
var/new_id = stripped_input(user, "Enter ID:", name, suffix, MAX_NAME_LEN)
|
||||
if(new_id)
|
||||
suffix = new_id
|
||||
name = "\improper Mulebot ([suffix])"
|
||||
update_controls()
|
||||
|
||||
set_suffix(new_id)
|
||||
if("sethome")
|
||||
var/new_home = stripped_input(user, "Enter new home tag", "Mulebot [suffix ? "([suffix])" : ""]", home_destination)
|
||||
var/new_home = input(user, "Enter Home:", name, home_destination) as null|anything in deliverybeacontags
|
||||
if(new_home)
|
||||
home_destination = new_home
|
||||
update_controls()
|
||||
|
||||
if("unload")
|
||||
if(load && mode != BOT_HUNT)
|
||||
if(loc == target)
|
||||
unload(loaddir)
|
||||
else
|
||||
unload(0)
|
||||
|
||||
if("autoret")
|
||||
auto_return = !auto_return
|
||||
|
||||
if("autopick")
|
||||
auto_pickup = !auto_pickup
|
||||
|
||||
if("report")
|
||||
report_delivery = !report_delivery
|
||||
|
||||
if("close")
|
||||
usr.unset_machine()
|
||||
usr << browse(null,"window=mulebot")
|
||||
// TODO: remove this; PDAs currently depend on it
|
||||
/mob/living/simple_animal/bot/mulebot/get_controls(mob/user)
|
||||
var/ai = issilicon(user)
|
||||
var/dat
|
||||
dat += "<h3>Multiple Utility Load Effector Mk. V</h3>"
|
||||
dat += "<b>ID:</b> [suffix]<BR>"
|
||||
dat += "<b>Power:</b> [on ? "On" : "Off"]<BR>"
|
||||
dat += "<h3>Status</h3>"
|
||||
dat += "<div class='statusDisplay'>"
|
||||
switch(mode)
|
||||
if(BOT_IDLE)
|
||||
dat += "<span class='good'>Ready</span>"
|
||||
if(BOT_DELIVER)
|
||||
dat += "<span class='good'>[mode_name[BOT_DELIVER]]</span>"
|
||||
if(BOT_GO_HOME)
|
||||
dat += "<span class='good'>[mode_name[BOT_GO_HOME]]</span>"
|
||||
if(BOT_BLOCKED)
|
||||
dat += "<span class='average'>[mode_name[BOT_BLOCKED]]</span>"
|
||||
if(BOT_NAV,BOT_WAIT_FOR_NAV)
|
||||
dat += "<span class='average'>[mode_name[BOT_NAV]]</span>"
|
||||
if(BOT_NO_ROUTE)
|
||||
dat += "<span class='bad'>[mode_name[BOT_NO_ROUTE]]</span>"
|
||||
dat += "</div>"
|
||||
|
||||
dat += "<b>Current Load:</b> [load ? load.name : "<i>none</i>"]<BR>"
|
||||
dat += "<b>Destination:</b> [!destination ? "<i>none</i>" : destination]<BR>"
|
||||
dat += "<b>Power level:</b> [cell ? cell.percent() : 0]%"
|
||||
|
||||
if(locked && !ai && !IsAdminGhost(user))
|
||||
dat += " <br /><div class='notice'>Controls are locked</div><A href='byond://?src=\ref[src];op=unlock'>Unlock Controls</A>"
|
||||
else
|
||||
dat += " <br /><div class='notice'>Controls are unlocked</div><A href='byond://?src=\ref[src];op=lock'>Lock Controls</A><BR><BR>"
|
||||
|
||||
dat += "<A href='byond://?src=\ref[src];op=power'>Toggle Power</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=stop'>Stop</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=go'>Proceed</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=home'>Return to Home</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=destination'>Set Destination</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=setid'>Set Bot ID</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=sethome'>Set Home</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autoret'>Toggle Auto Return Home</A> ([auto_return ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autopick'>Toggle Auto Pickup Crate</A> ([auto_pickup ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=report'>Toggle Delivery Reporting</A> ([report_delivery ? "On" : "Off"])<BR>"
|
||||
if(load)
|
||||
dat += "<A href='byond://?src=\ref[src];op=unload'>Unload Now</A><BR>"
|
||||
dat += "<div class='notice'>The maintenance hatch is closed.</div>"
|
||||
|
||||
return dat
|
||||
|
||||
|
||||
// returns true if the bot has power
|
||||
@@ -369,7 +320,7 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
|
||||
|
||||
// mousedrop a crate to load the bot
|
||||
// can load anything if emagged
|
||||
// can load anything if hacked
|
||||
/mob/living/simple_animal/bot/mulebot/MouseDrop_T(atom/movable/AM, mob/user)
|
||||
|
||||
if(user.incapacitated() || user.lying)
|
||||
@@ -394,7 +345,7 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
else
|
||||
if(wires.LoadCheck())
|
||||
buzz(SIGH)
|
||||
return // if not emagged, only allow crates to be loaded
|
||||
return // if not hacked, only allow crates to be loaded
|
||||
|
||||
if(CRATE) // if it's a crate, close before loading
|
||||
CRATE.close()
|
||||
@@ -612,7 +563,6 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
/mob/living/simple_animal/bot/mulebot/proc/set_destination(new_dest)
|
||||
new_destination = new_dest
|
||||
get_nav()
|
||||
update_controls()
|
||||
|
||||
// starts bot moving to current destination
|
||||
/mob/living/simple_animal/bot/mulebot/proc/start()
|
||||
@@ -742,7 +692,6 @@ mob/living/simple_animal/bot/mulebot/bot_reset()
|
||||
icon_state = "mulebot[(wires.MobAvoid() != null)]"
|
||||
if(destination) // No need to calculate a path if you do not have a destination set!
|
||||
calc_path()
|
||||
update_controls()
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/emp_act(severity)
|
||||
if (cell)
|
||||
|
||||
@@ -457,7 +457,7 @@
|
||||
else if(stat & (BROKEN|MAINT))
|
||||
user << "<span class='warning'>Nothing happens!</span>"
|
||||
else
|
||||
if(src.allowed(usr) && !isWireCut(APC_WIRE_IDSCAN))
|
||||
if(src.allowed(usr) && !wires.IsIndexCut(APC_WIRE_IDSCAN))
|
||||
locked = !locked
|
||||
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the APC interface.</span>"
|
||||
update_icon()
|
||||
@@ -717,10 +717,6 @@
|
||||
// world << "[area.power_equip]"
|
||||
area.power_change()
|
||||
|
||||
/obj/machinery/power/apc/proc/isWireCut(wireIndex)
|
||||
return wires.IsIndexCut(wireIndex)
|
||||
|
||||
|
||||
/obj/machinery/power/apc/proc/can_use(mob/user, loud = 0) //used by attack_hand() and Topic()
|
||||
if(IsAdminGhost(user))
|
||||
return 1
|
||||
|
||||
File diff suppressed because one or more lines are too long
+10
-15
File diff suppressed because one or more lines are too long
@@ -8,7 +8,6 @@ buttoncolor(selector, color)
|
||||
background-color: lighten(color, button-lighten-hover)
|
||||
outline: 0
|
||||
|
||||
|
||||
span.button
|
||||
@extend $fontReset
|
||||
display: inline-block
|
||||
@@ -27,6 +26,9 @@ span.button
|
||||
buttoncolor(caution, button-color-caution)
|
||||
buttoncolor(danger, button-color-danger)
|
||||
|
||||
& + span:not(.buttoninfo)
|
||||
margin-left: 5px
|
||||
|
||||
&.gridable
|
||||
width: 125px
|
||||
margin: 2px 0
|
||||
|
||||
@@ -28,6 +28,3 @@ section
|
||||
.line
|
||||
@extend $cell
|
||||
width: 100%
|
||||
|
||||
.buttoninfo
|
||||
margin-left: 5px
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ui-section label='Output Pressure'>
|
||||
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
|
||||
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
|
||||
<span class='buttoninfo'>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
<span>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
</ui-section>
|
||||
<ui-section label='Filter'>
|
||||
<ui-button state='{{data.filter_type == "" ? "selected" : null}}'
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<ui-section label='Output Pressure'>
|
||||
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
|
||||
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
|
||||
<span class='buttoninfo'>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
<span>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
</ui-section>
|
||||
<ui-section label='Node 1'>
|
||||
<ui-button icon='fast-backward' state='{{data.node1_concentration == 0 ? "disabled" : null}}'
|
||||
@@ -17,7 +17,7 @@
|
||||
action='node1' params='{"concentration": 0.01}'/>
|
||||
<ui-button icon='fast-forward' state='{{data.node1_concentration == 100 ? "disabled" : null}}'
|
||||
action='node1' params='{"concentration": 0.1}'/>
|
||||
<span class='buttoninfo'>{{Math.round(adata.node1_concentration)}}%</span>
|
||||
<span>{{Math.round(adata.node1_concentration)}}%</span>
|
||||
</ui-section>
|
||||
<ui-section label='Node 2'>
|
||||
<ui-button icon='fast-backward' state='{{data.node2_concentration == 0 ? "disabled" : null}}'
|
||||
@@ -28,6 +28,6 @@
|
||||
action='node2' params='{"concentration": 0.01}'/>
|
||||
<ui-button icon='fast-forward' state='{{data.node2_concentration == 100 ? "disabled" : null}}'
|
||||
action='node2' params='{"concentration": 0.1}'/>
|
||||
<span class='buttoninfo'>{{Math.round(adata.node2_concentration)}}%</span>
|
||||
<span>{{Math.round(adata.node2_concentration)}}%</span>
|
||||
</ui-section>
|
||||
</ui-display>
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<ui-section label='Transfer Rate'>
|
||||
<ui-button icon='pencil' action='transfer' params='{"rate": "custom"}'>Set</ui-button>
|
||||
<ui-button icon='plus' state='{{data.transfer_rate == data.max_rate ? "disabled" : null}}' action='transfer' params='{"rate": "max"}'>Max</ui-button>
|
||||
<span class='buttoninfo'>{{Math.round(adata.transfer_rate)}} L/s</span>
|
||||
<span>{{Math.round(adata.transfer_rate)}} L/s</span>
|
||||
</ui-section>
|
||||
{{else}}
|
||||
<ui-section label='Output Pressure'>
|
||||
<ui-button icon='pencil' action='pressure' params='{"pressure": "custom"}'>Set</ui-button>
|
||||
<ui-button icon='plus' state='{{data.set_pressure == data.max_pressure ? "disabled" : null}}' action='pressure' params='{"pressure": "max"}'>Max</ui-button>
|
||||
<span class='buttoninfo'>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
<span>{{Math.round(adata.set_pressure)}} kPa</span>
|
||||
</ui-section>
|
||||
{{/if}}
|
||||
</ui-display>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
</ui-notice>
|
||||
<ui-display title='Canister' button>
|
||||
{{#partial button}}
|
||||
<ui-button icon='pencil' state='{{data.canLabel ? null : "disabled"}}' action='relabel'>Relabel</ui-button>
|
||||
<ui-button icon='pencil' action='relabel'>Relabel</ui-button>
|
||||
{{/partial}}
|
||||
<ui-section label='Pressure'>
|
||||
<span>{{Math.round(adata.tankPressure)}} kPa</span>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<ui-notice>
|
||||
{{#if data.siliconUser}}
|
||||
<ui-section label='Interface Lock'>
|
||||
<ui-button icon='{{data.locked ? "lock" : "unlock"}}' action='lock'>{{data.locked ? "Engaged" : "Disengaged"}}</ui-button>
|
||||
</ui-section>
|
||||
{{else}}
|
||||
<span>Swipe an ID card to {{data.locked ? "unlock" : "lock"}} this interface.</span>
|
||||
{{/if}}
|
||||
</ui-notice>
|
||||
<ui-display title='Status'>
|
||||
<ui-section label='Power'>
|
||||
{{#if data.locked}}
|
||||
<span class='{{data.on ? "good" : "bad"}}' state='{{data.cell ? null : "disabled"}}'>{{data.on ? "On" : "Off"}}</span>
|
||||
{{else}}
|
||||
<ui-button icon='{{data.on ? "power-off" : "close"}}' style='{{data.on ? "selected" : null}}' action="power">{{data.on ? "On" : "Off"}}</ui-button>
|
||||
{{/if}}
|
||||
</ui-section>
|
||||
<ui-section label='Cell'>
|
||||
<span class='{{data.cell ? null : "bad"}}'>{{data.cell ? data.cellPercent + "%" : "No Cell"}}</span>
|
||||
</ui-section>
|
||||
<ui-section label='Mode'>
|
||||
<span class='{{data.modeStatus}}'>{{data.mode}}</span>
|
||||
</ui-section>
|
||||
<ui-section label='Load'>
|
||||
<span class='{{data.load ? "good" : "average"}}'>{{data.load ? data.load : "None"}}</span>
|
||||
</ui-section>
|
||||
<ui-section label='Destination'>
|
||||
<span class='{{data.destination ? "good": "average"}}'>{{data.destination ? data.destination : "None"}}</span>
|
||||
</ui-section>
|
||||
</ui-display>
|
||||
{{#if !data.locked || data.siliconUser}}
|
||||
<ui-display title='Controls' button>
|
||||
{{#partial button}}
|
||||
{{#if data.load}}
|
||||
<ui-button icon='eject' action='unload'>Unload</ui-button>
|
||||
{{/if}}
|
||||
<ui-button icon='pencil' action='setid'>Set ID</ui-button>
|
||||
{{/partial}}
|
||||
<ui-section label='Destination'>
|
||||
<ui-button icon='pencil' action='destination'>Set Destination</ui-button>
|
||||
<ui-button icon='stop' action='stop'>Stop</ui-button>
|
||||
<ui-button icon='play' action='go'>Go</ui-button>
|
||||
</ui-section>
|
||||
<ui-section label='Home'>
|
||||
<ui-button icon='home' action='home'>Go Home</ui-button>
|
||||
<ui-button icon='pencil' action='sethome'>Set Home</ui-button>
|
||||
</ui-section>
|
||||
<ui-section label='Settings'>
|
||||
<ui-button icon='{{data.autoReturn ? "check-square-o" : "square-o"}}' style='{{data.autoReturn ? "selected" : null}}' action='autoret'>
|
||||
Auto-Return Home</ui-button>
|
||||
<ui-button icon='{{data.autoPickup ? "check-square-o" : "square-o"}}' style='{{data.autoPickup ? "selected" : null}}' action='autopick'>
|
||||
Auto-Pickup Crate</ui-button>
|
||||
<ui-button icon='{{data.reportDelivery ? "check-square-o" : "square-o"}}' style='{{data.reportDelivery ? "selected" : null}}' action='report'>
|
||||
Report Deliveries</ui-button>
|
||||
</ui-section>
|
||||
</ui-display>
|
||||
{{/if}}
|
||||
<!--
|
||||
dat += "<A href='byond://?src=\ref[src];op=setid'>Set Bot ID</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autoret'>Toggle Auto Return Home</A> ([auto_return ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=autopick'>Toggle Auto Pickup Crate</A> ([auto_pickup ? "On":"Off"])<BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];op=report'>Toggle Delivery Reporting</A> ([report_delivery ? "On" : "Off"])<BR>"
|
||||
if(load)
|
||||
dat += "<A href='byond://?src=\ref[src];op=unload'>Unload Now</A><BR>"
|
||||
dat += "<div class='notice'>The maintenance hatch is closed.</div>"
|
||||
-->
|
||||
Reference in New Issue
Block a user