Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into skill-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SapphicOverload committed Dec 4, 2024
2 parents 4675a1a + c114781 commit b22d530
Show file tree
Hide file tree
Showing 21 changed files with 166 additions and 159 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
///from base of /mob/living/start_pulling: (atom/movable/AM, state, force)
#define COMSIG_MOB_PULL "mob_pull"
#define COMPONENT_BLOCK_PULL (1<<0) // blocks pulling
///from base of /obj/item/pickup: (obj/item/item)
#define COMSIG_MOB_PICKUP_ITEM "mob_pickup_item"
///Mob is trying to open the wires of a target [/atom], from /datum/wires/interactable(): (atom/target)
#define COMSIG_TRY_WIRES_INTERACT "try_wires_interact"
#define COMPONENT_CANT_INTERACT_WIRES (1<<0)
Expand Down
30 changes: 2 additions & 28 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,6 @@ GLOBAL_LIST_EMPTY(species_list)
return
LAZYSET(user.do_afters, interaction_key, current_interaction_count + 1)

var/atom/user_loc = user.loc
var/atom/target_loc = target?.loc

var/drifting = FALSE
if(!user.Process_Spacemove() && user.inertia_dir)
drifting = TRUE

var/holding = user.get_active_held_item()

if(!(timed_action_flags & IGNORE_SLOWDOWNS))
delay *= user.action_speed_modifier * user.do_after_coefficent() //yogs: darkspawn

Expand All @@ -350,7 +341,7 @@ GLOBAL_LIST_EMPTY(species_list)

var/datum/progressbar/progbar
if(progress)
progbar = new(user, delay, target || user, skill_check)
progbar = new(user, delay, target || user, timed_action_flags, extra_checks, skill_check)

SEND_SIGNAL(user, COMSIG_DO_AFTER_BEGAN)

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

if(!QDELETED(progbar))
progbar.update(world.time - starttime)

if(drifting && !user.inertia_dir)
drifting = FALSE
user_loc = user.loc

if(QDELETED(user) \
|| (!(timed_action_flags & IGNORE_USER_LOC_CHANGE) && !drifting && user.loc != user_loc) \
|| (!(timed_action_flags & IGNORE_HELD_ITEM) && user.get_active_held_item() != holding) \
|| (!(timed_action_flags & IGNORE_INCAPACITATED) && HAS_TRAIT(user, TRAIT_INCAPACITATED)) \
|| (extra_checks && !extra_checks.Invoke()))
. = FALSE
break

if(target && (user != target) && \
(QDELETED(target) \
|| (!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE) && target.loc != target_loc)))
if(QDELETED(progbar) || !progbar.update(world.time - starttime))
. = FALSE
break

Expand Down
41 changes: 39 additions & 2 deletions code/datums/progressbar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@
var/mob/user
///The client seeing the progress bar.
var/client/user_client
///Extra checks for whether to stop the progress.
var/datum/callback/extra_checks
///Effectively the number of steps the progress bar will need to do before reaching completion.
var/goal = 1
///Control check to see if the progress was interrupted before reaching its goal.
var/last_progress = 0
///Variable to ensure smooth visual stacking on multiple progress bars.
var/listindex = 0
///Whether progress has already been ended.
var/progress_ended = FALSE


/datum/progressbar/New(mob/User, goal_number, atom/target, skill_check)
/datum/progressbar/New(mob/User, goal_number, atom/target, timed_action_flags = NONE, skill_check)
. = ..()
if (!istype(target))
stack_trace("Invalid target [target] passed in")
Expand Down Expand Up @@ -58,6 +62,23 @@
RegisterSignal(user, COMSIG_QDELETING, PROC_REF(on_user_delete))
RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(clean_user_client))
RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(on_user_login))
if(!(timed_action_flags & IGNORE_USER_LOC_CHANGE))
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
var/obj/mecha/mech = user.loc
if(ismecha(user.loc) && user == mech.occupant)
RegisterSignal(mech, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
if(!(timed_action_flags & IGNORE_TARGET_LOC_CHANGE))
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
if(!(timed_action_flags & IGNORE_HELD_ITEM))
var/obj/item/held = user.get_active_held_item()
if(held)
RegisterSignal(held, COMSIG_ITEM_EQUIPPED, PROC_REF(end_progress))
RegisterSignal(held, COMSIG_ITEM_DROPPED, PROC_REF(end_progress))
else
RegisterSignal(user, COMSIG_MOB_PICKUP_ITEM, PROC_REF(end_progress))
RegisterSignal(user, COMSIG_MOB_SWAPPING_HANDS, PROC_REF(end_progress))
if(!(timed_action_flags & IGNORE_INCAPACITATED))
RegisterSignal(user, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), PROC_REF(end_progress))


