Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fix medibots #987

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/medkit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
icon_state = "medkit_advanced"
inhand_icon_state = "medkit-rad"
custom_premium_price = PAYCHECK_COMMAND * 6
damagetype_healed = "all"
damagetype_healed = HEAL_ALL_DAMAGE

/obj/item/storage/medkit/advanced/PopulateContents()
if(empty)
Expand All @@ -276,7 +276,7 @@
desc = "I hope you've got insurance."
icon_state = "medkit_tactical"
inhand_icon_state = "medkit-tactical"
damagetype_healed = "all"
damagetype_healed = HEAL_ALL_DAMAGE

/obj/item/storage/medkit/tactical/Initialize(mapload)
. = ..()
Expand Down
48 changes: 44 additions & 4 deletions code/modules/mob/living/basic/bots/medbot/medbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
anchored = FALSE
health = 20
maxHealth = 20
speed = 2
pass_flags = PASSMOB | PASSFLAPS
status_flags = (CANPUSH | CANSTUN)
ai_controller = /datum/ai_controller/basic_controller/bot/medbot
Expand Down Expand Up @@ -138,7 +139,6 @@
AddElement(/datum/element/hat_wearer, offsets = hat_offsets)
RegisterSignal(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(pre_attack))


if(!HAS_TRAIT(SSstation, STATION_TRAIT_MEDBOT_MANIA) || !mapload || !is_station_level(z))
return
skin = "advanced"
Expand Down Expand Up @@ -246,6 +246,18 @@
playsound(src, SFX_SPARKS, 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
return TRUE

/mob/living/basic/bot/medbot/examine()
. = ..()
if(!(medical_mode_flags & MEDBOT_TIPPED_MODE))
return
var/static/list/panic_state = list(
"It appears to be tipped over, and is quietly waiting for someone to set it right.",
"It is tipped over and requesting help.",
"They are tipped over and appear visibly distressed.",
span_warning("They are tipped over and visibly panicking!"),
span_warning(span_bold("They are freaking out from being tipped over!"))
)
. += pick(panic_state)
/*
* Proc used in a callback for before this medibot is tipped by the tippable component.
*
Expand All @@ -263,6 +275,8 @@
medical_mode_flags |= MEDBOT_TIPPED_MODE
tipper = WEAKREF(user)
playsound(src, 'sound/machines/warning-buzzer.ogg', 50)
if(prob(10))
speak("PSYCH ALERT: Crewmember [user.name] recorded displaying antisocial tendencies torturing bots in [get_area(src)]. Please schedule psych evaluation.", radio_channel)

/*
* Proc used in a callback for after this medibot is righted, either by themselves or by a mob, by the tippable component.
Expand Down Expand Up @@ -300,17 +314,43 @@
if(DOING_INTERACTION(src, TEND_DAMAGE_INTERACTION))
return

if(!isnull(client))
if((damage_type_healer == HEAL_ALL_DAMAGE && patient.get_total_damage() <= heal_threshold) || (!(damage_type_healer == HEAL_ALL_DAMAGE) && patient.get_current_damage_of_type(damage_type_healer) <= heal_threshold))
to_chat(src, "[patient] is healthy! Your programming prevents you from tending the wounds of anyone with less than [heal_threshold + 1] [damage_type_healer == HEAL_ALL_DAMAGE ? "total" : damage_type_healer] damage.")
return

update_bot_mode(new_mode = BOT_HEALING, update_hud = FALSE)
patient.visible_message("[src] is trying to tend the wounds of [patient]", span_userdanger("[src] is trying to tend your wounds!"))
if(!do_after(src, delay = 2.5 SECONDS, target = patient, interaction_key = TEND_DAMAGE_INTERACTION)) //SKYRAT EDIT CHANGE : Increased time as tradeoff for automated healing. ORIGINAL: if(!do_after(src, delay = 0.5 SECONDS, target = patient, interaction_key = TEND_DAMAGE_INTERACTION))
update_bot_mode(new_mode = BOT_IDLE)
return
var/modified_heal_amount = heal_amount
var/done_healing = FALSE
if(damage_type_healer == BRUTE && medkit_type == /obj/item/storage/medkit/brute)
modified_heal_amount *= 1.1
if(bot_access_flags & BOT_COVER_EMAGGED)
patient.reagents?.add_reagent(/datum/reagent/toxin/chloralhydrate, 5)
log_combat(src, patient, "pretended to tend wounds on", "internal tools")
else if(damage_type_healer == HEAL_ALL_DAMAGE)
patient.heal_overall_damage(heal_amount)
patient.heal_ordered_damage(amount = modified_heal_amount, damage_types = list(BRUTE, BURN, TOX, OXY))
log_combat(src, patient, "tended the wounds of", "internal tools")
if(patient.get_total_damage() <= heal_threshold)
done_healing = TRUE
else
patient.heal_damage_type(heal_amount = heal_amount, damagetype = damage_type_healer)
update_bot_mode(new_mode = BOT_IDLE)
patient.heal_damage_type(heal_amount = modified_heal_amount, damagetype = damage_type_healer)
log_combat(src, patient, "tended the wounds of", "internal tools")
if(patient.get_current_damage_of_type(damage_type_healer) <= heal_threshold)
done_healing = TRUE
patient.visible_message(span_notice("[src] tends the wounds of [patient]!"), "[span_infoplain(span_green("[src] tends your wounds!"))]")
//Go into idle only when we're done
if(done_healing)
visible_message(span_infoplain("[src] places its tools back into itself."))
to_chat(src, "[patient] is now healthy!")
update_bot_mode(new_mode = BOT_IDLE)
//If player-controlled, call them to heal again here for continous player healing
else if(!isnull(client))
melee_attack(patient)


/mob/living/basic/bot/medbot/autopatrol
bot_mode_flags = BOT_MODE_ON | BOT_MODE_AUTOPATROL | BOT_MODE_REMOTE_ENABLED | BOT_MODE_CAN_BE_SAPIENT | BOT_MODE_ROUNDSTART_POSSESSION
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/robot/emote.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SKYRAT EDIT REMOVAL
/datum/emote/silicon
mob_type_allowed_typecache = list(/mob/living/silicon, /mob/living/simple_animal/bot)
mob_type_allowed_typecache = list(/mob/living/silicon, /mob/living/simple_animal/bot, /mob/living/basic/bot)
emote_type = EMOTE_AUDIBLE

/datum/emote/silicon/boop
Expand Down
Loading