Skip to content

Commit

Permalink
Bundle o fixes and changes (#1165)
Browse files Browse the repository at this point in the history
* make current medbot work

* forgor

* bugs

* fix pathfinding bug

* cleanup ignore_list handling

* make the timeout window smaller

* add BOT_PATHING state

* set_mode
  • Loading branch information
Kapu1178 authored Dec 26, 2024
1 parent afa943b commit abd366f
Show file tree
Hide file tree
Showing 21 changed files with 472 additions and 336 deletions.
47 changes: 47 additions & 0 deletions code/__DEFINES/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ DEFINE_BITFIELD(bot_cover_flags, list(
#define BOT_RESPONDING "Proceeding to AI waypoint"
/// Currently moving
#define BOT_MOVING "Moving"
/// Currently making a path
#define BOT_PATHING "Pathing"

// Unique modes //
/// Secbot - At target, preparing to arrest
Expand Down Expand Up @@ -225,3 +227,48 @@ DEFINE_BITFIELD(janitor_mode_flags, list(
"CLEANBOT_CLEAN_PESTS" = CLEANBOT_CLEAN_PESTS,
"CLEANBOT_CLEAN_DRAWINGS" = CLEANBOT_CLEAN_DRAWINGS,
))

#define MEDIBOT_VOICED_HOLD_ON "Hey, %TARGET%! Hold on, I'm coming."
#define MEDIBOT_VOICED_WANT_TO_HELP "Wait, %TARGET%! I want to help!"
#define MEDIBOT_VOICED_YOU_ARE_INJURED "%TARGET%, you appear to be injured!"

#define MEDIBOT_VOICED_ALL_PATCHED_UP "All patched up!"
#define MEDIBOT_VOICED_APPLE_A_DAY "An apple a day keeps me away."
#define MEDIBOT_VOICED_FEEL_BETTER "Feel better soon!"

#define MEDIBOT_VOICED_STAY_WITH_ME "No! Stay with me!"
#define MEDIBOT_VOICED_LIVE "Live, damnit! LIVE!"
#define MEDIBOT_VOICED_NEVER_LOST "I...I've never lost a patient before. Not today, I mean."

#define MEDIBOT_VOICED_DELICIOUS "Delicious!"
#define MEDIBOT_VOICED_PLASTIC_SURGEON "I knew it, I should've been a plastic surgeon."
#define MEDIBOT_VOICED_MASK_ON "Radar, put a mask on!"
#define MEDIBOT_VOICED_ALWAYS_A_CATCH "There's always a catch, and I'm the best there is."
#define MEDIBOT_VOICED_LIKE_FLIES "What kind of medbay is this? Everyone's dropping like flies."
#define MEDIBOT_VOICED_SUFFER "Why are we still here? Just to suffer?"

#define MEDIBOT_VOICED_FUCK_YOU "Fuck you."
#define MEDIBOT_VOICED_NOT_A_GAME "Turn off your computer. This is not a game."
#define MEDIBOT_VOICED_IM_DIFFERENT "I'm different!"
#define MEDIBOT_VOICED_FOURTH_WALL "Close Dreamseeker.exe now. Or else."
#define MEDIBOT_VOICED_SHINDEMASHOU "Shindemashou."

#define MEDIBOT_VOICED_WAIT "Hey, wait..."
#define MEDIBOT_VOICED_DONT "Please don't..."
#define MEDIBOT_VOICED_TRUSTED_YOU "I trusted you..."
#define MEDIBOT_VOICED_NO_SAD "Nooo..."
#define MEDIBOT_VOICED_OH_FUCK "Oh fuck-"

#define MEDIBOT_VOICED_FORGIVE "I forgive you."
#define MEDIBOT_VOICED_THANKS "Thank you!"
#define MEDIBOT_VOICED_GOOD_PERSON "You are a good person."
#define MEDIBOT_VOICED_BEHAVIOUR_REPORTED "Your behavior has been reported, have a nice day."

#define MEDIBOT_VOICED_ASSISTANCE "I require assistance."
#define MEDIBOT_VOICED_PUT_BACK "Please put me back."
#define MEDIBOT_VOICED_IM_SCARED "Please, I am scared!"
#define MEDIBOT_VOICED_NEED_HELP "I don't like this, I need help!"
#define MEDIBOT_VOICED_THIS_HURTS "This hurts, my pain is real!"
#define MEDIBOT_VOICED_THE_END "Is this the end?"
#define MEDIBOT_VOICED_NOOO "Nooo!"
#define MEDIBOT_VOICED_CHICKEN "LOOK AT ME?! I am a chicken."
17 changes: 9 additions & 8 deletions code/__HELPERS/paths/jps_path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,17 @@
QDEL_NULL(open)

var/list/path = src.path || list()
reverse_range(path)
if(length(path))
reverse_range(path)

switch(diagonal_handling)
if(DIAGONAL_REMOVE_CLUNKY)
path = remove_clunky_diagonals(path, pass_info, simulated_only, avoid)
if(DIAGONAL_REMOVE_ALL)
path = remove_diagonals(path, pass_info, simulated_only, avoid)
switch(diagonal_handling)
if(DIAGONAL_REMOVE_CLUNKY)
path = remove_clunky_diagonals(path, pass_info, simulated_only, avoid)
if(DIAGONAL_REMOVE_ALL)
path = remove_diagonals(path, pass_info, simulated_only, avoid)

if(length(path) > 0 && skip_first)
path.Cut(1,2)
if(length(path) > 0 && skip_first)
path.Cut(1,2)

hand_back(path)
return ..()
Expand Down
21 changes: 11 additions & 10 deletions code/__HELPERS/paths/path.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@
* * diagonal_handling: defines how we handle diagonal moves. see __DEFINES/path.dm
*/
/proc/jps_path_to(atom/movable/caller, atom/end, max_distance = 30, mintargetdist, list/access, simulated_only = TRUE, turf/exclude, skip_first=TRUE, diagonal_handling=DIAGONAL_REMOVE_CLUNKY)
var/list/path = list()
var/datum/pathfind_packet/packet = new
// We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list
var/datum/callback/await = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), path)
var/datum/callback/await = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), packet)
if(!SSpathfinder.pathfind(caller, end, max_distance, mintargetdist, access, simulated_only, exclude, skip_first, diagonal_handling, await))
return list()

