Skip to content

Commit

Permalink
Merge pull request #548 from Werenimal/master
Browse files Browse the repository at this point in the history
Pubby Update
  • Loading branch information
ORCACommander authored Sep 10, 2024
2 parents 24147b7 + 263256d commit ca97e7f
Show file tree
Hide file tree
Showing 90 changed files with 896 additions and 640 deletions.
646 changes: 348 additions & 298 deletions _maps/map_files/PubbyStation/PubbyStation.dmm

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

/// Called on the mind when an antagonist is being removed, after the antagonist list has updated (datum/antagonist/antagonist)
#define COMSIG_ANTAGONIST_REMOVED "antagonist_removed"

/// Called on the mob when losing an antagonist datum (datum/antagonist/antagonist)
#define COMSIG_MOB_ANTAGONIST_REMOVED "mob_antagonist_removed"
3 changes: 0 additions & 3 deletions code/__DEFINES/dcs/signals/signals_movetype.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// /datum/element/movetype_handler signals
/// Called when the floating anim has to be temporarily stopped and restarted later: (timer)
#define COMSIG_PAUSE_FLOATING_ANIM "pause_floating_anim"
/// From base of datum/element/movetype_handler/on_movement_type_trait_gain: (flag, old_movement_type)
#define COMSIG_MOVETYPE_FLAG_ENABLED "movetype_flag_enabled"
/// From base of datum/element/movetype_handler/on_movement_type_trait_loss: (flag, old_movement_type)
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ GLOBAL_LIST_INIT(layers_to_offset, list(

/// Possible value of [/atom/movable/buckle_lying]. If set to a different (positive-or-zero) value than this, the buckling thing will force a lying angle on the buckled.
#define NO_BUCKLE_LYING -1
/// Possible value of [/atom/movable/buckle_dir]. If set to a different (positive-or-zero) value than this, the buckling thing will force a dir on the buckled.
#define BUCKLE_MATCH_DIR -1

// Flags for fully_heal().

Expand Down
3 changes: 3 additions & 0 deletions code/__DEFINES/traits/sources.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
/// Trait given by a fulton extraction pack
#define FULTON_PACK_TRAIT "fulton-pack"

/// Trait from mob/living/update_transform()
#define UPDATE_TRANSFORM_TRAIT "update_transform"

/// Trait granted by the berserker hood.
#define BERSERK_TRAIT "berserk_trait"
/// Trait granted by [/obj/item/rod_of_asclepius]
Expand Down
3 changes: 2 additions & 1 deletion code/datums/components/face_decal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
GLOBAL_LIST_INIT(creamable, typecacheof(list(
/mob/living/carbon/human,
/mob/living/basic/pet/dog/corgi,
/mob/living/silicon/ai)))
/mob/living/silicon/ai,
)))

/datum/component/face_decal/creampie/Initialize()
. = ..()
Expand Down
56 changes: 56 additions & 0 deletions code/datums/elements/block_turf_fingerprints.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* ## block_turf_fingerprints
*
* Attach to a movable, prevents mobs from leaving fingerprints on the turf below it
*/
/datum/element/block_turf_fingerprints
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY

/datum/element/block_turf_fingerprints/Attach(datum/target)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE

var/atom/movable/target_movable = target
if(isturf(target_movable.loc))
apply_to_turf(target_movable.loc)

RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(move_turf))

/datum/element/block_turf_fingerprints/Detach(atom/movable/target)
. = ..()
if(isturf(target.loc))
remove_from_turf(target.loc)

UnregisterSignal(target, COMSIG_MOVABLE_MOVED)

/datum/element/block_turf_fingerprints/proc/apply_to_turf(turf/the_turf)
// It's possible two things with this element could be on the same turf, so let's avoid double-applying
if(the_turf.interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND)
// But what if the turf has this flag by default? We still need to override register a signal.
// Otherwise we may run into a very niche bug:
// - A turf as this flag by default
// - A movable with this element is placed on the turf
// - It does not gain the flag nor register a signal
// - The turf changes, and the new turf does not gain the flag
if(initial(the_turf.interaction_flags_atom) & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND)
RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf), override = TRUE)
return

