Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit b22d530

Browse files
Merge remote-tracking branch 'upstream/master' into skill-issue
2 parents 4675a1a + c114781 commit b22d530

File tree

21 files changed

+166
-159
lines changed

21 files changed

+166
-159
lines changed

code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@
134134
///from base of /mob/living/start_pulling: (atom/movable/AM, state, force)
135135
#define COMSIG_MOB_PULL "mob_pull"
136136
#define COMPONENT_BLOCK_PULL (1<<0) // blocks pulling
137+
///from base of /obj/item/pickup: (obj/item/item)
138+
#define COMSIG_MOB_PICKUP_ITEM "mob_pickup_item"
137139
///Mob is trying to open the wires of a target [/atom], from /datum/wires/interactable(): (atom/target)
138140
#define COMSIG_TRY_WIRES_INTERACT "try_wires_interact"
139141
#define COMPONENT_CANT_INTERACT_WIRES (1<<0)

code/__HELPERS/mobs.dm

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,6 @@ GLOBAL_LIST_EMPTY(species_list)
333333
return
334334
LAZYSET(user.do_afters, interaction_key, current_interaction_count + 1)
335335

336-
var/atom/user_loc = user.loc
337-
var/atom/target_loc = target?.loc
338-
339-
var/drifting = FALSE
340-
if(!user.Process_Spacemove() && user.inertia_dir)
341-
drifting = TRUE
342-
343-
var/holding = user.get_active_held_item()
344-
345336
if(!(timed_action_flags & IGNORE_SLOWDOWNS))
346337
delay *= user.action_speed_modifier * user.do_after_coefficent() //yogs: darkspawn
347338

@@ -350,7 +341,7 @@ GLOBAL_LIST_EMPTY(species_list)
350341

351342
var/datum/progressbar/progbar
352343
if(progress)
353-
progbar = new(user, delay, target || user, skill_check)
344+
progbar = new(user, delay, target || user, timed_action_flags, extra_checks, skill_check)
354345

355346
SEND_SIGNAL(user, COMSIG_DO_AFTER_BEGAN)
356347

@@ -360,24 +351,7 @@ GLOBAL_LIST_EMPTY(species_list)
360351
while (world.time < endtime)
361352
stoplag(1)
362353

363-
if(!QDELETED(progbar))
364-
progbar.update(world.time - starttime)
365-
366-
if(drifting && !user.inertia_dir)
367-
drifting = FALSE
368-
user_loc = user.loc
369-
370-
if(QDELETED(user) \
371-
|| (!(timed_action_flags & IGNORE_USER_LOC_CHANGE) && !drifting && user.loc != user_loc) \
372-
|| (!(timed_action_flags & IGNORE_HELD_ITEM) && user.get_active_held_item() != holding) \
373-
|| (!(timed_action_flags & IGNORE_INCAPACITATED) && HAS_TRAIT(user, TRAIT_INCAPACITATED)) \
374-
|| (extra_checks && !extra_checks.Invoke()))
375-
. = FALSE
376-
break
377-
378-
if(target && (user != target) && \
379-
(QDELETED(target) \
380-
|| (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && target.loc != target_loc)))
354+
if(QDELETED(progbar) || !progbar.update(world.time - starttime))
381355
. = FALSE
382356
break
383357

code/datums/progressbar.dm

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
var/mob/user
1515
///The client seeing the progress bar.
1616
var/client/user_client
17+
///Extra checks for whether to stop the progress.
18+
var/datum/callback/extra_checks
1719
///Effectively the number of steps the progress bar will need to do before reaching completion.
1820
var/goal = 1
1921
///Control check to see if the progress was interrupted before reaching its goal.
2022
var/last_progress = 0
2123
///Variable to ensure smooth visual stacking on multiple progress bars.
2224
var/listindex = 0
25+
///Whether progress has already been ended.
26+
var/progress_ended = FALSE
2327

2428