/datum/progressbar/Destroy()
Expand Down Expand Up @@ -139,15 +160,24 @@

///Updates the progress bar image visually.
/datum/progressbar/proc/update(progress)
if(progress_ended)
return FALSE
progress = clamp(progress, 0, goal)
if(progress == last_progress)
return
return FALSE
last_progress = progress
if(extra_checks && !extra_checks.Invoke())
return FALSE
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
return TRUE


///Called on progress end, be it successful or a failure. Wraps up things to delete the datum and bar.
/datum/progressbar/proc/end_progress()
if(progress_ended)
return
progress_ended = TRUE

if(last_progress != goal)
bar.icon_state = "[bar.icon_state]_fail"

Expand All @@ -157,6 +187,13 @@

QDEL_IN(src, PROGRESSBAR_ANIMATION_TIME)

/datum/progressbar/proc/on_moved(atom/movable/mover, atom/old_loc, movement_dir, forced, list/old_locs, momentum_change, interrupting)
SIGNAL_HANDLER
if(!interrupting)
return
if(!mover.Process_Spacemove() && mover.inertia_dir)
return
INVOKE_ASYNC(src, PROC_REF(end_progress))

#undef SKILL_ICON_OFFSET_Y
#undef SKILL_ICON_OFFSET_X
Expand Down
32 changes: 32 additions & 0 deletions code/datums/traits/negative.dm
Original file line number Diff line number Diff line change
Expand Up @@ -985,3 +985,35 @@
if(!old_limb.is_organic_limb())
cybernetics_level--
update_mood()

/datum/quirk/lactose_intolerance
name = "Lactose Intolerance"
desc = "You don't tolerate milk or other dairy products."
icon = "utensils"
gain_text = span_danger("You suddenly feel intolerant towards milk.")
lose_text = span_notice("You feel like you could drink milk again.")
medical_record_text = "Patient is lactose intolerant."
value = -1

/datum/quirk/lactose_intolerance/check_quirk(datum/preferences/prefs)
var/datum/species/species_type = prefs.read_preference(/datum/preference/choiced/species)
if(initial(species_type.toxic_food) & DAIRY)
return "You're already lactose intolerant!"
species_type = new species_type()
if((TRAIT_POWERHUNGRY in species_type.inherent_traits) || (TRAIT_NOHUNGER in species_type.inherent_traits))
return "You don't eat food!"
return FALSE

/datum/quirk/lactose_intolerance/add()
if(!ishuman(quirk_holder))
return
var/mob/living/carbon/carbon_holder = quirk_holder
var/datum/species/spec = carbon_holder.dna.species
spec.toxic_food |= DAIRY
RegisterSignal(carbon_holder, COMSIG_SPECIES_GAIN, PROC_REF(on_species_gain))

/datum/quirk/lactose_intolerance/remove()
UnregisterSignal(quirk_holder, COMSIG_SPECIES_GAIN)

/datum/quirk/lactose_intolerance/proc/on_species_gain(datum/source, datum/species/new_species)
new_species.toxic_food |= DAIRY // no escape from your terrible fate
5 changes: 3 additions & 2 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,9 @@
* * The forced flag indicates whether this was a forced move, which skips many checks of regular movement.
* * The old_locs is an optional argument, in case the moved movable was present in multiple locations before the movement.
* * momentum_change represents whether this movement is due to a "new" force if TRUE or an already "existing" force if FALSE
* * interrupting will cancel any do_after progress bars that should be canceled by moving.
**/
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
/atom/movable/proc/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE, interrupting = TRUE)
SHOULD_CALL_PARENT(TRUE)

if (!inertia_moving && momentum_change)
Expand All @@ -755,7 +756,7 @@
if (!moving_diagonally && client_mobs_in_contents)
update_parallax_contents()

SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs, momentum_change)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs, momentum_change, interrupting)

if(old_loc)
SEND_SIGNAL(old_loc, COMSIG_ATOM_ABSTRACT_EXITED, src, movement_dir)
Expand Down
10 changes: 4 additions & 6 deletions code/game/mecha/equipment/mecha_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
if(!chassis)
return FALSE
set_ready_state(FALSE)
. = do_after(chassis.occupant, equip_cooldown * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target, chassis.loc))
. = do_after(chassis.occupant, equip_cooldown * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target))
set_ready_state(TRUE)
if(!.)
return
Expand All @@ -158,16 +158,14 @@
/obj/item/mecha_parts/mecha_equipment/proc/do_after_mecha(atom/target, delay)
if(!chassis)
return
return do_after(chassis.occupant, delay * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target, chassis.loc))
return do_after(chassis.occupant, delay * check_eva(), target, extra_checks = CALLBACK(src, PROC_REF(do_after_checks), target))

