Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
OctusGit committed Apr 11, 2024
2 parents e8c1238 + fe74786 commit 4a5555d
Show file tree
Hide file tree
Showing 16 changed files with 362 additions and 73 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/misc_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
#define MAX_SUPPLIED_LAW_NUMBER 50

/// Grabs the area of a supplied object. Passing an area in to this will result in an error
#define get_area(T) ((get_step(T, 0).loc))
#define get_area(T) ((get_step(T, 0)?.loc))

//check_target_facings() return defines
#define FACING_FAILED 0
Expand Down
7 changes: 6 additions & 1 deletion code/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
///An organ that was inserted into a dead mob, that has not been revived yet
#define TRAIT_ORGAN_INSERTED_WHILE_DEAD "organ_inserted_while_dead"

///An /obj that should not increase the "depth" of the search for adjacency,
///e.g. a storage container or a modsuit.
#define TRAIT_ADJACENCY_TRANSPARENT "adjacency_transparent"

//
// common trait sources
#define TRAIT_GENERIC "generic"
Expand Down Expand Up @@ -361,6 +365,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define STATION_TRAIT_RADIOACTIVE_NEBULA "station_trait_radioactive_nebula"
#define STATION_TRAIT_FORESTED "station_trait_forested"
#define STATION_TRAIT_VENDING_SHORTAGE "station_trait_vending_shortage"
#define STATION_TRAIT_MESSY "station_trait_messy"

//***** TURF TRAITS *****//
/// Removes slowdown while walking on these tiles.
Expand All @@ -369,6 +374,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
// turf trait sources
#define FLOOR_EFFECT_TRAIT "floor_effect_trait"

//***** TURF TRAITS *****//
//***** EFFECT TRAITS *****//
// Causes the effect to go through a teleporter instead of being deleted by it.
#define TRAIT_EFFECT_CAN_TELEPORT "trait_effect_can_teleport"
6 changes: 6 additions & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_NEVER_MISSES_DISPOSALS" = TRAIT_NEVER_MISSES_DISPOSALS
),

/obj = list(
"TRAIT_ADJACENCY_TRANSPARENT" = TRAIT_ADJACENCY_TRANSPARENT,
),

/obj/item = list(
"TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO,
"TRAIT_SUPERMATTER_IMMUNE" = TRAIT_SUPERMATTER_IMMUNE,
Expand All @@ -111,9 +115,11 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_NO_THROWN_MESSAGE" = TRAIT_NO_THROWN_MESSAGE,
"TRAIT_SILENT_INSERTION" = TRAIT_SILENT_INSERTION
),

/turf = list(
"bluespace_speed_trait" = TRAIT_BLUESPACE_SPEED
),

/obj/effect = list(
"TRAIT_EFFECT_CAN_TELEPORT" = TRAIT_EFFECT_CAN_TELEPORT
)
Expand Down
22 changes: 15 additions & 7 deletions code/_onclick/adjacent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,28 @@
This is not used in stock /tg/station currently.
*/
/atom/movable/Adjacent(atom/neighbor)
if(neighbor == loc) return 1
if(!isturf(loc)) return 0
if(neighbor == loc)
return TRUE
if(!isturf(loc))
return FALSE
for(var/turf/T in locs)
if(isnull(T)) continue
if(T.Adjacent(neighbor,src)) return 1
return 0
if(T.Adjacent(neighbor, src)) return TRUE
return FALSE

// This is necessary for storage items not on your person.
/obj/item/Adjacent(atom/neighbor, recurse = 1)
if(neighbor == loc) return 1
if(neighbor == loc)
return TRUE
if(!istype(neighbor))
return ..()
if(HAS_TRAIT(loc, TRAIT_ADJACENCY_TRANSPARENT))
// Transparent parent, don't decrease recurse.
return loc.Adjacent(neighbor, recurse)
if(isitem(loc) || isstructure(loc) || isvehicle(loc))
if(recurse > 0)
return loc.Adjacent(neighbor,recurse - 1)
return 0
return loc.Adjacent(neighbor, recurse - 1)
return FALSE
return ..()

