Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Fluffy-Frontier/FluffySTG
Browse files Browse the repository at this point in the history
…into upstream-mirror-25322
  • Loading branch information
Iajret committed Nov 29, 2023
2 parents 7a40eaf + b63805f commit 4d0c823
Show file tree
Hide file tree
Showing 88 changed files with 1,231 additions and 407 deletions.
6 changes: 3 additions & 3 deletions _maps/map_files/MetaStation/MetaStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -53427,11 +53427,11 @@
/area/station/maintenance/starboard/fore)
"tbl" = (
/obj/machinery/door/firedoor,
/obj/machinery/door/airlock/public/glass{
name = "Kitchen"
},
/obj/effect/decal/cleanable/dirt,
/obj/effect/turf_decal/tile/bar/opposingcorners,
/obj/machinery/door/airlock/public/glass{
name = "Bar"
},
/turf/open/floor/iron,
/area/station/commons/lounge)
"tbp" = (
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/dcs/signals/signals_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@
#define FOOTSTEP_OVERRIDEN (1<<0)
///from base of datum/thrownthing/finalize(): (turf/turf, atom/movable/thrownthing) when something is thrown and lands on us
#define COMSIG_TURF_MOVABLE_THROW_LANDED "turf_movable_throw_landed"

///From element/elevation/reset_elevation(): (list/values)
#define COMSIG_TURF_RESET_ELEVATION "turf_reset_elevation"
#define ELEVATION_CURRENT_PIXEL_SHIFT 1
#define ELEVATION_MAX_PIXEL_SHIFT 2
2 changes: 1 addition & 1 deletion code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@

//Drones
#define ui_drone_drop "CENTER+1:18,SOUTH:5"
#define ui_drone_pull "CENTER+2:2,SOUTH:5"
#define ui_drone_pull "CENTER+1.5:2,SOUTH:5"
#define ui_drone_storage "CENTER-2:14,SOUTH:5"
#define ui_drone_head "CENTER-3:14,SOUTH:5"

Expand Down
7 changes: 6 additions & 1 deletion code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_EASILY_WOUNDED "easy_limb_wound"
#define TRAIT_HARDLY_WOUNDED "hard_limb_wound"
#define TRAIT_NEVER_WOUNDED "never_wounded"
/// Species with this trait have 50% extra chance of bleeding from piercing and slashing wounds
#define TRAIT_EASYBLEED "easybleed"
#define TRAIT_TOXINLOVER "toxinlover"
/// Doesn't get overlays from being in critical.
#define TRAIT_NOCRITOVERLAY "no_crit_overlay"
Expand Down Expand Up @@ -826,7 +828,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
/// Trait given to angelic constructs to let them purge cult runes
#define TRAIT_ANGELIC "angelic"


/// Trait given to a dreaming carbon when they are currently doing dreaming stuff
#define TRAIT_DREAMING "currently_dreaming"

///generic atom traits
/// Trait from [/datum/element/rust]. Its rusty and should be applying a special overlay to denote this.
Expand All @@ -843,6 +846,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_NO_MIRROR_REFLECTION "no_mirror_reflection"
/// If this movable is currently treading in a turf with the immerse element.
#define TRAIT_IMMERSED "immersed"
/// From [/datum/element/elevation_core] for purpose of checking if the turf has the trait from an instance of the element
#define TRAIT_ELEVATED_TURF "elevated_turf"
/**
* With this, the immerse overlay will give the atom its own submersion visual overlay
* instead of one that's also shared with other movables, thus making editing its appearance possible.
Expand Down
7 changes: 6 additions & 1 deletion code/__DEFINES/traits/macros.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// This file contains all of the "dynamic" trait sources that can be used in a number of versatile and everchanging ways.
// This file contains all of the "dynamic" traits and trait sources that can be used
// in a number of versatile and everchanging ways.
// If it uses psuedo-variables like the examples below, it's a macro-trait.


/// From [/datum/element/elevation] for purpose of registering/removing signals and detaching the elevation_core when the trait is absent.
#define TRAIT_TURF_HAS_ELEVATED_OBJ(z) "turf_has_elevated_obj_[z]"

/// The item is magically cursed
#define CURSED_ITEM_TRAIT(item_type) "cursed_item_[item_type]"
/// A trait given by a specific status effect (not sure why we need both but whatever!)
Expand Down
26 changes: 26 additions & 0 deletions code/_globalvars/phobias.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GLOBAL_LIST_INIT(phobia_types, sort_list(list(
"authority",
"birds",
"blood",
"carps",
"clowns",
"doctors",
"falling",
Expand All @@ -32,6 +33,7 @@ GLOBAL_LIST_INIT(phobia_regexes, list(
"authority" = construct_phobia_regex("authority"),
"birds" = construct_phobia_regex("birds"),
"blood" = construct_phobia_regex("blood"),
"carps" = construct_phobia_regex("carps"),
"clowns" = construct_phobia_regex("clowns"),
"conspiracies" = construct_phobia_regex("conspiracies"),
"doctors" = construct_phobia_regex("doctors"),
Expand Down Expand Up @@ -64,6 +66,9 @@ GLOBAL_LIST_INIT(phobia_mobs, list(
/mob/living/basic/parrot,
/mob/living/basic/pet/penguin,
)),
"carps" = typecacheof(list(
/mob/living/basic/carp,
)),
"conspiracies" = typecacheof(list(
/mob/living/basic/drone,
/mob/living/basic/pet/penguin,
Expand Down Expand Up @@ -234,6 +239,27 @@ GLOBAL_LIST_INIT(phobia_objs, list(
/obj/item/reagent_containers/syringe,
/obj/machinery/iv_drip,
)),
"carps" = typecacheof(list(
/obj/item/clothing/head/hooded/carp_hood,
/obj/item/clothing/suit/hooded/carp_costume,
/obj/item/clothing/head/fedora/carpskin,
/obj/item/clothing/mask/gas/carp,
/obj/item/clothing/mask/cigarette/carp,
/obj/item/clothing/under/suit/carpskin,
/obj/item/food/cubancarp,
/obj/item/food/fishmeat/carp,
/obj/item/grenade/clusterbuster/spawner_spesscarp,
/obj/item/grenade/spawnergrenade/spesscarp,
/obj/item/knife/carp,
/obj/item/nullrod/carp,
/obj/item/organ/internal/lungs/carp,
/obj/item/organ/internal/tongue/carp,
/obj/item/organ/internal/brain/carp,
/obj/item/organ/internal/heart/carp,
/obj/item/storage/fancy/cigarettes/cigpack_carp,
/obj/item/stack/sheet/animalhide/carp,
/obj/item/toy/plush/carpplushie,
)),
"clowns" = typecacheof(list(
/obj/item/bedsheet/clown,
/obj/item/clothing/head/chaplain/clownmitre,
Expand Down
3 changes: 3 additions & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,13 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_DISSECTED" = TRAIT_DISSECTED,
"TRAIT_DONT_WRITE_MEMORY" = TRAIT_DONT_WRITE_MEMORY,
"TRAIT_DOUBLE_TAP" = TRAIT_DOUBLE_TAP,
"TRAIT_DREAMING" = TRAIT_DREAMING,
"TRAIT_DRINKS_BLOOD" = TRAIT_DRINKS_BLOOD,
"TRAIT_DUMB" = TRAIT_DUMB,
"TRAIT_DWARF" = TRAIT_DWARF,
"TRAIT_EASILY_WOUNDED" = TRAIT_EASILY_WOUNDED,
"TRAIT_EASYDISMEMBER" = TRAIT_EASYDISMEMBER,
"TRAIT_EASYBLEED" = TRAIT_EASYBLEED,
"TRAIT_ECHOLOCATION_EXTRA_RANGE" = TRAIT_ECHOLOCATION_EXTRA_RANGE,
"TRAIT_ECHOLOCATION_RECEIVER" = TRAIT_ECHOLOCATION_RECEIVER,
"TRAIT_ELITE_CHALLENGER" = TRAIT_ELITE_CHALLENGER,
Expand Down Expand Up @@ -555,6 +557,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_SPINNING_WEB_TURF" = TRAIT_SPINNING_WEB_TURF,
"TRAIT_TURF_IGNORE_SLIPPERY" = TRAIT_TURF_IGNORE_SLIPPERY,
"TRAIT_TURF_IGNORE_SLOWDOWN" = TRAIT_TURF_IGNORE_SLOWDOWN,
"TRAIT_ELEVATED_TURF" = TRAIT_ELEVATED_TURF,
),
// SKYRAT EDIT ADDITION START - SKYRAT TRAITS
/obj/item/toy/plush/skyrat = list(
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ SUBSYSTEM_DEF(atoms)
if(fails & BAD_INIT_NO_HINT)
. += "- Didn't return an Initialize hint\n"
if(fails & BAD_INIT_QDEL_BEFORE)
. += "- Qdel'd in New()\n"
. += "- Qdel'd before Initialize proc ran\n"
if(fails & BAD_INIT_SLEPT)
. += "- Slept during Initialize()\n"

Expand Down
8 changes: 5 additions & 3 deletions code/controllers/subsystem/verb_manager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,15 @@ SUBSYSTEM_DEF(verb_manager)
incoming_callback.user = WEAKREF(incoming_callback.object)
var/datum/callback/new_us = CALLBACK(arglist(list(GLOBAL_PROC, GLOBAL_PROC_REF(_queue_verb)) + args.Copy()))
return world.push_usr(incoming_callback.object, new_us)
#endif

//debatable whether this is needed, this is just to try and ensure that you dont use this to queue stuff that isnt from player input.
if(QDELETED(usr))
#else

if(QDELETED(usr) || isnull(usr.client))
stack_trace("_queue_verb() returned false because it wasnt called from player input!")
return FALSE

#endif

if(!istype(subsystem_to_use))
stack_trace("_queue_verb() returned false because it was given an invalid subsystem to queue for!")
return FALSE
Expand Down
4 changes: 4 additions & 0 deletions code/datums/brain_damage/phobia.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@
return TRUE
return ..()

/datum/brain_trauma/mild/phobia/carps
phobia_type = "carps"
random_gain = FALSE

/datum/brain_trauma/mild/phobia/clowns
phobia_type = "clowns"
random_gain = FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/datums/diseases/advance/symptoms/choking.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Bonus
to_chat(M, span_userdanger("[pick("Your lungs hurt!", "It hurts to breathe!")]"))
Asphyxiate(M, A)
M.emote("gasp")
if(M.getOxyLoss() >= 120)
if(M.getOxyLoss() >= (M.maxHealth / (200/120)))
M.visible_message(span_warning("[M] stops breathing, as if their lungs have totally collapsed!"))
Asphyxiate_death(M, A)
return
Expand Down
3 changes: 0 additions & 3 deletions code/datums/diseases/advance/symptoms/flesh_eating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Bonus
symptom_delay_min = 3
symptom_delay_max = 6
var/chems = FALSE
var/zombie = FALSE
threshold_descs = list(
"Stage Speed 7" = "Synthesizes Heparin and Lipolicide inside the host, causing increased bleeding and hunger.",
"Stealth 5" = "The symptom remains hidden until active.",
Expand Down Expand Up @@ -128,6 +127,4 @@ Bonus
M.take_overall_damage(brute = get_damage, required_bodytype = BODYTYPE_ORGANIC)
if(chems)
M.reagents.add_reagent_list(list(/datum/reagent/toxin/heparin = 2, /datum/reagent/toxin/lipolicide = 2))
if(zombie)
M.reagents.add_reagent(/datum/reagent/hnz, 1)
return 1
169 changes: 169 additions & 0 deletions code/datums/elements/elevation.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/**
* Manages the elevation of the turf the source is on (can be the turf itself)
* The atom with the highest pixel_shift gets to set the elevation of the turf to that value.
*/
/datum/element/elevation
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY
argument_hash_start_idx = 2
///The amount of pixel_z applied to the mob standing on the turf
var/pixel_shift

/datum/element/elevation/Attach(datum/target, pixel_shift)
. = ..()
if(!isatom(target) || isarea(target))
return ELEMENT_INCOMPATIBLE

src.pixel_shift = pixel_shift

if(ismovable(target))
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))