the_turf.interaction_flags_atom |= INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND
RegisterSignal(the_turf, COMSIG_TURF_CHANGE, PROC_REF(replace_our_turf))

/datum/element/block_turf_fingerprints/proc/remove_from_turf(turf/the_turf)
the_turf.interaction_flags_atom &= ~INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND
UnregisterSignal(the_turf, COMSIG_TURF_CHANGE)

/datum/element/block_turf_fingerprints/proc/move_turf(atom/movable/source, atom/old_loc)
SIGNAL_HANDLER
if(isturf(old_loc))
remove_from_turf(old_loc)
if(isturf(source.loc))
apply_to_turf(source.loc)

/datum/element/block_turf_fingerprints/proc/replace_our_turf(datum/source, path, new_baseturfs, flags, post_change_callbacks)
SIGNAL_HANDLER
post_change_callbacks += CALLBACK(src, PROC_REF(apply_to_turf))
27 changes: 2 additions & 25 deletions code/datums/elements/movetype_handler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY

var/list/attached_atoms = list()
var/list/paused_floating_anim_atoms = list()

/datum/element/movetype_handler/Attach(datum/target)
. = ..()
Expand All @@ -22,7 +21,6 @@
RegisterSignals(movable_target, GLOB.movement_type_removetrait_signals, PROC_REF(on_movement_type_trait_loss))
RegisterSignal(movable_target, SIGNAL_ADDTRAIT(TRAIT_NO_FLOATING_ANIM), PROC_REF(on_no_floating_anim_trait_gain))
RegisterSignal(movable_target, SIGNAL_REMOVETRAIT(TRAIT_NO_FLOATING_ANIM), PROC_REF(on_no_floating_anim_trait_loss))
RegisterSignal(movable_target, COMSIG_PAUSE_FLOATING_ANIM, PROC_REF(pause_floating_anim))
attached_atoms[movable_target] = TRUE

if(movable_target.movement_type & (FLOATING|FLYING) && !HAS_TRAIT(movable_target, TRAIT_NO_FLOATING_ANIM))
Expand All @@ -32,14 +30,12 @@
var/list/signals_to_remove = list(
SIGNAL_ADDTRAIT(TRAIT_NO_FLOATING_ANIM),
SIGNAL_REMOVETRAIT(TRAIT_NO_FLOATING_ANIM),
COMSIG_PAUSE_FLOATING_ANIM
)
signals_to_remove += GLOB.movement_type_addtrait_signals
signals_to_remove += GLOB.movement_type_removetrait_signals
UnregisterSignal(source, signals_to_remove)

attached_atoms -= source
paused_floating_anim_atoms -= source
STOP_FLOATING_ANIM(source)
return ..()

Expand All @@ -51,7 +47,7 @@
return
var/old_state = source.movement_type
source.movement_type |= flag
if(!(old_state & (FLOATING|FLYING)) && (source.movement_type & (FLOATING|FLYING)) && !paused_floating_anim_atoms[source] && !HAS_TRAIT(source, TRAIT_NO_FLOATING_ANIM))
if(!(old_state & (FLOATING|FLYING)) && (source.movement_type & (FLOATING|FLYING)) && !HAS_TRAIT(source, TRAIT_NO_FLOATING_ANIM))
DO_FLOATING_ANIM(source)
SEND_SIGNAL(source, COMSIG_MOVETYPE_FLAG_ENABLED, flag, old_state)

