From e3487b2adf3b5babe64b14a3656697faa857da4f Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 8 Jun 2020 21:08:40 -0700 Subject: [PATCH 1/2] boy oh boy --- .../mob/living/simple_animal/bot/bot.dm | 12 +++ .../mob/living/simple_animal/bot/cleanbot.dm | 88 ++++++++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 97f3dad3f0..39eccf9ad4 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -98,6 +98,10 @@ hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD, DIAG_PATH_HUD = HUD_LIST_LIST) //Diagnostic HUD views + var/commissioned = FALSE // Will other (noncommissioned) bots salute this bot? + var/can_salute = TRUE + var/salute_delay = 60 SECONDS + /mob/living/simple_animal/bot/proc/get_mode() if(client) //Player bots do not have modes, thus the override. Also an easy way for PDA users/AI to know when a bot is a player. if(paicard) @@ -251,6 +255,14 @@ if(!on || client) return + if(!commissioned && can_salute) + for(var/mob/living/simple_animal/bot/B in get_hearers_in_view(5, get_turf(src))) + if(B.commissioned) + visible_message("[src] performs an elaborate salute for [B]!") + can_salute = FALSE + addtimer(VARSET_CALLBACK(src, can_salute, TRUE), salute_delay) + break + switch(mode) //High-priority overrides are processed first. Bots can do nothing else while under direct command. if(BOT_RESPONDING) //Called by the AI. call_mode() diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 73099d8d9f..c87bda6edc 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -14,7 +14,7 @@ model = "Cleanbot" bot_core_type = /obj/machinery/bot_core/cleanbot window_id = "autoclean" - window_name = "Automatic Station Cleaner v1.2" + window_name = "Automatic Station Cleaner v1.3" pass_flags = PASSMOB path_image_color = "#993299" weather_immunities = list("lava","ash") @@ -36,6 +36,58 @@ var/next_dest var/next_dest_loc + var/obj/item/weapon + var/weapon_orig_force = 0 + + var/list/stolen_valor + + var/static/list/officers = list("Captain", "Head of Personnel", "Head of Security") + var/static/list/command = list("Captain" = "Cpt.","Head of Personnel" = "Lt.") + var/static/list/security = list("Head of Security" = "Maj.", "Warden" = "Sgt.", "Detective" = "Det.", "Security Officer" = "Officer") + var/static/list/engineering = list("Chief Engineer" = "Chief Engineer", "Station Engineer" = "Engineer", "Atmospherics Technician" = "Technician") + var/static/list/medical = list("Chief Medical Officer" = "C.M.O.", "Medical Doctor" = "M.D.", "Chemist" = "Pharm.D.") + var/static/list/research = list("Research Director" = "Ph.D.", "Roboticist" = "M.S.", "Scientist" = "B.S.") + var/static/list/legal = list("Lawyer" = "Esq.") + + var/list/prefixes + var/list/suffixes + +/mob/living/simple_animal/bot/cleanbot/proc/deputize(obj/item/W, mob/user) + if(in_range(src, user)) + to_chat(user, "You attach \the [W] to \the [src].") + user.transferItemToLoc(W, src) + weapon = W + weapon_orig_force = weapon.force + weapon.force = weapon.force / 2 + icon_state = "cleanbot[on]" + add_overlay(image(icon=weapon.lefthand_file,icon_state=weapon.item_state)) + +/mob/living/simple_animal/bot/cleanbot/proc/update_titles() + var/working_title = "" + + for(var/pref in prefixes) + for(var/title in pref) + if(title in stolen_valor) + working_title += pref[title] + " " + if(title in officers) + commissioned = TRUE + break + + working_title += initial(name) + + for(var/suf in suffixes) + for(var/title in suf) + if(title in stolen_valor) + working_title += " " + suf[title] + break + + name = working_title + +/mob/living/simple_animal/bot/cleanbot/examine(mob/user) + . = ..() + if(weapon) + . += " Is that \a [weapon] taped to it...?" + /mob/living/simple_animal/bot/cleanbot/Initialize() . = ..() get_targets() @@ -45,6 +97,18 @@ access_card.access += J.get_access() prev_access = access_card.access + stolen_valor = list() + + prefixes = list(command, security, engineering) + suffixes = list(research, medical, legal) + +/mob/living/simple_animal/bot/cleanbot/Destroy() + if(weapon) + var/atom/Tsec = drop_location() + weapon.force = weapon_orig_force + drop_part(weapon, Tsec) + return ..() + /mob/living/simple_animal/bot/cleanbot/turn_on() ..() icon_state = "cleanbot[on]" @@ -66,6 +130,23 @@ text_dehack = "[name]'s software has been reset!" text_dehack_fail = "[name] does not seem to respond to your repair code!" +/mob/living/simple_animal/bot/cleanbot/Crossed(atom/movable/AM) + . = ..() + + zone_selected = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + if(weapon && has_gravity() && ismob(AM)) + var/mob/living/carbon/C = AM + if(!istype(C)) + return + + weapon.attack(C, src) + C.Knockdown(20) + + if(!(C.job in stolen_valor)) + stolen_valor += C.job + update_titles() + return + /mob/living/simple_animal/bot/cleanbot/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) if(bot_core.allowed(user) && !open && !emagged) @@ -79,6 +160,11 @@ else to_chat(user, "The [src] doesn't seem to respect your authority.") + else if(istype(W, /obj/item/kitchen/knife) && user.a_intent != INTENT_HARM) + to_chat(user, "You start attaching the [W] to \the [src]...") + if(do_after(user, 40, target = src)) + deputize(W, user) + else if(istype(W, /obj/item/mop/advanced)) if(bot_core.allowed(user) && open && !CHECK_BITFIELD(upgrades,UPGRADE_CLEANER_ADVANCED_MOP)) to_chat(user, "You replace \the [src] old mop with a new better one!") From fd076ec7bb31249bd807f3962b89b478207dc5fc Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sat, 13 Jun 2020 16:19:32 -0700 Subject: [PATCH 2/2] Update cleanbot.dm --- .../mob/living/simple_animal/bot/cleanbot.dm | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index c87bda6edc..f6aad5c03f 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -38,6 +38,7 @@ var/obj/item/weapon var/weapon_orig_force = 0 + var/chosen_name var/list/stolen_valor @@ -58,8 +59,8 @@ user.transferItemToLoc(W, src) weapon = W weapon_orig_force = weapon.force - weapon.force = weapon.force / 2 - icon_state = "cleanbot[on]" + if(!emagged) + weapon.force = weapon.force / 2 add_overlay(image(icon=weapon.lefthand_file,icon_state=weapon.item_state)) /mob/living/simple_animal/bot/cleanbot/proc/update_titles() @@ -73,7 +74,7 @@ commissioned = TRUE break - working_title += initial(name) + working_title += chosen_name for(var/suf in suffixes) for(var/title in suf) @@ -90,6 +91,7 @@ /mob/living/simple_animal/bot/cleanbot/Initialize() . = ..() + chosen_name = name get_targets() icon_state = "cleanbot[on]" @@ -121,6 +123,8 @@ /mob/living/simple_animal/bot/cleanbot/bot_reset() ..() + if(weapon && (emagged == 2)) + weapon.force = weapon_orig_force ignore_list = list() //Allows the bot to clean targets it previously ignored due to being unreachable. target = null oldloc = null @@ -139,13 +143,12 @@ if(!istype(C)) return - weapon.attack(C, src) - C.Knockdown(20) - if(!(C.job in stolen_valor)) stolen_valor += C.job update_titles() - return + + weapon.attack(C, src) + C.Knockdown(20) /mob/living/simple_animal/bot/cleanbot/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) @@ -161,8 +164,8 @@ to_chat(user, "The [src] doesn't seem to respect your authority.") else if(istype(W, /obj/item/kitchen/knife) && user.a_intent != INTENT_HARM) - to_chat(user, "You start attaching the [W] to \the [src]...") - if(do_after(user, 40, target = src)) + to_chat(user, "You start attaching \the [W] to \the [src]...") + if(do_after(user, 25, target = src)) deputize(W, user) else if(istype(W, /obj/item/mop/advanced)) @@ -173,10 +176,10 @@ window_name = "Automatic Station Cleaner v2.1 BETA" //New! qdel(W) if(!open) - to_chat(user, "The [src] access pannle is not open!") + to_chat(user, "The [src] access panel is not open!") return if(!bot_core.allowed(user)) - to_chat(user, "The [src] access pannel locked off to you!") + to_chat(user, "The [src] access panel locked off to you!") return else to_chat(user, "The [src] already has this mop!") @@ -202,6 +205,8 @@ /mob/living/simple_animal/bot/cleanbot/emag_act(mob/user) . = ..() if(emagged == 2) + if(weapon) + weapon.force = weapon_orig_force if(user) to_chat(user, "[src] buzzes and beeps.")