Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flooring rework #6883

Merged
merged 18 commits into from
Nov 29, 2024
13 changes: 12 additions & 1 deletion citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@
#include "code\__DEFINES\traits\sources.dm"
#include "code\__DEFINES\traits\unsorted.dm"
#include "code\__DEFINES\turfs\change_turf.dm"
#include "code\__DEFINES\turfs\flooring.dm"
#include "code\__DEFINES\turfs\turfs.dm"
#include "code\__DEFINES\turfs\type_generation.dm"
#include "code\__HELPERS\_auxtools_api.dm"
Expand Down Expand Up @@ -541,6 +542,7 @@
#include "code\controllers\configuration_old\configuration_vr.dm"
#include "code\controllers\observer_listener\atom\observer.dm"
#include "code\controllers\repository\designs.dm"
#include "code\controllers\repository\flooring.dm"
#include "code\controllers\repository\guidebook.dm"
#include "code\controllers\repository\languages.dm"
#include "code\controllers\repository\material_traits.dm"
Expand Down Expand Up @@ -1055,13 +1057,16 @@
#include "code\game\atoms\atom-construction.dm"
#include "code\game\atoms\atom-damage.dm"
#include "code\game\atoms\atom-defense.dm"
#include "code\game\atoms\atom-examine.dm"
#include "code\game\atoms\atom-logging.dm"
#include "code\game\atoms\atom_vv.dm"
#include "code\game\atoms\atoms_initializing_EXPENSIVE.dm"
#include "code\game\atoms\buckling.dm"
#include "code\game\atoms\defense_old.dm"
#include "code\game\atoms\materials.dm"
#include "code\game\atoms\movement.dm"
#include "code\game\atoms\say.dm"
#include "code\game\atoms\movable\movable-logging.dm"
#include "code\game\atoms\movable\movable-movement.dm"
#include "code\game\atoms\movable\movable-throw.dm"
#include "code\game\atoms\movable\movable.dm"
Expand Down Expand Up @@ -2076,6 +2081,8 @@
#include "code\game\turfs\simulated\shuttle.dm"
#include "code\game\turfs\simulated\shuttle_ceiling.dm"
#include "code\game\turfs\simulated\sky.dm"
#include "code\game\turfs\simulated\floor\floor-construction.dm"
#include "code\game\turfs\simulated\floor\floor-flooring.dm"
#include "code\game\turfs\simulated\floor\floor.dm"
#include "code\game\turfs\simulated\floor\floor_acts.dm"
#include "code\game\turfs\simulated\floor\floor_attackby.dm"
Expand All @@ -2095,10 +2102,13 @@
#include "code\game\turfs\simulated\floor_types\river.dm"
#include "code\game\turfs\simulated\floor_types\snow.dm"
#include "code\game\turfs\simulated\floor_types\water.dm"
#include "code\game\turfs\simulated\flooring\_flooring.dm"
#include "code\game\turfs\simulated\flooring\flooring.dm"
#include "code\game\turfs\simulated\flooring\flooring_decals.dm"
#include "code\game\turfs\simulated\flooring\flooring_premade.dm"
#include "code\game\turfs\simulated\flooring\flooring_traps.dm"
#include "code\game\turfs\simulated\flooring\flooring_types.dm"
#include "code\game\turfs\simulated\flooring\types\grass.dm"
#include "code\game\turfs\simulated\flooring\types\linoleum.dm"
#include "code\game\turfs\simulated\wall\materials.dm"
#include "code\game\turfs\simulated\wall\rot.dm"
#include "code\game\turfs\simulated\wall\wall-construction.dm"
Expand Down Expand Up @@ -3262,6 +3272,7 @@
#include "code\modules\loadout\accessories\insignia.dm"
#include "code\modules\loadout\accessories\utility.dm"
#include "code\modules\logging\logging.dm"
#include "code\modules\logging\api\construction.dm"
#include "code\modules\logging\api\reagents.dm"
#include "code\modules\loot\pack.dm"
#include "code\modules\loot\table.dm"
Expand Down
1 change: 0 additions & 1 deletion code/__DEFINES/icon_smoothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ DEFINE_BITFIELD(smoothing_flags, list(
#define IS_SMOOTH(A) (A.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK|SMOOTH_CUSTOM))

#define QUEUE_SMOOTH(thing_to_queue) if(IS_SMOOTH(thing_to_queue)) {SSicon_smooth.add_to_queue(thing_to_queue)}

#define QUEUE_SMOOTH_NEIGHBORS(thing_to_queue) for(var/neighbor in orange(1, thing_to_queue)) {var/atom/atom_neighbor = neighbor; QUEUE_SMOOTH(atom_neighbor)}


Expand Down
26 changes: 26 additions & 0 deletions code/__DEFINES/turfs/flooring.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

/**
* Declares a type of flooring.
*
* * Will generate two types. /datum/prototype/flooring/<type>, and /turf/simulated/floor/preset/<type>
* * Will generate the standard (see standard turfmakers) types for the preset turf as well.
* * Name is automatically set on the turf.
* * Icon is automatically set on the turf.
* * Icon state is automatically set on the turf. Make sure the `icon_state` exists in the icon.
* * `mz_flags` is automatically set on the turf.
*/
#define DECLARE_FLOORING(TYPE) \
CREATE_STANDARD_TURFS(/turf/simulated/floor/preset##TYPE); \
/turf/simulated/floor/preset##TYPE { \
initial_flooring = /datum/prototype/flooring##TYPE; \
name = /datum/prototype/flooring##TYPE::name; \
icon = /datum/prototype/flooring##TYPE::icon; \
icon_state = /datum/prototype/flooring##TYPE::icon_base; \
mz_flags = /datum/prototype/flooring##TYPE::mz_flags; \
}; \
/datum/prototype/flooring##TYPE { \
__is_not_legacy = TRUE; \
} \
/datum/prototype/flooring##TYPE
36 changes: 36 additions & 0 deletions code/controllers/repository/flooring.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 Citadel Station Developers *//

REPOSITORY_DEF(flooring)
name = "Repository - Flooring"
expected_type = /datum/prototype/flooring

/// item type to buildable floor type
var/list/build_item_lookup
/// material id to buildable floor type
var/list/build_material_lookup

/datum/controller/repository/flooring/Create()
build_item_lookup = list()
build_material_lookup = list()
return ..()

/datum/controller/repository/flooring/load(datum/prototype/flooring/instance)
. = ..()
if(!.)
return
if(ispath(instance.build_type, /obj/item/stack))
LAZYADD(build_item_lookup[instance.build_type], instance)
else if(ispath(instance.build_type, /datum/prototype/material))
var/datum/prototype/material/casted_material = instance.build_type
LAZYADD(build_material_lookup[initial(casted_material.id)], instance)

/datum/controller/repository/flooring/unload(datum/prototype/flooring/instance)
. = ..()
if(!.)
return
if(ispath(instance.build_type, /obj/item/stack))
LAZYREMOVE(build_item_lookup[instance.build_type], instance)
else if(ispath(instance.build_type, /datum/prototype/material))
var/datum/prototype/material/casted_material = instance.build_type
LAZYREMOVE(build_material_lookup[initial(casted_material.id)], instance)
5 changes: 5 additions & 0 deletions code/datums/event_args/actor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
/datum/event_args/actor/clone(include_contents)
return new /datum/event_args/actor(performer, initiator)

//* Logging *//

/datum/event_args/actor/proc/actor_log_string()
return performer == initiator ? key_name(performer) : "[key_name(performer)] (via [key_name(initiator)])"

// todo: reowrk these awful ass feedback/message procs wtf

/datum/event_args/actor/proc/chat_feedback(msg, atom/target)
Expand Down
3 changes: 3 additions & 0 deletions code/datums/prototype.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@

// TODO: deal with the rest of this

// todo: anonymous is kinda wrong. only procgen'd prototypes should have procedural ids.
// right now, this is just here to support transferring legacy stuff over without having to manually assign IDs
// to everything. this does mean that ::id won't be usable until it's taken off of a subtype.
/// anonymous? if true, coded id is ignored.
var/anonymous = FALSE
/// namespace for anonymous generation - must be set if anonymous
Expand Down
114 changes: 0 additions & 114 deletions code/game/atoms/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,120 +296,6 @@
found += A.search_contents_for(path,filter_path)
return found

/atom/proc/get_examine_name(mob/user)
. = "\a <b>[src]</b>"
var/list/override = list(gender == PLURAL ? "some" : "a", " ", "[name]")

var/should_override = FALSE

if(SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, override) & COMPONENT_EXNAME_CHANGED)
should_override = TRUE