Expand All @@ -78,24 +74,5 @@
/// Called when the TRAIT_NO_FLOATING_ANIM trait is removed from the mob. Restarts the bobbing animation.
/datum/element/movetype_handler/proc/on_no_floating_anim_trait_loss(atom/movable/source, trait)
SIGNAL_HANDLER
if(source.movement_type & (FLOATING|FLYING) && !paused_floating_anim_atoms[source])
if(source.movement_type & (FLOATING|FLYING))
DO_FLOATING_ANIM(source)

///Pauses the floating animation for the duration of the timer... plus [tickrate - (world.time + timer) % tickrate] to be precise.
/datum/element/movetype_handler/proc/pause_floating_anim(atom/movable/source, timer)
SIGNAL_HANDLER
if(paused_floating_anim_atoms[source] < world.time + timer)
STOP_FLOATING_ANIM(source)
if(!length(paused_floating_anim_atoms))
START_PROCESSING(SSdcs, src) //1 second tickrate.
paused_floating_anim_atoms[source] = world.time + timer

/datum/element/movetype_handler/process()
for(var/_paused in paused_floating_anim_atoms)
var/atom/movable/paused = _paused
if(paused_floating_anim_atoms[paused] < world.time)
if(paused.movement_type & (FLOATING|FLYING) && !HAS_TRAIT(paused, TRAIT_NO_FLOATING_ANIM))
DO_FLOATING_ANIM(paused)
paused_floating_anim_atoms -= paused
if(!length(paused_floating_anim_atoms))
STOP_PROCESSING(SSdcs, src)
15 changes: 11 additions & 4 deletions code/datums/looping_sounds/machinery_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@
falloff_distance = 1 //Instant falloff after initial tile

/datum/looping_sound/gravgen
mid_sounds = list('sound/machines/gravgen/gravgen_mid1.ogg' = 1, 'sound/machines/gravgen/gravgen_mid2.ogg' = 1, 'sound/machines/gravgen/gravgen_mid3.ogg' = 1, 'sound/machines/gravgen/gravgen_mid4.ogg' = 1)
mid_length = 1.8 SECONDS
extra_range = 10
volume = 20
start_sound = 'sound/machines/gravgen/grav_gen_start.ogg'
start_length = 1 SECONDS
mid_sounds = list(
'sound/machines/gravgen/grav_gen_mid1.ogg' = 12,
'sound/machines/gravgen/grav_gen_mid2.ogg' = 1,
)
mid_length = 1.1 SECONDS
end_sound = 'sound/machines/gravgen/grav_gen_end.ogg'
extra_range = 8
vary = TRUE
volume = 70
falloff_distance = 5
falloff_exponent = 20

Expand Down
69 changes: 55 additions & 14 deletions code/game/atom/alternate_appearance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,51 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
GLOB.active_alternate_appearances += src

for(var/mob in GLOB.player_list)
if(mobShouldSee(mob))
show_to(mob)
apply_to_new_mob(mob)

/datum/atom_hud/alternate_appearance/Destroy()
GLOB.active_alternate_appearances -= src
return ..()

/datum/atom_hud/alternate_appearance/proc/onNewMob(mob/M)
if(mobShouldSee(M))
show_to(M)
/// Wrapper for applying this alt hud to the passed mob (if they should see it)
/datum/atom_hud/alternate_appearance/proc/apply_to_new_mob(mob/applying_to)
if(mobShouldSee(applying_to))
if(!hud_users_all_z_levels[applying_to])
show_to(applying_to)
return TRUE
return FALSE

/// Checks if the passed mob should be seeing this hud
/datum/atom_hud/alternate_appearance/proc/mobShouldSee(mob/M)
return FALSE

/datum/atom_hud/alternate_appearance/show_to(mob/new_viewer)
. = ..()
if(!new_viewer)
return
track_mob(new_viewer)

/// Registers some signals to track the mob's state to determine if they should be seeing the hud still
/datum/atom_hud/alternate_appearance/proc/track_mob(mob/new_viewer)
return