var/turf/turf = get_turf(target)
if(turf)
if(!HAS_TRAIT(turf, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift)))
RegisterSignal(turf, COMSIG_TURF_RESET_ELEVATION, PROC_REF(check_elevation))
RegisterSignal(turf, COMSIG_TURF_CHANGE, PROC_REF(pre_change_turf))
reset_elevation(turf)
ADD_TRAIT(turf, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift), ref(target))

/datum/element/elevation/Detach(atom/movable/source)
unregister_turf(source, source.loc)
return ..()

/datum/element/elevation/proc/reset_elevation(turf/target)
var/list/current_values[2]
SEND_SIGNAL(target, COMSIG_TURF_RESET_ELEVATION, current_values)
var/current_pixel_shift = current_values[ELEVATION_CURRENT_PIXEL_SHIFT]
var/new_pixel_shift = current_values[ELEVATION_MAX_PIXEL_SHIFT]
if(new_pixel_shift == current_pixel_shift)
return
if(current_pixel_shift)
target.RemoveElement(/datum/element/elevation_core, current_pixel_shift)
if(new_pixel_shift)
target.AddElement(/datum/element/elevation_core, new_pixel_shift)

/datum/element/elevation/proc/check_elevation(turf/source, list/current_values)
SIGNAL_HANDLER
current_values[ELEVATION_MAX_PIXEL_SHIFT] = max(current_values[ELEVATION_MAX_PIXEL_SHIFT], pixel_shift)

