diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index f4aca3c4aeb..8eeb65e51ce 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -214,6 +214,7 @@ #define issilicon(A) (istype((A), /mob/living/silicon)) #define isAI(A) (istype((A), /mob/living/silicon/ai)) #define isrobot(A) (istype((A), /mob/living/silicon/robot)) +#define isdrone(A) (istype((A), /mob/living/silicon/robot/drone)) #define ispAI(A) (istype((A), /mob/living/silicon/pai)) // For the tcomms monitor diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index 48fe9d996a9..0a4bbfa6ec1 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -1,4 +1,4 @@ -#define EMAG_TIMER 3000 +#define EMAG_TIMER 5 MINUTES /mob/living/silicon/robot/drone name = "drone" real_name = "drone" @@ -7,21 +7,19 @@ maxHealth = 35 health = 35 bubble_icon = "machine" - universal_speak = 0 - universal_understand = 1 - gender = NEUTER pass_flags = PASSTABLE braintype = "Robot" - lawupdate = 0 - density = 0 + lawupdate = FALSE + density = FALSE has_camera = FALSE req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS) - ventcrawler = 2 - magpulse = 1 + ventcrawler = VENTCRAWLER_ALWAYS + magpulse = TRUE mob_size = MOB_SIZE_SMALL pull_force = MOVE_FORCE_VERY_WEAK // Can only drag small items - modules_break = FALSE + /// Cooldown for law syncs + var/sync_cooldown = 0 // We need to keep track of a few module items so we don't need to do list operations // every time we need them. These get set in New() after the module is chosen. @@ -37,7 +35,7 @@ //Used for self-mailing. var/mail_destination = 0 - var/reboot_cooldown = 60 // one minute + var/reboot_cooldown = 1 MINUTES var/last_reboot var/list/pullable_drone_items = list( /obj/item/pipe, @@ -57,8 +55,8 @@ remove_language("Robot Talk") remove_language("Galactic Common") - add_language("Drone Talk", 1) - add_language("Drone", 1) + add_language("Drone Talk", TRUE) + add_language("Drone", TRUE) // Disable the microphone wire on Drones if(radio) @@ -86,13 +84,13 @@ radio.recalculateChannels() //Grab stacks. - stack_metal = locate(/obj/item/stack/sheet/metal/cyborg) in src.module - stack_wood = locate(/obj/item/stack/sheet/wood) in src.module - stack_glass = locate(/obj/item/stack/sheet/glass/cyborg) in src.module - stack_plastic = locate(/obj/item/stack/sheet/plastic) in src.module + stack_metal = locate(/obj/item/stack/sheet/metal/cyborg) in module + stack_wood = locate(/obj/item/stack/sheet/wood) in module + stack_glass = locate(/obj/item/stack/sheet/glass/cyborg) in module + stack_plastic = locate(/obj/item/stack/sheet/plastic) in module //Grab decompiler. - decompiler = locate(/obj/item/matter_decompiler) in src.module + decompiler = locate(/obj/item/matter_decompiler) in module //Some tidying-up. flavor_text = "It's a tiny little repair drone. The casing is stamped with an NT logo and the subscript: 'Nanotrasen Recursive Repair Systems: Fixing Tomorrow's Problem, Today!'" @@ -103,10 +101,10 @@ laws = new /datum/ai_laws/drone() connected_ai = null - aiCamera = new/obj/item/camera/siliconcam/drone_camera(src) + aiCamera = new /obj/item/camera/siliconcam/drone_camera(src) additional_law_channels["Drone"] = ";" - playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0) + playsound(loc, 'sound/machines/twobeep.ogg', 50) //Redefining some robot procs... /mob/living/silicon/robot/drone/rename_character(oldname, newname) @@ -114,7 +112,7 @@ return ..(newname, newname) /mob/living/silicon/robot/drone/get_default_name() - return "maintenance drone ([rand(100,999)])" + return "maintenance drone ([rand(100, 999)])" /mob/living/silicon/robot/drone/update_icons() overlays.Cut() @@ -126,7 +124,6 @@ /mob/living/silicon/robot/drone/choose_icon() return - /mob/living/silicon/robot/drone/pick_module() return @@ -136,25 +133,23 @@ return FALSE //Drones cannot be upgraded with borg modules so we need to catch some items before they get used in ..(). -/mob/living/silicon/robot/drone/attackby(obj/item/W as obj, mob/user as mob, params) - - if(istype(W, /obj/item/borg/upgrade/)) - to_chat(user, "The maintenance drone chassis not compatible with \the [W].") +/mob/living/silicon/robot/drone/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/borg/upgrade)) + to_chat(user, "The maintenance drone chassis is not compatible with [I].") return - else if(istype(W, /obj/item/crowbar)) - to_chat(user, "The machine is hermetically sealed. You can't open the case.") + else if(istype(I, /obj/item/crowbar)) + to_chat(user, "The machine is hermetically sealed. You can't open the case.") return - else if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) - + else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda)) if(stat == DEAD) - - if(!config.allow_drone_spawn || emagged || health < -35) //It's dead, Dave. + // Currently not functional, so commenting out until it's fixed to avoid confusion + /*if(!config.allow_drone_spawn || emagged || health < -35) //It's dead, Dave. to_chat(user, "The interface is fried, and a distressing burned smell wafts from the robot's interior. You're not rebooting this one.") return - if(!allowed(W)) + if(!allowed(I)) to_chat(user, "Access denied.") return @@ -164,25 +159,26 @@ to_chat(usr, "The reboot system is currently offline. Please wait another [cooldown_time] seconds.") return - user.visible_message("\the [user] swipes [user.p_their()] ID card through [src], attempting to reboot it.", "You swipe your ID card through [src], attempting to reboot it.") + user.visible_message("[user] swipes [user.p_their()] ID card through [src], attempting to reboot it.", + "You swipe your ID card through [src], attempting to reboot it.") last_reboot = world.time / 10 var/drones = 0 for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) if(D.key && D.client) drones++ if(drones < config.max_maint_drones) - request_player() + request_player()*/ return else var/confirm = alert("Using your ID on a Maintenance Drone will shut it down, are you sure you want to do this?", "Disable Drone", "Yes", "No") if(confirm == ("Yes") && (user in range(3, src))) - user.visible_message("\the [user] swipes [user.p_their()] ID card through [src], attempting to shut it down.", "You swipe your ID card through \the [src], attempting to shut it down.") + user.visible_message("[user] swipes [user.p_their()] ID card through [src], attempting to shut it down.", + "You swipe your ID card through [src], attempting to shut it down.") if(emagged) return - - if(allowed(W)) + if(allowed(I)) shut_down() else to_chat(user, "Access denied.") @@ -191,7 +187,7 @@ ..() -/mob/living/silicon/robot/drone/emag_act(user as mob) +/mob/living/silicon/robot/drone/emag_act(mob/user) if(!client || stat == DEAD) to_chat(user, "There's not much point subverting this heap of junk.") return @@ -210,7 +206,7 @@ if(jobban_isbanned(src, ROLE_SYNDICATE)) SSticker.mode.replace_jobbanned_player(src, ROLE_SYNDICATE) - to_chat(src, "You feel a sudden burst of malware loaded into your execute-as-root buffer. Your tiny brain methodically parses, loads and executes the script. You sense you have five minutes before the drone server detects this and automatically shuts you down.") + to_chat(src, "You feel a sudden burst of malware loaded into your execute-as-root buffer. Your tiny brain methodically parses, loads and executes the script. You sense you have five minutes before the drone server detects this and automatically shuts you down.") message_admins("[key_name_admin(user)] emagged drone [key_name_admin(src)]. Laws overridden.") log_game("[key_name(user)] emagged drone [key_name(src)]. Laws overridden.") @@ -218,13 +214,12 @@ GLOB.lawchanges.Add("[time] : [H.name]([H.key]) emagged [name]([key])") addtimer(CALLBACK(src, .proc/shut_down, TRUE), EMAG_TIMER) - emagged = 1 - density = 1 + emagged = TRUE + density = TRUE pass_flags = 0 icon_state = "repairbot-emagged" holder_type = /obj/item/holder/drone/emagged update_icons() - lawupdate = 0 connected_ai = null clear_supplied_laws() clear_inherent_laws() @@ -234,7 +229,6 @@ to_chat(src, "Obey these laws:") laws.show_laws(src) to_chat(src, "ALERT: [H.real_name] is your new master. Obey your new laws and [H.real_name]'s commands.") - return //DRONE LIFE/DEATH @@ -262,7 +256,7 @@ full_law_reset() show_laws() -/mob/living/silicon/robot/drone/proc/shut_down(force=FALSE) +/mob/living/silicon/robot/drone/proc/shut_down(force = FALSE) if(stat == DEAD) return @@ -285,32 +279,32 @@ for(var/mob/dead/observer/O in GLOB.player_list) if(cannotPossess(O)) continue - if(jobban_isbanned(O,"nonhumandept") || jobban_isbanned(O,"Drone")) + if(jobban_isbanned(O, "nonhumandept") || jobban_isbanned(O, "Drone")) continue if(O.client) if(ROLE_PAI in O.client.prefs.be_special) - question(O.client,O) + question(O.client, O) -/mob/living/silicon/robot/drone/proc/question(var/client/C,var/mob/M) +/mob/living/silicon/robot/drone/proc/question(client/C, mob/M) spawn(0) - if(!C || !M || jobban_isbanned(M,"nonhumandept") || jobban_isbanned(M,"Drone")) return + if(!C || !M || jobban_isbanned(M, "nonhumandept") || jobban_isbanned(M, "Drone")) + return var/response = alert(C, "Someone is attempting to reboot a maintenance drone. Would you like to play as one?", "Maintenance drone reboot", "Yes", "No") if(!C || ckey) return if(response == "Yes") transfer_personality(C) -/mob/living/silicon/robot/drone/proc/transfer_personality(var/client/player) +/mob/living/silicon/robot/drone/proc/transfer_personality(client/player) + if(!player) + return - if(!player) return - - if(player.mob && player.mob.mind) + if(player.mob?.mind) player.mob.mind.transfer_to(src) player.mob.mind.assigned_role = "Drone" else ckey = player.ckey - lawupdate = 0 to_chat(src, "Systems rebooted. Loading base pattern maintenance protocol... loaded.") full_law_reset() to_chat(src, "
You are a maintenance drone, a tiny-brained robotic repair machine.") @@ -358,21 +352,21 @@ to_chat(src, "You are too small to pull that.") /mob/living/silicon/robot/drone/add_robot_verbs() - src.verbs |= silicon_subsystems + verbs |= silicon_subsystems /mob/living/silicon/robot/drone/remove_robot_verbs() - src.verbs -= silicon_subsystems + verbs -= silicon_subsystems -/mob/living/silicon/robot/drone/update_canmove(delay_action_updates = 0) +/mob/living/silicon/robot/drone/update_canmove(delay_action_updates = FALSE) . = ..() density = emagged //this is reset every canmove update otherwise -/mob/living/simple_animal/drone/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0) +/mob/living/silicon/robot/drone/flash_eyes(intensity = 1, override_blindness_check = FALSE, affect_silicon = FALSE, visual = FALSE) if(affect_silicon) return ..() /mob/living/silicon/robot/drone/decompile_act(obj/item/matter_decompiler/C, mob/user) - if(!client && istype(user, /mob/living/silicon/robot/drone)) + if(!client && isdrone(user)) to_chat(user, "You begin decompiling the other drone.") if(!do_after(user, 5 SECONDS, target = loc)) to_chat(user, "You need to remain still while decompiling such a large object.") @@ -380,7 +374,7 @@ if(QDELETED(src) || QDELETED(user)) return ..() to_chat(user, "You carefully and thoroughly decompile your downed fellow, storing as much of its resources as you can within yourself.") - new/obj/effect/decal/cleanable/blood/oil(get_turf(src)) + new /obj/effect/decal/cleanable/blood/oil(get_turf(src)) C.stored_comms["metal"] += 15 C.stored_comms["glass"] += 15 C.stored_comms["wood"] += 5 diff --git a/code/modules/mob/living/silicon/robot/drone/drone_console.dm b/code/modules/mob/living/silicon/robot/drone/drone_console.dm index d961d8e1c62..02924fbbbda 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_console.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_console.dm @@ -6,16 +6,18 @@ req_access = list(ACCESS_ENGINE_EQUIP) circuit = /obj/item/circuitboard/drone_control - //Used when pinging drones. - var/drone_call_area = "Engineering" - //Used to enable or disable drone fabrication. + /// The linked fabricator var/obj/machinery/drone_fabricator/dronefab + /// Used when pinging drones + var/drone_call_area = "Engineering" + /// Cooldown for area pings + var/ping_cooldown = 0 -/obj/machinery/computer/drone_control/attack_ai(var/mob/user as mob) - return src.attack_hand(user) +/obj/machinery/computer/drone_control/Initialize(mapload) + . = ..() + find_fab() - -/obj/machinery/computer/drone_control/attack_hand(var/mob/user as mob) +/obj/machinery/computer/drone_control/attack_hand(mob/user) if(..()) return @@ -23,105 +25,112 @@ to_chat(user, "Access denied.") return - interact(user) + ui_interact(user) -/obj/machinery/computer/drone_control/attack_ghost(mob/user as mob) - interact(user) +/obj/machinery/computer/drone_control/attack_ghost(mob/user) + ui_interact(user) -/obj/machinery/computer/drone_control/interact(mob/user) +// tgui\packages\tgui\interfaces\DroneConsole.js +/obj/machinery/computer/drone_control/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state) + ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + if(!ui) + ui = new(user, src, ui_key, "DroneConsole", "Drone Control Console", 420, 500, master_ui, state) + ui.open() - user.set_machine(src) - var/dat - dat += "Maintenance Units
" +/obj/machinery/computer/drone_control/ui_data(mob/user) + var/list/data = list() + data["drone_fab"] = FALSE + data["fab_power"] = null + data["drone_prod"] = null + data["drone_progress"] = null + if(dronefab) + data["drone_fab"] = TRUE + data["fab_power"] = dronefab.stat & NOPOWER ? FALSE : TRUE + data["drone_prod"] = dronefab.produce_drones + data["drone_progress"] = dronefab.drone_progress + data["selected_area"] = drone_call_area + data["ping_cd"] = ping_cooldown > world.time ? TRUE : FALSE + data["drones"] = list() for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) - dat += "
[D.real_name] ([D.stat == 2 ? "INACTIVE" : "ACTIVE"])" - dat += "
Cell charge: [D.cell.charge]/[D.cell.maxcharge]." - dat += "
Currently located in: [get_area(D)]." - dat += "
Resync | Shutdown
" + var/area/A = get_area(D) + var/turf/T = get_turf(D) + var/list/drone_data = list( + name = D.real_name, + uid = D.UID(), + stat = D.stat, + client = D.client ? TRUE : FALSE, + health = round(D.health / D.maxHealth, 0.1), + charge = round(D.cell.charge / D.cell.maxcharge, 0.1), + location = "[A] ([T.x], [T.y])", + sync_cd = D.sync_cooldown > world.time ? TRUE : FALSE + ) + data["drones"] += list(drone_data) + return data - dat += "

