Skip to content

Commit abd366f

Browse files
authored
Bundle o fixes and changes (#1165)
* make current medbot work * forgor * bugs * fix pathfinding bug * cleanup ignore_list handling * make the timeout window smaller * add BOT_PATHING state * set_mode
1 parent afa943b commit abd366f

File tree

21 files changed

+472
-336
lines changed

21 files changed

+472
-336
lines changed

code/__DEFINES/robots.dm

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ DEFINE_BITFIELD(bot_cover_flags, list(
152152
#define BOT_RESPONDING "Proceeding to AI waypoint"
153153
/// Currently moving
154154
#define BOT_MOVING "Moving"
155+
/// Currently making a path
156+
#define BOT_PATHING "Pathing"
155157

156158
// Unique modes //
157159
/// Secbot - At target, preparing to arrest
@@ -225,3 +227,48 @@ DEFINE_BITFIELD(janitor_mode_flags, list(
225227
"CLEANBOT_CLEAN_PESTS" = CLEANBOT_CLEAN_PESTS,
226228
"CLEANBOT_CLEAN_DRAWINGS" = CLEANBOT_CLEAN_DRAWINGS,
227229
))
230+
231+
#define MEDIBOT_VOICED_HOLD_ON "Hey, %TARGET%! Hold on, I'm coming."
232+
#define MEDIBOT_VOICED_WANT_TO_HELP "Wait, %TARGET%! I want to help!"
233+
#define MEDIBOT_VOICED_YOU_ARE_INJURED "%TARGET%, you appear to be injured!"
234+
235+
#define MEDIBOT_VOICED_ALL_PATCHED_UP "All patched up!"
236+
#define MEDIBOT_VOICED_APPLE_A_DAY "An apple a day keeps me away."
237+
#define MEDIBOT_VOICED_FEEL_BETTER "Feel better soon!"
238+
239+
#define MEDIBOT_VOICED_STAY_WITH_ME "No! Stay with me!"
240+
#define MEDIBOT_VOICED_LIVE "Live, damnit! LIVE!"
241+
#define MEDIBOT_VOICED_NEVER_LOST "I...I've never lost a patient before. Not today, I mean."
242+
243+
#define MEDIBOT_VOICED_DELICIOUS "Delicious!"
244+
#define MEDIBOT_VOICED_PLASTIC_SURGEON "I knew it, I should've been a plastic surgeon."
245+
#define MEDIBOT_VOICED_MASK_ON "Radar, put a mask on!"
246+
#define MEDIBOT_VOICED_ALWAYS_A_CATCH "There's always a catch, and I'm the best there is."
247+
#define MEDIBOT_VOICED_LIKE_FLIES "What kind of medbay is this? Everyone's dropping like flies."
248+
#define MEDIBOT_VOICED_SUFFER "Why are we still here? Just to suffer?"
249+
250+
#define MEDIBOT_VOICED_FUCK_YOU "Fuck you."
251+
#define MEDIBOT_VOICED_NOT_A_GAME "Turn off your computer. This is not a game."
252+
#define MEDIBOT_VOICED_IM_DIFFERENT "I'm different!"
253+
#define MEDIBOT_VOICED_FOURTH_WALL "Close Dreamseeker.exe now. Or else."
254+
#define MEDIBOT_VOICED_SHINDEMASHOU "Shindemashou."
255+
256+
#define MEDIBOT_VOICED_WAIT "Hey, wait..."
257+
#define MEDIBOT_VOICED_DONT "Please don't..."
258+
#define MEDIBOT_VOICED_TRUSTED_YOU "I trusted you..."
259+
#define MEDIBOT_VOICED_NO_SAD "Nooo..."
260+
#define MEDIBOT_VOICED_OH_FUCK "Oh fuck-"
261+
262+
#define MEDIBOT_VOICED_FORGIVE "I forgive you."
263+
#define MEDIBOT_VOICED_THANKS "Thank you!"
264+
#define MEDIBOT_VOICED_GOOD_PERSON "You are a good person."
265+
#define MEDIBOT_VOICED_BEHAVIOUR_REPORTED "Your behavior has been reported, have a nice day."
266+
267+
#define MEDIBOT_VOICED_ASSISTANCE "I require assistance."
268+
#define MEDIBOT_VOICED_PUT_BACK "Please put me back."
269+
#define MEDIBOT_VOICED_IM_SCARED "Please, I am scared!"
270+
#define MEDIBOT_VOICED_NEED_HELP "I don't like this, I need help!"
271+
#define MEDIBOT_VOICED_THIS_HURTS "This hurts, my pain is real!"
272+
#define MEDIBOT_VOICED_THE_END "Is this the end?"
273+
#define MEDIBOT_VOICED_NOOO "Nooo!"
274+
#define MEDIBOT_VOICED_CHICKEN "LOOK AT ME?! I am a chicken."

code/__HELPERS/paths/jps_path.dm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,17 @@
147147
QDEL_NULL(open)
148148

149149
var/list/path = src.path || list()
150-
reverse_range(path)
150+
if(length(path))
151+
reverse_range(path)
151152

152-
switch(diagonal_handling)
153-
if(DIAGONAL_REMOVE_CLUNKY)
154-
path = remove_clunky_diagonals(path, pass_info, simulated_only, avoid)
155-
if(DIAGONAL_REMOVE_ALL)
156-
path = remove_diagonals(path, pass_info, simulated_only, avoid)
153+
switch(diagonal_handling)
154+
if(DIAGONAL_REMOVE_CLUNKY)
155+
path = remove_clunky_diagonals(path, pass_info, simulated_only, avoid)
156+
if(DIAGONAL_REMOVE_ALL)
157+
path = remove_diagonals(path, pass_info, simulated_only, avoid)
157158

158-
if(length(path) > 0 && skip_first)
159-
path.Cut(1,2)
159+
if(length(path) > 0 && skip_first)
160+
path.Cut(1,2)
160161

161162
hand_back(path)
162163
return ..()

code/__HELPERS/paths/path.dm

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,24 @@
2121
* * diagonal_handling: defines how we handle diagonal moves. see __DEFINES/path.dm
2222
*/
2323
/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)
24-
var/list/path = list()
24+
var/datum/pathfind_packet/packet = new
2525
// We're guarenteed that list will be the first list in pathfinding_finished's argset because of how callback handles the arguments list
26-
var/datum/callback/await = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), path)
26+
var/datum/callback/await = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(pathfinding_finished), packet)
2727
if(!SSpathfinder.pathfind(caller, end, max_distance, mintargetdist, access, simulated_only, exclude, skip_first, diagonal_handling, await))
2828
return list()
2929

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

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

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