UNTIL(length(path))
if(length(path) == 1 && path[1] == null || (QDELETED(caller) || QDELETED(end))) // It's trash, just hand back null to make it easy
return list()
return path
UNTIL(packet.path)
return packet.path

/// Uses funny pass by reference bullshit to take the path created by pathfinding, and insert it into a return list
/// We'll be able to use this return list to tell a sleeping proc to continue execution
/proc/pathfinding_finished(list/return_list, list/path)
// We use += here to ensure the list is still pointing at the same thing
return_list += path
/proc/pathfinding_finished(datum/pathfind_packet/return_packet, list/path)
return_packet.path = path || list()

/// Wrapper around the path list since we play with refs.
/datum/pathfind_packet
/// The unwound path, set when it's finished.
var/list/path

/datum/pathfind
/// The turf we started at
Expand Down Expand Up @@ -97,7 +98,7 @@
* Call to return a value to whoever spawned this pathfinding work
* Will fail if it's already been called
*/
/datum/pathfind/proc/hand_back(value)
/datum/pathfind/proc/hand_back(list/value)
set waitfor = FALSE
on_finish?.Invoke(value)
on_finish = null
Expand Down
2 changes: 1 addition & 1 deletion code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ Diagnostic HUDs!
new_state = "hudpatrol"
if(BOT_PREP_ARREST, BOT_ARREST, BOT_HUNT) //STOP RIGHT THERE, CRIMINAL SCUM!
new_state = "hudalert"
if(BOT_MOVING, BOT_DELIVER, BOT_GO_HOME, BOT_NAV) //Moving to target for normal bots, moving to deliver or go home for MULES.
if(BOT_MOVING, BOT_PATHING, BOT_DELIVER, BOT_GO_HOME, BOT_NAV) //Moving to target for normal bots, moving to deliver or go home for MULES.
new_state = "hudmove"
else
new_state = ""
Expand Down
5 changes: 2 additions & 3 deletions code/game/objects/items/devices/scanners/health_analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@