/obj/item/mecha_parts/mecha_equipment/proc/do_after_checks(atom/target, atom/old_loc)
/obj/item/mecha_parts/mecha_equipment/proc/do_after_checks(atom/target)
if(!chassis)
return FALSE
if(chassis.loc != old_loc || chassis.inertia_dir)
return FALSE
if(src != chassis.selected)
return FALSE
if(!(chassis.omnidirectional_attacks || (get_dir(chassis, target) & chassis.dir)))
if(target && !(chassis.omnidirectional_attacks || (get_dir(chassis, target) & chassis.dir)))
return FALSE
return TRUE

Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
/obj/item/proc/pickup(mob/user)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_ITEM_PICKUP, user)
SEND_SIGNAL(user, COMSIG_MOB_PICKUP_ITEM, src)
item_flags |= IN_INVENTORY

// called when "found" in pockets and storage items. Returns 1 if the search should end.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/ghost_role/sentience.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ GLOBAL_LIST_INIT(high_priority_sentience, typecacheof(list(

/datum/round_event/ghost_role/sentience/spawn_role()
var/list/mob/dead/observer/candidates
candidates = get_candidates(ROLE_ALIEN, null, ROLE_ALIEN)
candidates = get_candidates(ROLE_SENTIENCE, null, ROLE_SENTIENCE)

// find our chosen mob to breathe life into
// Mobs have to be simple animals, mindless, on station, and NOT holograms.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/jobs/job_types/_job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
if(outfit_override || outfit)
H.equipOutfit(outfit_override ? outfit_override : outfit, visualsOnly)

H.dna.species.after_equip_job(src, H, visualsOnly)
H.dna.species.after_equip_job(src, H, preference_source)

for(var/skill in base_skills)
H.adjust_skill(skill, base_skills[skill])
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mining/equipment/regenerative_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
if(proximity_flag && ishuman(target))
var/mob/living/carbon/human/H = target
var/turf/user_turf = get_turf(user)
if(isipc(target))
return
if(inert)
to_chat(user, span_notice("[src] has decayed and can no longer be used to heal."))
return
Expand Down Expand Up @@ -117,6 +119,8 @@

/obj/item/organ/regenerative_core/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
. = ..()
if(isipc(M))
return
if(!preserved && !inert)
preserved(TRUE)
owner.visible_message(span_notice("[src] stabilizes as it's inserted."))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/_species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
/datum/species/proc/before_equip_job(datum/job/J, mob/living/carbon/human/H)
return

/datum/species/proc/after_equip_job(datum/job/J, mob/living/carbon/human/H)
/datum/species/proc/after_equip_job(datum/job/J, mob/living/carbon/human/H, client/preference_source)
H.update_mutant_bodyparts()

// Do species-specific reagent handling here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
meat = /obj/item/reagent_containers/food/snacks/meat/slab/human/mutant/lizard
skinned_type = /obj/item/stack/sheet/animalhide/lizard
exotic_bloodtype = "L"
disliked_food = SUGAR | VEGETABLES
toxic_food = parent_type::toxic_food | DAIRY
liked_food = MEAT | GRILLED | SEAFOOD | MICE | FRUIT
inert_mutation = FIREBREATH
deathsound = 'sound/voice/lizard/deathsound.ogg'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/mob/living/simple_animal/triceratops
name = "Bismuth"
desc = "Acient, Reliable, Good at Pathfinding."
desc = "Ancient, Reliable, Good at Pathfinding."
icon = 'icons/mob/pets.dmi'
icon_state = "bismuth"
icon_living = "bismuth"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/modular_computers/computers/item/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@
. = ..()
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)

/obj/item/modular_computer/proc/parent_moved()
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED)
/obj/item/modular_computer/proc/parent_moved(datum/source, atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE, interrupting = TRUE)
SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED, old_loc, movement_dir, forced, old_locs, momentum_change, interrupting)

/obj/item/modular_computer/proc/uplink_check(mob/living/M, code)
return SEND_SIGNAL(src, COMSIG_NTOS_CHANGE_RINGTONE, M, code) & COMPONENT_STOP_RINGTONE_CHANGE
Expand Down
5 changes: 5 additions & 0 deletions code/modules/reagents/chemistry/reagents/drink_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@
glass_desc = "White and nutritious goodness!"
default_container = /obj/item/reagent_containers/food/condiment/milk

/datum/reagent/consumable/milk/on_mob_life(mob/living/carbon/M)
. = ..()
if(M.dna?.species?.toxic_food & DAIRY)
M.adjust_disgust(min(volume / 2, 5))

/datum/reagent/consumable/milk/coconut
name = "Coconut Milk"
description = "An opaque white liquid produced by the mammary glands of a coconut... wait what?"
Expand Down
Loading

0 comments on commit b22d530

Please sign in to comment.