25-
/datum/progressbar/New(mob/User, goal_number, atom/target, skill_check)
29+
/datum/progressbar/New(mob/User, goal_number, atom/target, timed_action_flags = NONE, skill_check)
2630
. = ..()
2731
if (!istype(target))
2832
stack_trace("Invalid target [target] passed in")
@@ -58,6 +62,23 @@
5862
RegisterSignal(user, COMSIG_QDELETING, PROC_REF(on_user_delete))
5963
RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(clean_user_client))
6064
RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(on_user_login))
65+
if(!(timed_action_flags & IGNORE_USER_LOC_CHANGE))
66+
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
67+
var/obj/mecha/mech = user.loc
68+
if(ismecha(user.loc) && user == mech.occupant)
69+
RegisterSignal(mech, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
70+
if(!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE))
71+
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
72+
if(!(timed_action_flags & IGNORE_HELD_ITEM))
73+
var/obj/item/held = user.get_active_held_item()
74+
if(held)
75+
RegisterSignal(held, COMSIG_ITEM_EQUIPPED, PROC_REF(end_progress))
76+
RegisterSignal(held, COMSIG_ITEM_DROPPED, PROC_REF(end_progress))
77+
else
78+
RegisterSignal(user, COMSIG_MOB_PICKUP_ITEM, PROC_REF(end_progress))
79+
RegisterSignal(user, COMSIG_MOB_SWAPPING_HANDS, PROC_REF(end_progress))
80+
if(!(timed_action_flags & IGNORE_INCAPACITATED))
81+
RegisterSignal(user, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), PROC_REF(end_progress))
6182

6283

6384
/datum/progressbar/Destroy()
@@ -139,15 +160,24 @@
139160

140161
///Updates the progress bar image visually.
141162
/datum/progressbar/proc/update(progress)
163+
if(progress_ended)
164+
return FALSE
142165
progress = clamp(progress, 0, goal)
143166
if(progress == last_progress)
144-
return
167+
return FALSE
145168
last_progress = progress
169+
if(extra_checks && !extra_checks.Invoke())
170+
return FALSE
146171
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
172+
return TRUE
147173

148174

149175
///Called on progress end, be it successful or a failure. Wraps up things to delete the datum and bar.
150176
/datum/progressbar/proc/end_progress()
177+
if(progress_ended)
178+
return
179+
progress_ended = TRUE
180+
151181
if(last_progress != goal)
152182
bar.icon_state = "[bar.icon_state]_fail"
153183

@@ -157,6 +187,13 @@
157187

158188
QDEL_IN(src, PROGRESSBAR_ANIMATION_TIME)
159189

190+
/datum/progressbar/proc/on_moved(atom/movable/mover, atom/old_loc, movement_dir, forced, list/old_locs, momentum_change, interrupting)
191+
SIGNAL_HANDLER
192+
if(!interrupting)
193+
return
194+
if(!mover.Process_Spacemove() && mover.inertia_dir)
195+
return
196+
INVOKE_ASYNC(src, PROC_REF(end_progress))
160197

161198
#undef SKILL_ICON_OFFSET_Y
162199
#undef SKILL_ICON_OFFSET_X

code/datums/traits/negative.dm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,3 +985,35 @@
985985
if(!old_limb.is_organic_limb())
986986
cybernetics_level--
987987
update_mood()
988+
989+
/datum/quirk/lactose_intolerance
990+
name = "Lactose Intolerance"
991+
desc = "You don't tolerate milk or other dairy products."
992+
icon = "utensils"
993+
gain_text = span_danger("You suddenly feel intolerant towards milk.")
994+
lose_text = span_notice("You feel like you could drink milk again.")
995+
medical_record_text = "Patient is lactose intolerant."
996+
value = -1
997+
998+
/datum/quirk/lactose_intolerance/check_quirk(datum/preferences/prefs)
999+
var/datum/species/species_type = prefs.read_preference(/datum/preference/choiced/species)
1000+
if(initial(species_type.toxic_food) & DAIRY)
1001+
return "You're already lactose intolerant!"
1002+
species_type = new species_type()
1003+
if((TRAIT_POWERHUNGRY in species_type.inherent_traits) || (TRAIT_NOHUNGER in species_type.inherent_traits))
1004+
return "You don't eat food!"
1005+
return FALSE
1006+
1007+
/datum/quirk/lactose_intolerance/add()
1008+
if(!ishuman(quirk_holder))
1009+
return
1010+
var/mob/living/carbon/carbon_holder = quirk_holder
1011+
var/datum/species/spec = carbon_holder.dna.species
1012+
spec.toxic_food |= DAIRY
1013+
RegisterSignal(carbon_holder, COMSIG_SPECIES_GAIN, PROC_REF(on_species_gain))
1014+
1015+
/datum/quirk/lactose_intolerance/remove()
1016+
UnregisterSignal(quirk_holder, COMSIG_SPECIES_GAIN)
1017+
1018+
/datum/quirk/lactose_intolerance/proc/on_species_gain(datum/source, datum/species/new_species)
1019+
new_species.toxic_food |= DAIRY // no escape from your terrible fate