playsound(user, 'sound/items/healthanalyzer.ogg', 50, 1)

user.visible_message(span_notice("[user] analyzes [M]'s vitals."), \
span_notice("You analyze [M]'s vitals."))
user.visible_message(span_notice("[user] analyzes [M] with [src]."))

switch (scanmode)
if (SCANMODE_HEALTH)
healthscan(user, M, advanced, mode)
healthscan(user, M, advanced, mode, TRUE)
if (SCANMODE_CHEM)
chemscan(user, M)
if (SCANMODE_SURGERY)
Expand Down
1 change: 1 addition & 0 deletions code/modules/clothing/suits/armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
fallback_colors = list(list(14, 18))
fallback_icon_state = "armor"
allowed = null
clothing_flags = parent_type::clothing_flags | THICKMATERIAL
body_parts_covered = CHEST
cold_protection = CHEST|GROIN
min_cold_protection_temperature = ARMOR_MIN_TEMP_PROTECT
Expand Down
2 changes: 1 addition & 1 deletion code/modules/do_after/do_after.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* * max_interact_count: The action will automatically fail if they are already performing this many or more actions with the given interaction_key.
* * display: An atom or image to display over the user's head. Only works with DO_PUBLIC flag.
*/
/proc/do_after(atom/movable/user, atom/target, time, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1, image/display)
/proc/do_after(atom/movable/user, atom/target, time = 0, timed_action_flags = NONE, progress = TRUE, datum/callback/extra_checks, interaction_key, max_interact_count = 1, image/display)
if(!user)
return FALSE

Expand Down
19 changes: 19 additions & 0 deletions code/modules/mob/living/damage_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,25 @@
final_mod *= new_mod
return final_mod

/**
* Simply a wrapper for calling mob adjustXLoss() procs to heal a certain damage type,
* when you don't know what damage type you're healing exactly.
*/
/mob/living/proc/heal_damage_type(heal_amount = 0, damagetype = BRUTE)
heal_amount = abs(heal_amount) * -1

switch(damagetype)
if(BRUTE)
return adjustBruteLoss(heal_amount)
if(BURN)
return adjustFireLoss(heal_amount)
if(TOX)
return adjustToxLoss(heal_amount)
if(OXY)
return adjustOxyLoss(heal_amount)
if(STAMINA)
stamina.adjust(-heal_amount)

///like [apply_damage][/mob/living/proc/apply_damage] except it always uses the damage procs
/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE)
switch(damagetype)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
SSmove_manager.stop_looping(src)
look_for_perp() // see if any criminals are in range
if(!mode && bot_mode_flags & BOT_MODE_AUTOPATROL) // still idle, and set to patrol
mode = BOT_START_PATROL // switch to patrol mode
set_mode(BOT_START_PATROL)
if(BOT_HUNT) // hunting for perp
update_appearance()
playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1)
Expand Down Expand Up @@ -123,7 +123,7 @@
visible_message(span_warning("[src] ignites his energy swords!"))
icon_state = "grievous-c"
visible_message("<b>[src]</b> points at [C.name]!")
mode = BOT_HUNT
set_mode(BOT_HUNT)
INVOKE_ASYNC(src, PROC_REF(handle_automated_action))
break
else
Expand Down
Loading

0 comments on commit abd366f

Please sign in to comment.