/datum/atom_hud/alternate_appearance/hide_from(mob/former_viewer, absolute)
. = ..()
if(!former_viewer || hud_atoms_all_z_levels[former_viewer] >= 1)
return
untrack_mob(former_viewer)

/// Unregisters the signals that were tracking the mob's state
/datum/atom_hud/alternate_appearance/proc/untrack_mob(mob/former_viewer)
return

/datum/atom_hud/alternate_appearance/proc/check_hud(mob/source)
SIGNAL_HANDLER
// Attempt to re-apply the hud entirely
if(!apply_to_new_mob(source))
// If that failed, probably shouldn't be seeing it at all, so nuke it
hide_from(source, absolute = TRUE)

/datum/atom_hud/alternate_appearance/add_atom_to_hud(atom/A, image/I)
. = ..()
if(.)
Expand Down Expand Up @@ -99,6 +130,22 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
if(ghost_appearance)
QDEL_NULL(ghost_appearance)

/datum/atom_hud/alternate_appearance/basic/track_mob(mob/new_viewer)
RegisterSignals(new_viewer, list(
COMSIG_MOB_ANTAGONIST_REMOVED,
COMSIG_MOB_GHOSTIZED,
COMSIG_MOB_MIND_TRANSFERRED_INTO,
COMSIG_MOB_MIND_TRANSFERRED_OUT_OF,
), PROC_REF(check_hud), override = TRUE)

/datum/atom_hud/alternate_appearance/basic/untrack_mob(mob/former_viewer)
UnregisterSignal(former_viewer, list(
COMSIG_MOB_ANTAGONIST_REMOVED,
COMSIG_MOB_GHOSTIZED,
COMSIG_MOB_MIND_TRANSFERRED_INTO,
COMSIG_MOB_MIND_TRANSFERRED_OUT_OF,
))

/datum/atom_hud/alternate_appearance/basic/add_atom_to_hud(atom/A)
LAZYINITLIST(A.hud_list)
A.hud_list[appearance_key] = image
Expand Down Expand Up @@ -136,16 +183,10 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
/datum/atom_hud/alternate_appearance/basic/noncult

/datum/atom_hud/alternate_appearance/basic/noncult/mobShouldSee(mob/M)
if(!IS_CULTIST(M))
return TRUE
return FALSE

/datum/atom_hud/alternate_appearance/basic/cult
return !IS_CULTIST(M)

/datum/atom_hud/alternate_appearance/basic/cult/mobShouldSee(mob/M)
if(IS_CULTIST(M))
return TRUE
return FALSE
/datum/atom_hud/alternate_appearance/basic/has_antagonist/cult
antag_datum_type = /datum/antagonist/cult

/datum/atom_hud/alternate_appearance/basic/blessed_aware

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/big_manipulator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
return
if(!manipulator_hand)
create_manipulator_hand()
manipulator_hand.forceMove(get_turf(src))

/obj/machinery/big_manipulator/wrench_act(mob/living/user, obj/item/tool)
. = ..()
Expand Down Expand Up @@ -103,8 +102,9 @@

/// Creat manipulator hand effect on manipulator core.
/obj/machinery/big_manipulator/proc/create_manipulator_hand()
manipulator_hand = new/obj/effect/big_manipulator_hand(get_turf(src))
manipulator_hand = new/obj/effect/big_manipulator_hand(src)
manipulator_hand.dir = take_here
vis_contents += manipulator_hand

/// Check servo tier and change manipulator speed, power_use and colour.
/obj/machinery/big_manipulator/proc/manipulator_lvl()
Expand Down
9 changes: 9 additions & 0 deletions code/game/machinery/stasis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
obj_flags = BLOCKS_CONSTRUCTION
can_buckle = TRUE
buckle_lying = 90
buckle_dir = SOUTH
circuit = /obj/item/circuitboard/machine/stasis
fair_market_price = 10
payment_department = ACCOUNT_MED
Expand All @@ -22,6 +23,7 @@
/obj/machinery/stasis/Initialize(mapload)
. = ..()
AddElement(/datum/element/elevation, pixel_shift = 6)
update_buckle_vars(dir)