if(blood_DNA && !istype(src, /obj/effect/decal))
override[EXAMINE_POSITION_BEFORE] = " blood-stained "
should_override = TRUE

if(should_override)
. = override.Join("")

/// Generate the full examine string of this atom (including icon for goonchat)
/atom/proc/get_examine_string(mob/user, thats = FALSE)
return "[icon2html(src, user)] [thats? "That's ":""][get_examine_name(user)]"

/**
* Returns an extended list of examine strings for any contained ID cards.
*
* Arguments:
* * user - The user who is doing the examining.
*/
/atom/proc/get_id_examine_strings(mob/user)
. = list()
return

/// Used to insert text after the name but before the description in examine()
/atom/proc/get_name_chaser(mob/user, list/name_chaser = list())
return name_chaser

/**
* Called when a mob examines (shift click or verb) this atom
*
* Default behaviour is to get the name and icon of the object and it's reagents where
* the [TRANSPARENT] flag is set on the reagents holder
*
* Produces a signal [COMSIG_PARENT_EXAMINE]
*
* @params
* * user - who's examining. can be null
* * dist - effective distance of examine, usually from user to src.
*/
/atom/proc/examine(mob/user, dist = 1)
var/examine_string = get_examine_string(user, thats = TRUE)
if(examine_string)
. = list("[examine_string].")
else
. = list()