Request drone presence in area: [drone_call_area] (Send ping)" +/obj/machinery/computer/drone_control/ui_static_data(mob/user) + var/list/data = list() + data["area_list"] = GLOB.TAGGERLOCATIONS + return data - dat += "

Drone fabricator: " - dat += "[dronefab ? "[(dronefab.produce_drones && !(dronefab.stat & NOPOWER)) ? "ACTIVE" : "INACTIVE"]" : "FABRICATOR NOT DETECTED. (search)"]" - user << browse(dat, "window=computer;size=400x500") - onclose(user, "computer") - return - - -/obj/machinery/computer/drone_control/Topic(href, href_list) +/obj/machinery/computer/drone_control/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) if(..()) return + . = TRUE - if(!allowed(usr) && !usr.can_admin_interact()) - to_chat(usr, "Access denied.") + switch(action) + if("find_fab") + find_fab(usr) + + if("toggle_fab") + if(QDELETED(dronefab)) + dronefab = null + return + + dronefab.produce_drones = !dronefab.produce_drones + var/toggle = dronefab.produce_drones ? "enable" : "disable" + to_chat(usr, "You [toggle] drone production in the nearby fabricator.") + message_admins("[key_name_admin(usr)] [toggle]d maintenance drone production from the control console.") + log_game("[key_name(usr)] [toggle]d maintenance drone production from the control console.") + + if("set_area") + drone_call_area = params["area"] + + if("ping") + ping_cooldown = world.time + 1 MINUTES // One minute cooldown to prevent chat spam + to_chat(usr, "You issue a maintenance request for all active drones, highlighting [drone_call_area].") + for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) + if(D.client && D.stat == CONSCIOUS) + to_chat(D, "-- Maintenance drone presence requested in: [drone_call_area].") + + if("resync") + var/mob/living/silicon/robot/drone/D = locateUID(params["uid"]) + if(D) + D.sync_cooldown = world.time + 1 MINUTES // One minute cooldown to prevent chat spam + to_chat(usr, "You issue a law synchronization directive for the drone.") + D.law_resync() + + if("shutdown") + var/mob/living/silicon/robot/drone/D = locateUID(params["uid"]) + if(D) + to_chat(usr, "You issue a kill command for the unfortunate drone.") + message_admins("[key_name_admin(usr)] issued kill order for drone [key_name_admin(D)] from control console.") + log_game("[key_name(usr)] issued kill order for [key_name(D)] from control console.") + D.shut_down() + +/obj/machinery/computer/drone_control/proc/find_fab(mob/user) + if(dronefab) return - if((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) - usr.set_machine(src) + for(var/obj/machinery/drone_fabricator/fab in get_area(src)) - if(href_list["setarea"]) + if(fab.stat & NOPOWER) + continue - //Probably should consider using another list, but this one will do. - var/t_area = input("Select the area to ping.", "Set Target Area", null) as null|anything in GLOB.TAGGERLOCATIONS + dronefab = fab + if(user) + to_chat(user, "Drone fabricator located.") + return - if(!t_area || GLOB.TAGGERLOCATIONS[t_area]) - return - - drone_call_area = t_area - to_chat(usr, "You set the area selector to [drone_call_area].") - - else if(href_list["ping"]) - - to_chat(usr, "You issue a maintenance request for all active drones, highlighting [drone_call_area].") - for(var/mob/living/silicon/robot/drone/D in GLOB.silicon_mob_list) - if(D.client && D.stat == 0) - to_chat(D, "-- Maintenance drone presence requested in: [drone_call_area].") - - else if(href_list["resync"]) - - var/mob/living/silicon/robot/drone/D = locate(href_list["resync"]) - - if(D.stat != 2) - to_chat(usr, "You issue a law synchronization directive for the drone.") - D.law_resync() - - else if(href_list["shutdown"]) - - var/mob/living/silicon/robot/drone/D = locate(href_list["shutdown"]) - - if(D.stat != 2) - to_chat(usr, "You issue a kill command for the unfortunate drone.") - message_admins("[key_name_admin(usr)] issued kill order for drone [key_name_admin(D)] from control console.") - log_game("[key_name(usr)] issued kill order for [key_name(src)] from control console.") - D.shut_down() - - else if(href_list["search_fab"]) - if(dronefab) - return - - for(var/obj/machinery/drone_fabricator/fab in get_area(src)) - - if(fab.stat & NOPOWER) - continue - - dronefab = fab - to_chat(usr, "Drone fabricator located.") - return - - to_chat(usr, "Unable to locate drone fabricator.") - - else if(href_list["toggle_fab"]) - - if(!dronefab) - return - - if(get_dist(src,dronefab) > 3) - dronefab = null - to_chat(usr, "Unable to locate drone fabricator.") - return - - dronefab.produce_drones = !dronefab.produce_drones - to_chat(usr, "You [dronefab.produce_drones ? "enable" : "disable"] drone production in the nearby fabricator.") - - src.updateUsrDialog() + if(user) + to_chat(user, "Unable to locate drone fabricator.") diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index 023cced9cdb..73c78ff3bec 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -1,22 +1,18 @@ /obj/machinery/drone_fabricator name = "drone fabricator" desc = "A large automated factory for producing maintenance drones." + icon = 'icons/obj/machines/drone_fab.dmi' + icon_state = "drone_fab_idle" - density = 1 - anchored = 1 + density = TRUE + anchored = TRUE use_power = IDLE_POWER_USE idle_power_usage = 20 active_power_usage = 5000 - var/drone_progress = 0 - var/produce_drones = 1 - var/time_last_drone = 500 - - icon = 'icons/obj/machines/drone_fab.dmi' - icon_state = "drone_fab_idle" - -/obj/machinery/drone_fabricator/New() - ..() + var/produce_drones = TRUE + var/drone_progress = 100 + var/time_last_drone = 0 /obj/machinery/drone_fabricator/power_change() if(powered()) @@ -31,7 +27,8 @@ return if(stat & NOPOWER || !produce_drones) - if(icon_state != "drone_fab_nopower") icon_state = "drone_fab_nopower" + if(icon_state != "drone_fab_nopower") + icon_state = "drone_fab_nopower" return if(drone_progress >= 100) @@ -40,14 +37,14 @@ icon_state = "drone_fab_active" var/elapsed = world.time - time_last_drone - drone_progress = round((elapsed/config.drone_build_time)*100) + drone_progress = round((elapsed / config.drone_build_time) * 100) if(drone_progress >= 100) - visible_message("\The [src] voices a strident beep, indicating a drone chassis is prepared.") + visible_message("[src] voices a strident beep, indicating a drone chassis is prepared.") /obj/machinery/drone_fabricator/examine(mob/user) . = ..() - if(produce_drones && drone_progress >= 100 && istype(user,/mob/dead) && config.allow_drone_spawn && count_drones() < config.max_maint_drones) + if(produce_drones && drone_progress >= 100 && isobserver(user) && config.allow_drone_spawn && count_drones() < config.max_maint_drones) . += "
A drone is prepared. Select 'Join As Drone' from the Ghost tab to spawn as a maintenance drone." /obj/machinery/drone_fabricator/proc/count_drones() @@ -57,18 +54,17 @@ drones++ return drones -/obj/machinery/drone_fabricator/proc/create_drone(var/client/player) - +/obj/machinery/drone_fabricator/proc/create_drone(client/player) if(stat & NOPOWER) return if(!produce_drones || !config.allow_drone_spawn || count_drones() >= config.max_maint_drones) return - if(!player || !istype(player.mob,/mob/dead)) + if(!player || !isobserver(player.mob)) return - visible_message("\The [src] churns and grinds as it lurches into motion, disgorging a shiny new drone after a few moments.") + visible_message("[src] churns and grinds as it lurches into motion, disgorging a shiny new drone after a few moments.") flick("h_lathe_leave",src) time_last_drone = world.time @@ -88,41 +84,40 @@ to_chat(src, "That verb is not currently permitted.") return - if(!src.stat) + if(stat != DEAD) return if(usr != src) - return 0 //something is terribly wrong + return FALSE //something is terribly wrong - if(jobban_isbanned(src,"nonhumandept") || jobban_isbanned(src,"Drone")) - to_chat(usr, "You are banned from playing drones and cannot spawn as a drone.") + if(jobban_isbanned(src, "nonhumandept") || jobban_isbanned(src, "Drone")) + to_chat(usr, "You are banned from playing drones, and cannot spawn as one.") return - if(!SSticker || SSticker.current_state < 3) + if(!SSticker || SSticker.current_state < GAME_STATE_PLAYING) to_chat(src, "You can't join as a drone before the game starts!") return - var/drone_age = 14 // 14 days to play as a drone - var/player_age_check = check_client_age(usr.client, drone_age) + var/player_age_check = check_client_age(usr.client, 14) // 14 days to play as a drone if(player_age_check && config.use_age_restriction_for_antags) to_chat(usr, "This role is not yet available to you. You need to wait another [player_age_check] days.") return - var/pt_req = role_available_in_playtime(client, ROLE_DRONE) + var/pt_req = role_available_in_playtime(client, "Drone") if(pt_req) var/pt_req_string = get_exp_format(pt_req) to_chat(usr, "This role is not yet available to you. Play another [pt_req_string] to unlock it.") return - var/deathtime = world.time - src.timeofdeath - var/joinedasobserver = 0 - if(istype(src,/mob/dead/observer)) + var/deathtime = world.time - timeofdeath + var/joinedasobserver = FALSE + if(isobserver(src)) var/mob/dead/observer/G = src if(cannotPossess(G)) to_chat(usr, "Upon using the antagHUD you forfeited the ability to join the round.") return - if(G.started_as_observer == 1) - joinedasobserver = 1 + if(G.started_as_observer == TRUE) + joinedasobserver = TRUE var/deathtimeminutes = round(deathtime / 600) var/pluralcheck = "minute" @@ -132,7 +127,7 @@ pluralcheck = " [deathtimeminutes] minute and" else if(deathtimeminutes > 1) pluralcheck = " [deathtimeminutes] minutes and" - var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1) + var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10, 1) if(deathtime < 6000 && joinedasobserver == 0) to_chat(usr, "You have been dead for[pluralcheck] [deathtimeseconds] seconds.") @@ -151,7 +146,7 @@ return if(DF.drone_progress >= 100) - DF.create_drone(src.client) + DF.create_drone(client) return to_chat(src, "There are no available drone spawn points, sorry.") diff --git a/code/modules/tgui/states/notcontained.dm b/code/modules/tgui/states/notcontained.dm index 859e45d3649..cb05fd2ebfc 100644 --- a/code/modules/tgui/states/notcontained.dm +++ b/code/modules/tgui/states/notcontained.dm @@ -21,6 +21,3 @@ GLOBAL_DATUM_INIT(notcontained_state, /datum/ui_state/notcontained_state, new) /mob/living/silicon/notcontained_can_use_topic(src_object) return default_can_use_topic(src_object) // Silicons use default bevhavior. - -/mob/living/simple_animal/drone/notcontained_can_use_topic(src_object) - return default_can_use_topic(src_object) // Drones use default bevhavior. diff --git a/tgui/packages/tgui/interfaces/DroneConsole.js b/tgui/packages/tgui/interfaces/DroneConsole.js new file mode 100644 index 00000000000..5c69050a0da --- /dev/null +++ b/tgui/packages/tgui/interfaces/DroneConsole.js @@ -0,0 +1,201 @@ +// code\modules\mob\living\silicon\robot\drone\drone_console.dm +import { toTitleCase } from 'common/string'; +import { useBackend } from '../backend'; +import { Box, Button, Divider, Dropdown, Flex, LabeledList, NoticeBox, ProgressBar, Section } from '../components'; +import { Window } from '../layouts'; + +export const DroneConsole = (props, context) => { + return ( + + + + + + + ); +}; + +const Fabricator = (props, context) => { + const { act, data } = useBackend(context); + const { + drone_fab, + fab_power, + drone_prod, + drone_progress, + } = data; + + let FabDetected = () => { + if (drone_fab) { + return ( + + + + [ {fab_power ? "Online" : "Offline"} ] + + + + + + + ); + } else { + return ( + + + + FABRICATOR NOT DETECTED. + + +