4243
/datum/pathfind
4344
/// The turf we started at
@@ -97,7 +98,7 @@
9798
* Call to return a value to whoever spawned this pathfinding work
9899
* Will fail if it's already been called
99100
*/
100-
/datum/pathfind/proc/hand_back(value)
101+
/datum/pathfind/proc/hand_back(list/value)
101102
set waitfor = FALSE
102103
on_finish?.Invoke(value)
103104
on_finish = null

code/game/data_huds.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ Diagnostic HUDs!
509509
new_state = "hudpatrol"
510510
if(BOT_PREP_ARREST, BOT_ARREST, BOT_HUNT) //STOP RIGHT THERE, CRIMINAL SCUM!
511511
new_state = "hudalert"
512-
if(BOT_MOVING, BOT_DELIVER, BOT_GO_HOME, BOT_NAV) //Moving to target for normal bots, moving to deliver or go home for MULES.
512+
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.
513513
new_state = "hudmove"
514514
else
515515
new_state = ""

code/game/objects/items/devices/scanners/health_analyzer.dm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@
6464

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

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

7069
switch (scanmode)
7170
if (SCANMODE_HEALTH)
72-
healthscan(user, M, advanced, mode)
71+
healthscan(user, M, advanced, mode, TRUE)
7372
if (SCANMODE_CHEM)
7473
chemscan(user, M)
7574
if (SCANMODE_SURGERY)

code/modules/clothing/suits/armor.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
fallback_colors = list(list(14, 18))
33
fallback_icon_state = "armor"
44
allowed = null
5+
clothing_flags = parent_type::clothing_flags | THICKMATERIAL
56
body_parts_covered = CHEST
67
cold_protection = CHEST|GROIN
78
min_cold_protection_temperature = ARMOR_MIN_TEMP_PROTECT

code/modules/do_after/do_after.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* * max_interact_count: The action will automatically fail if they are already performing this many or more actions with the given interaction_key.
1313
* * display: An atom or image to display over the user's head. Only works with DO_PUBLIC flag.
1414
*/
15-
/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)
15+
/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)
1616
if(!user)
1717
return FALSE
1818

code/modules/mob/living/damage_procs.dm

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,25 @@
9292
final_mod *= new_mod
9393
return final_mod
9494

95+
/**
96+
* Simply a wrapper for calling mob adjustXLoss() procs to heal a certain damage type,
97+
* when you don't know what damage type you're healing exactly.
98+
*/
99+
/mob/living/proc/heal_damage_type(heal_amount = 0, damagetype = BRUTE)
100+
heal_amount = abs(heal_amount) * -1
101+
102+
switch(damagetype)
103+
if(BRUTE)
104+
return adjustBruteLoss(heal_amount)
105+
if(BURN)
106+
return adjustFireLoss(heal_amount)
107+
if(TOX)
108+
return adjustToxLoss(heal_amount)
109+
if(OXY)
110+
return adjustOxyLoss(heal_amount)
111+
if(STAMINA)
112+
stamina.adjust(-heal_amount)
113+
95114
///like [apply_damage][/mob/living/proc/apply_damage] except it always uses the damage procs
96115
/mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE)
97116
switch(damagetype)

code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
SSmove_manager.stop_looping(src)
6767
look_for_perp() // see if any criminals are in range
6868
if(!mode && bot_mode_flags & BOT_MODE_AUTOPATROL) // still idle, and set to patrol
69-
mode = BOT_START_PATROL // switch to patrol mode
69+
set_mode(BOT_START_PATROL)
7070
if(BOT_HUNT) // hunting for perp
7171
update_appearance()
7272
playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1)
@@ -123,7 +123,7 @@
123123
visible_message(span_warning("[src] ignites his energy swords!"))
124124
icon_state = "grievous-c"
125125
visible_message("<b>[src]</b> points at [C.name]!")
126-
mode = BOT_HUNT
126+
set_mode(BOT_HUNT)
127127
INVOKE_ASYNC(src, PROC_REF(handle_automated_action))
128128
break
129129
else

0 commit comments

Comments
 (0)