/obj/machinery/stasis/examine(mob/user)
. = ..()
Expand Down Expand Up @@ -57,6 +59,13 @@
thaw_them(L)
return ..()

/obj/machinery/stasis/setDir(newdir)
. = ..()
update_buckle_vars(newdir)

/obj/machinery/stasis/proc/update_buckle_vars(newdir)
buckle_lying = newdir & NORTHEAST ? 270 : 90

/obj/machinery/stasis/proc/stasis_running()
return stasis_enabled && is_operational

Expand Down
7 changes: 6 additions & 1 deletion code/game/objects/buckling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
var/can_buckle = FALSE
/// Bed-like behaviour, forces mob.lying = buckle_lying if not set to [NO_BUCKLE_LYING].
var/buckle_lying = NO_BUCKLE_LYING
/// Bed-like behaviour, sets mob dir to buckle_dir if not set to [BUCKLE_MATCH_DIR]. If set to [BUCKLE_MATCH_DIR], makes mob dir match ours.
var/buckle_dir = BUCKLE_MATCH_DIR
/// Require people to be handcuffed before being able to buckle. eg: pipes
var/buckle_requires_restraints = FALSE
/// The mobs currently buckled to this atom
Expand Down Expand Up @@ -106,7 +108,10 @@
M.set_glide_size(glide_size)

M.Move(loc)
M.setDir(dir)
if(buckle_dir == BUCKLE_MATCH_DIR)
M.setDir(dir)
else
M.setDir(buckle_dir)

//Something has unbuckled us in reaction to the above movement
if(!M.buckled)
Expand Down
8 changes: 8 additions & 0 deletions code/game/objects/effects/phased_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
jaunter.forceMove(src)
if(ismob(jaunter))
var/mob/mob_jaunter = jaunter
RegisterSignal(mob_jaunter, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change))
mob_jaunter.reset_perspective(src)

/obj/effect/dummy/phased_mob/Destroy()
Expand Down Expand Up @@ -55,6 +56,7 @@
/obj/effect/dummy/phased_mob/Exited(atom/movable/gone, direction)
. = ..()
if(gone == jaunter)
UnregisterSignal(jaunter, COMSIG_MOB_STATCHANGE)
SEND_SIGNAL(src, COMSIG_MOB_EJECTED_FROM_JAUNT, jaunter)
jaunter = null

Expand Down Expand Up @@ -98,3 +100,9 @@
newloc = can_z_move(direction, get_turf(src), newloc, ZMOVE_INCAPACITATED_CHECKS | ZMOVE_FEEDBACK | ZMOVE_ALLOW_ANCHORED, user)

return newloc

/// Signal proc for [COMSIG_MOB_STATCHANGE], to throw us out of the jaunt if we lose consciousness.
/obj/effect/dummy/phased_mob/proc/on_stat_change(mob/living/source, new_stat, old_stat)
SIGNAL_HANDLER
if(source == jaunter && source.stat != CONSCIOUS)
eject_jaunter()
4 changes: 3 additions & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1851,9 +1851,11 @@
/obj/item/proc/set_embed(datum/embed_data/embed)
if(embed_data == embed)
return
if(isnull(get_embed())) // Add embed on objects that did not have it added
AddElement(/datum/element/embed)
if(!GLOB.embed_by_type[embed_data?.type])
qdel(embed_data)
embed_data = ispath(embed) ? get_embed_by_type(armor) : embed
embed_data = ispath(embed) ? get_embed_by_type(embed) : embed
SEND_SIGNAL(src, COMSIG_ITEM_EMBEDDING_UPDATE)

/**
Expand Down
Loading

0 comments on commit ca97e7f

Please sign in to comment.