/datum/element/elevation/proc/on_moved(atom/movable/source, atom/oldloc)
SIGNAL_HANDLER
unregister_turf(source, oldloc)
if(isturf(source.loc))
if(!HAS_TRAIT(source.loc, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift)))
RegisterSignal(source.loc, COMSIG_TURF_RESET_ELEVATION, PROC_REF(check_elevation))
RegisterSignal(source.loc, COMSIG_TURF_CHANGE, PROC_REF(pre_change_turf))
reset_elevation(source.loc)
ADD_TRAIT(source.loc, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift), ref(source))

/datum/element/elevation/proc/unregister_turf(atom/movable/source, atom/location)
if(!isturf(location))
return
REMOVE_TRAIT(location, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift), ref(source))
if(!HAS_TRAIT(location, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift)))
UnregisterSignal(location, list(COMSIG_TURF_RESET_ELEVATION, COMSIG_TURF_CHANGE))
reset_elevation(location)

///Changing or destroying the turf detaches the element, also we need to reapply the traits since they don't get passed down.
/datum/element/elevation/proc/pre_change_turf(turf/changed, path, list/new_baseturfs, flags, list/post_change_callbacks)
SIGNAL_HANDLER
var/list/trait_sources = GET_TRAIT_SOURCES(changed, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift))
trait_sources = trait_sources.Copy()
post_change_callbacks += CALLBACK(src, PROC_REF(post_change_turf), trait_sources)