code/game/atoms_movable.dm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,9 @@
743743
* * The forced flag indicates whether this was a forced move, which skips many checks of regular movement.
744744
* * The old_locs is an optional argument, in case the moved movable was present in multiple locations before the movement.
745745
* * momentum_change represents whether this movement is due to a "new" force if TRUE or an already "existing" force if FALSE
746+
* * interrupting will cancel any do_after progress bars that should be canceled by moving.
746747
**/
747-
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
748+
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE, interrupting = TRUE)
748749
SHOULD_CALL_PARENT(TRUE)
749750

750751
if (!inertia_moving && momentum_change)
@@ -755,7 +756,7 @@
755756
if (!moving_diagonally && client_mobs_in_contents)
756757
update_parallax_contents()
757758

758-
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs, momentum_change)
759+
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs, momentum_change, interrupting)
759760

760761
if(old_loc)
761762
SEND_SIGNAL(old_loc, COMSIG_ATOM_ABSTRACT_EXITED, src, movement_dir)

code/game/mecha/equipment/mecha_equipment.dm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
if(!chassis)
149149
return FALSE
150150
set_ready_state(FALSE)
151-
. = do_after(chassis.occupant, equip_cooldown * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target, chassis.loc))
151+
. = do_after(chassis.occupant, equip_cooldown * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target))
152152
set_ready_state(TRUE)
153153
if(!.)
154154
return
@@ -158,16 +158,14 @@
158158
/obj/item/mecha_parts/mecha_equipment/proc/do_after_mecha(atom/target, delay)
159159
if(!chassis)
160160
return
161-
return do_after(chassis.occupant, delay * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target, chassis.loc))
161+
return do_after(chassis.occupant, delay * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target))
162162

163-
/obj/item/mecha_parts/mecha_equipment/proc/do_after_checks(atom/target, atom/old_loc)
163+
/obj/item/mecha_parts/mecha_equipment/proc/do_after_checks(atom/target)
164164
if(!chassis)
165165
return FALSE
166-
if(chassis.loc != old_loc || chassis.inertia_dir)
167-
return FALSE
168166
if(src != chassis.selected)
169167
return FALSE
170-
if(!(chassis.omnidirectional_attacks || (get_dir(chassis, target) & chassis.dir)))
168+
if(target && !(chassis.omnidirectional_attacks || (get_dir(chassis, target) & chassis.dir)))
171169
return FALSE
172170
return TRUE
173171

code/game/objects/items.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
537537
/obj/item/proc/pickup(mob/user)
538538
SHOULD_CALL_PARENT(TRUE)
539539
SEND_SIGNAL(src, COMSIG_ITEM_PICKUP, user)
540+
SEND_SIGNAL(user, COMSIG_MOB_PICKUP_ITEM, src)
540541
item_flags |= IN_INVENTORY
541542

542543
// called when "found" in pockets and storage items. Returns 1 if the search should end.

code/modules/events/ghost_role/sentience.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ GLOBAL_LIST_INIT(high_priority_sentience, typecacheof(list(
4747

4848
/datum/round_event/ghost_role/sentience/spawn_role()
4949
var/list/mob/dead/observer/candidates
50-
candidates = get_candidates(ROLE_ALIEN, null, ROLE_ALIEN)
50+
candidates = get_candidates(ROLE_SENTIENCE, null, ROLE_SENTIENCE)
5151

5252
// find our chosen mob to breathe life into
5353
// Mobs have to be simple animals, mindless, on station, and NOT holograms.

code/modules/jobs/job_types/_job.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
if(outfit_override || outfit)
190190
H.equipOutfit(outfit_override ? outfit_override : outfit, visualsOnly)
191191

192-
H.dna.species.after_equip_job(src, H, visualsOnly)
192+
H.dna.species.after_equip_job(src, H, preference_source)
193193

194194
for(var/skill in base_skills)
195195
H.adjust_skill(skill, base_skills[skill])

code/modules/mining/equipment/regenerative_core.dm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
if(proximity_flag && ishuman(target))
8080
var/mob/living/carbon/human/H = target
8181
var/turf/user_turf = get_turf(user)
82+
if(isipc(target))
83+
return
8284
if(inert)
8385
to_chat(user, span_notice("[src] has decayed and can no longer be used to heal."))
8486
return
@@ -117,6 +119,8 @@
117119

118120
/obj/item/organ/regenerative_core/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
119121
. = ..()
122+
if(isipc(M))
123+
return
120124
if(!preserved && !inert)
121125
preserved(TRUE)
122126
owner.visible_message(span_notice("[src] stabilizes as it's inserted."))

0 commit comments

Comments
 (0)