. += get_name_chaser(user)
if(desc)
. += "<hr>[desc]"
if(get_description_info() || get_description_fluff() || length(get_description_interaction(user)))
. += SPAN_TINYNOTICE("<a href='byond://winset?command=.statpanel_goto_tab \"Examine\"'>For more information, click here.</a>") //This feels VERY HACKY but eh its PROBABLY fine
if(integrity_flags & INTEGRITY_INDESTRUCTIBLE)
. += SPAN_NOTICE("It doesn't look like it can be damaged through common means.")
/*
if(custom_materials)
var/list/materials_list = list()
for(var/datum/prototype/material/current_material as anything in custom_materials)
materials_list += "[current_material.name]"
. += "<u>It is made out of [english_list(materials_list)]</u>."
*/
if(reagents)
if(reagents.reagents_holder_flags & TRANSPARENT)
. += "It contains:"
if(length(reagents.reagent_list))
var/has_alcohol = FALSE
if(user.can_see_reagents()) //Show each individual reagent
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
if(!has_alcohol && istype(current_reagent,/datum/reagent/ethanol))
has_alcohol = TRUE
. += "&bull; [round(current_reagent.volume, 0.01)] units of [current_reagent.name]"
else //Otherwise, just show the total volume
var/total_volume = 0
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
if(!has_alcohol && istype(current_reagent,/datum/reagent/ethanol))
has_alcohol = TRUE
total_volume += current_reagent.volume
. += "[total_volume] units of various reagents"
if(has_alcohol)
. += "It smells of alcohol."
else
. += "Nothing."
else if(reagents.reagents_holder_flags & AMOUNT_VISIBLE)
if(reagents.total_volume)
. += SPAN_NOTICE("It has [reagents.total_volume] unit\s left.")
else
. += SPAN_DANGER("It's empty.")

MATERIAL_INVOKE(src, MATERIAL_TRAIT_EXAMINE, on_examine, ., user, dist)

SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)

/**
* Called when a mob examines (shift click or verb) this atom twice (or more) within EXAMINE_MORE_WINDOW (default 1 second)
*
* This is where you can put extra information on something that may be superfluous or not important in critical gameplay
* moments, while allowing people to manually double-examine to take a closer look
*
* Produces a signal [COMSIG_PARENT_EXAMINE_MORE]
*/
/atom/proc/examine_more(mob/user)
SHOULD_CALL_PARENT(TRUE)
RETURN_TYPE(/list)

. = list()
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE_MORE, user, .)


// called by mobs when e.g. having the atom as their machine, pulledby, loc (AKA mob being inside the atom) or buckled var set.
// see code/modules/mob/mob_movement.dm for more.
Expand Down
117 changes: 117 additions & 0 deletions code/game/atoms/atom-examine.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

/atom/proc/get_examine_name(mob/user)
. = "\a <b>[src]</b>"
var/list/override = list(gender == PLURAL ? "some" : "a", " ", "[name]")