/datum/element/elevation/proc/post_change_turf(list/trait_sources, turf/changed)
ADD_TRAIT(changed, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift), trait_sources)
reset_elevation(changed)

#define ELEVATE_TIME 0.2 SECONDS

/**
* The core element attached to the turf itself. Do not use this directly!
*
* Causes mobs walking over a turf with this element to be pixel shifted vertically by the pixel_shift amount.
* Because of the way it's structured, it should only be added through the elevation element (without the core suffix).
*
* To explain: in the case of multiple objects with (different instances of) the element being stacked on one turf somehow,
* we only want that with the highest pixel shift value to apply it to the turf, so that the mobs standing on top of it all
* doesn't look like it's floating off the pile.
*/
/datum/element/elevation_core
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY
argument_hash_start_idx = 2
///The amount of pixel_z applied to the mob standing on the turf.
var/pixel_shift

/datum/element/elevation_core/Attach(datum/target, pixel_shift)
. = ..()
if(!isturf(target))
return ELEMENT_INCOMPATIBLE
if(!pixel_shift)
CRASH("attempted attaching /datum/element/elevation_core with a pixel_shift value of [isnull(pixel_shift) ? "null" : 0]")

RegisterSignal(target, COMSIG_ATOM_ENTERED, PROC_REF(on_entered))
RegisterSignal(target, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON, PROC_REF(on_initialized_on))
RegisterSignal(target, COMSIG_ATOM_EXITED, PROC_REF(on_exited))
RegisterSignal(target, COMSIG_TURF_RESET_ELEVATION, PROC_REF(on_reset_elevation))