/*
Expand Down
5 changes: 5 additions & 0 deletions code/controllers/subsystem/non_firing/SSmapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ SUBSYSTEM_DEF(mapping)
else
world.name = station_name()

if(HAS_TRAIT(SSstation, STATION_TRAIT_MESSY))
generate_themed_messes(subtypesof(/obj/effect/spawner/themed_mess) - /obj/effect/spawner/themed_mess/party)
if(HAS_TRAIT(SSstation, STATION_TRAIT_HANGOVER))
generate_themed_messes(list(/obj/effect/spawner/themed_mess/party))

// Do not confuse with seedRuins()
/datum/controller/subsystem/mapping/proc/handleRuins()
// load in extra levels of space ruins
Expand Down
8 changes: 8 additions & 0 deletions code/datums/station_traits/negative_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
. = ..()
SSshuttle.supply.callTime *= 1.5 // 3 minutes, for those wondering.

/datum/station_trait/messy_station
name = "Messy Station"
trait_type = STATION_TRAIT_NEGATIVE
weight = 5
show_in_report = TRUE
report_message = "The previous crew has left the station completely trashed."
trait_to_give = STATION_TRAIT_MESSY

// Abstract station trait used for traits that modify a random event in some way (their weight or max occurrences).
/datum/station_trait/random_event_weight_modifier
name = "Random Event Modifier"
Expand Down
15 changes: 14 additions & 1 deletion code/game/machinery/machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,21 @@
component_parts += B
B.loc = null
to_chat(user, "<span class='notice'>[A.name] replaced with [B.name].</span>")
shouldplaysound = 1
shouldplaysound = TRUE
break
for(var/obj/item/reagent_containers/glass/beaker/A in component_parts)
for(var/obj/item/reagent_containers/glass/beaker/B in W.contents)
// If it's not better -> next content
if(B.reagents.maximum_volume <= A.reagents.maximum_volume)
continue
W.remove_from_storage(B, src)
W.handle_item_insertion(A, TRUE)
component_parts -= A
component_parts += B
B.loc = null
to_chat(user, "<span class='notice'>[A.name] replaced with [B.name].</span>")
shouldplaysound = TRUE
break
RefreshParts()
else
to_chat(user, display_parts(user))
Expand Down
206 changes: 206 additions & 0 deletions code/game/objects/effects/spawners/mess_spawners.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
/obj/effect/spawner/themed_mess
name = "mess spawner"
icon = 'icons/effects/spawner_icons.dmi'
icon_state = "questionmark"

/// The number of tiles to spread to. Each new chosen tile receives this
/// value decremented by one, ensuring the maximum size of the mess is limited
/// by the original spawner's value.
var/remaining_tiles

/obj/effect/spawner/themed_mess/proc/drop_mess()
return

/obj/effect/spawner/themed_mess/proc/drop_object()
return

/obj/effect/spawner/themed_mess/proc/make_next_spawner(turf/T)
new type(T, remaining_tiles - 1)

/obj/effect/spawner/themed_mess/New(loc, size = 10)
. = ..()
remaining_tiles = size
var/turf/T = get_turf(src)
if(!T)
stack_trace("Spawner placed in nullspace!")
return
randspawn(T)

/obj/effect/spawner/themed_mess/proc/randspawn(turf/T)
drop_mess(T)

if(prob(25))
drop_object(T)

if(remaining_tiles > 0)
var/dirs = GLOB.alldirs.Copy()
shuffle_inplace(dirs)
for(var/dir in dirs)
var/turf/next = get_step(src, dir)
// Just check for plasteel turf to avoid walls and areas under windows
// findEventArea excludes maintenance anyway so we don't care about missing plating
if(istype(next, /turf/simulated/floor/plasteel) && !(locate(/obj/effect/decal/cleanable) in next))
make_next_spawner(next)
break
qdel(src)

/obj/effect/spawner/themed_mess/party
name = "party mess spawner"

/obj/effect/spawner/themed_mess/party/drop_mess(turf/T)
if(prob(50))
new /obj/effect/decal/cleanable/vomit(T)
else
new /obj/effect/decal/cleanable/confetti(T)

/obj/effect/spawner/themed_mess/party/drop_object(turf/T)
if(prob(50))
new /obj/item/cigbutt(T) // does its own random placement transforms
else if(prob(20))
new /obj/item/cigbutt/roach(T)
else
var/trash_type = pick(
/obj/item/broken_bottle,
/obj/item/shard,
)
var/obj/trash = new trash_type(T)
trash.pixel_x = rand(-10, 10)
trash.pixel_y = rand(-10, 10)
trash.transform = turn(transform, rand(0, 360))

/obj/effect/spawner/themed_mess/bloody
name = "bloody mess spawner"
var/bloodcolor

/obj/effect/spawner/themed_mess/bloody/New(loc, size = 10, blood = null)
bloodcolor = blood ? blood : pick(
"#004400",
"#0064c8",
"#1d2cbf",
"#2299fc",
"#a10808",
"#a200ff",
"#a3d4eb",
"#b9ae9c",
"#fb9800")
return ..()

/obj/effect/spawner/themed_mess/bloody/make_next_spawner(turf/T)
new type(T, remaining_tiles - 1, bloodcolor)

/obj/effect/spawner/themed_mess/bloody/drop_mess(turf/T)
var/blood_decal_type = pick(
/obj/effect/decal/cleanable/blood,
/obj/effect/decal/cleanable/blood/splatter,
/obj/effect/decal/cleanable/blood/drip,
/obj/effect/decal/cleanable/blood/gibs,
)
var/obj/effect/decal/cleanable/blood/decal = new blood_decal_type(T)
decal.basecolor = bloodcolor
decal.update_icon()

/obj/effect/spawner/themed_mess/bloody/drop_object(turf/T)
if(prob(50))
var/organ_type = pick(
/obj/item/organ/internal/ears,
/obj/item/organ/internal/eyes,
/obj/item/organ/internal/kidneys,
/obj/item/organ/internal/liver,
/obj/item/organ/internal/lungs,
/obj/item/organ/internal/appendix,
)
var/obj/organ = new organ_type(T)
organ.pixel_x = rand(-10, 10)
organ.pixel_y = rand(-10, 10)

/obj/effect/spawner/themed_mess/robotic
name = "robotic themed mess"

/obj/effect/spawner/themed_mess/robotic/drop_mess(turf/T)
var/blood_decal_type = pick(
/obj/effect/decal/cleanable/blood,
/obj/effect/decal/cleanable/blood/splatter,
/obj/effect/decal/cleanable/blood/drip,
/obj/effect/decal/cleanable/blood/gibs,
)
var/obj/effect/decal/cleanable/blood/decal = new blood_decal_type(T)
decal.basecolor = COLOR_BLOOD_MACHINE
decal.update_icon()

if(prob(10))
new /obj/effect/decal/cleanable/blood/gibs/robot(T)

/obj/effect/spawner/themed_mess/engineering
name = "engineering themed mess"

/obj/effect/spawner/themed_mess/engineering/drop_mess(turf/T)
var/turf/simulated/floor/floor = T
if(istype(floor))
if(prob(50))
floor.burn_tile()
else if(prob(25))
floor.break_tile()
else if(!istype(floor, /turf/simulated/floor/grass)) // Just because grass isn't *as* easy to replace
floor.remove_tile(null, silent = TRUE, make_tile = TRUE)

/obj/effect/spawner/themed_mess/engineering/drop_object(turf/T)
var/obj_type = pick(
/obj/effect/decal/cleanable/glass,
/obj/item/stack/cable_coil/cut,
/obj/item/stack/rods,
/obj/item/stack/tile/plasteel,
)
new obj_type(T)

/obj/effect/spawner/themed_mess/dirty
name = "dirt themed mess"

/obj/effect/spawner/themed_mess/dirty/drop_mess(turf/T)
new /obj/effect/decal/cleanable/dirt(T)

/obj/effect/spawner/themed_mess/dirty/drop_object(turf/T)
var extra_trash = pick(
/obj/effect/decal/cleanable/generic,
/obj/effect/decal/cleanable/insectguts,
/obj/effect/decal/cleanable/shreds,
/obj/effect/decal/cleanable/molten_object,
)
new extra_trash(T)

/obj/effect/spawner/themed_mess/cooking
name = "cooking themed mess"

/obj/effect/spawner/themed_mess/cooking/drop_mess(turf/T)
var mess_type = pick(
/obj/effect/decal/cleanable/egg_smudge,
/obj/effect/decal/cleanable/flour,
/obj/effect/decal/cleanable/blood/oil/cooking,
/obj/effect/decal/cleanable/ants,
)
new mess_type(T)

/obj/effect/spawner/themed_mess/cooking/drop_object(turf/T)
var/extra_trash = pick(
/obj/item/trash/plate,
/obj/item/food/snacks/meat,
/obj/item/trash/snack_bowl,
)
var/obj/trash = new extra_trash(T)
trash.pixel_x = rand(-10, 10)
trash.pixel_y = rand(-10, 10)
trash.transform = turn(transform, rand(0, 360))

/proc/generate_themed_messes(themed_mess_types)
var/mess_count = rand(5, 10)
for(var/i in 1 to mess_count)
var/area/target_area = findEventArea()
var/list/turfs = get_area_turfs(target_area)
while(length(turfs))
var/turf/T = pick_n_take(turfs)
// Just check for plasteel turf to avoid walls and areas under windows
// findEventArea excludes maintenance anyway so we don't care about missing plating
if(!istype(T, /turf/simulated/floor/plasteel))
continue
var/spawner_type = pick(themed_mess_types)
new spawner_type(T, rand(10, 20))
break
Loading

0 comments on commit 4a5555d

Please sign in to comment.