var/should_override = FALSE

if(SEND_SIGNAL(src, COMSIG_ATOM_GET_EXAMINE_NAME, user, override) & COMPONENT_EXNAME_CHANGED)
should_override = TRUE


if(blood_DNA && !istype(src, /obj/effect/decal))
override[EXAMINE_POSITION_BEFORE] = " blood-stained "
should_override = TRUE

if(should_override)
. = override.Join("")

/atom/proc/get_examine_desc(mob/user, dist)
return desc

/// Generate the full examine string of this atom (including icon for goonchat)
/atom/proc/get_examine_string(mob/user, thats = FALSE)
return "[icon2html(src, user)] [thats? "That's ":""][get_examine_name(user)]"

/**
* Returns an extended list of examine strings for any contained ID cards.
*
* Arguments:
* * user - The user who is doing the examining.
*/
/atom/proc/get_id_examine_strings(mob/user)
. = list()
return

/// Used to insert text after the name but before the description in examine()
/atom/proc/get_name_chaser(mob/user, list/name_chaser = list())
return name_chaser

/**
* Called when a mob examines (shift click or verb) this atom
*
* Default behaviour is to get the name and icon of the object and it's reagents where
* the [TRANSPARENT] flag is set on the reagents holder
*
* Produces a signal [COMSIG_PARENT_EXAMINE]
*
* @params
* * user - who's examining. can be null
* * dist - effective distance of examine, usually from user to src.
*/
/atom/proc/examine(mob/user, dist = 1)
var/examine_string = get_examine_string(user, thats = TRUE)
if(examine_string)
. = list("[examine_string].")
else
. = list()

. += get_name_chaser(user)
if(desc)
. += "<hr>[get_examine_desc(user, dist)]"
if(get_description_info() || get_description_fluff() || length(get_description_interaction(user)))
. += SPAN_TINYNOTICE("<a href='byond://winset?command=.statpanel_goto_tab \"Examine\"'>For more information, click here.</a>") //This feels VERY HACKY but eh its PROBABLY fine
if(integrity_flags & INTEGRITY_INDESTRUCTIBLE)
. += SPAN_NOTICE("It doesn't look like it can be damaged through common means.")
/*
if(custom_materials)
var/list/materials_list = list()
for(var/datum/prototype/material/current_material as anything in custom_materials)
materials_list += "[current_material.name]"
. += "<u>It is made out of [english_list(materials_list)]</u>."
*/
if(reagents)
if(reagents.reagents_holder_flags & TRANSPARENT)
. += "It contains:"
if(length(reagents.reagent_list))
var/has_alcohol = FALSE
if(user.can_see_reagents()) //Show each individual reagent
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
if(!has_alcohol && istype(current_reagent,/datum/reagent/ethanol))
has_alcohol = TRUE
. += "&bull; [round(current_reagent.volume, 0.01)] units of [current_reagent.name]"
else //Otherwise, just show the total volume
var/total_volume = 0
for(var/datum/reagent/current_reagent as anything in reagents.reagent_list)
if(!has_alcohol && istype(current_reagent,/datum/reagent/ethanol))
has_alcohol = TRUE
total_volume += current_reagent.volume
. += "[total_volume] units of various reagents"
if(has_alcohol)
. += "It smells of alcohol."
else
. += "Nothing."
else if(reagents.reagents_holder_flags & AMOUNT_VISIBLE)
if(reagents.total_volume)
. += SPAN_NOTICE("It has [reagents.total_volume] unit\s left.")
else
. += SPAN_DANGER("It's empty.")

MATERIAL_INVOKE(src, MATERIAL_TRAIT_EXAMINE, on_examine, ., user, dist)

SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE, user, .)

/**
* Called when a mob examines (shift click or verb) this atom twice (or more) within EXAMINE_MORE_WINDOW (default 1 second)
*
* This is where you can put extra information on something that may be superfluous or not important in critical gameplay
* moments, while allowing people to manually double-examine to take a closer look
*
* Produces a signal [COMSIG_PARENT_EXAMINE_MORE]
*/
/atom/proc/examine_more(mob/user)
SHOULD_CALL_PARENT(TRUE)
RETURN_TYPE(/list)

. = list()
SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE_MORE, user, .)
Loading