src.pixel_shift = pixel_shift

ADD_TRAIT(target, TRAIT_ELEVATED_TURF, REF(src))

for(var/mob/living/living in target)
RegisterSignal(living, COMSIG_LIVING_SET_BUCKLED, PROC_REF(on_set_buckled))
elevate_mob(living)

/datum/element/elevation_core/Detach(datum/source)
/**
* Since the element can be removed outside of Destroy(),
* and even then, signals are passed down to the new turf,
* it's necessary to clear them here.
*/
UnregisterSignal(source, list(
COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON,
COMSIG_ATOM_ENTERED,
COMSIG_ATOM_EXITED,
COMSIG_TURF_RESET_ELEVATION,
))
REMOVE_TRAIT(source, TRAIT_ELEVATED_TURF, REF(src))
for(var/mob/living/living in source)
elevate_mob(living, -pixel_shift)
UnregisterSignal(living, COMSIG_LIVING_SET_BUCKLED)
return ..()

/datum/element/elevation_core/proc/on_entered(turf/source, atom/movable/entered, atom/old_loc)
SIGNAL_HANDLER
if((isnull(old_loc) || !HAS_TRAIT_FROM(old_loc, TRAIT_ELEVATED_TURF, REF(src))) && isliving(entered))
var/elevate_time = isturf(old_loc) && source.Adjacent(old_loc) ? ELEVATE_TIME : 0
elevate_mob(entered, elevate_time = elevate_time)

/datum/element/elevation_core/proc/on_initialized_on(turf/source, atom/movable/spawned)
SIGNAL_HANDLER
if(isliving(spawned))
elevate_mob(spawned)

/datum/element/elevation_core/proc/on_exited(turf/source, atom/movable/gone)
SIGNAL_HANDLER
if((isnull(gone.loc) || !HAS_TRAIT_FROM(gone.loc, TRAIT_ELEVATED_TURF, REF(src))) && isliving(gone))
var/elevate_time = isturf(gone.loc) && source.Adjacent(gone.loc) ? ELEVATE_TIME : 0
elevate_mob(gone, -pixel_shift, elevate_time)
UnregisterSignal(gone, COMSIG_LIVING_SET_BUCKLED)

/datum/element/elevation_core/proc/elevate_mob(mob/living/target, z_shift = pixel_shift, elevate_time = ELEVATE_TIME)
animate(target, pixel_z = z_shift, time = elevate_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)
if(target.buckled && isvehicle(target.buckled))
animate(target.buckled, pixel_z = z_shift, time = elevate_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)

///Vehicles or other things the mob is buckled too also are shifted.
/datum/element/elevation_core/proc/on_set_buckled(mob/living/source, atom/movable/new_buckled)
SIGNAL_HANDLER
if(source.buckled && isvehicle(source.buckled))
animate(source.buckled, pixel_z = -pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)
if(new_buckled && isvehicle(new_buckled))
animate(source.buckled, pixel_z = pixel_shift, time = ELEVATE_TIME, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)

/datum/element/elevation_core/proc/on_reset_elevation(turf/source, list/current_values)
SIGNAL_HANDLER
current_values[ELEVATION_CURRENT_PIXEL_SHIFT] = pixel_shift

#undef ELEVATE_TIME
2 changes: 1 addition & 1 deletion code/datums/elements/embed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

if(blocked || !istype(victim) || HAS_TRAIT(victim, TRAIT_PIERCEIMMUNE))
return FALSE

if(victim.status_flags & GODMODE)
return FALSE

Expand Down
Loading

0 comments on commit 4d0c823

Please sign in to comment.