Skip to content

Commit

Permalink
refactor: Chasms And Portals Refactor (ss220-space#5330)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottfrei authored Jul 8, 2024
1 parent d55c25d commit caec310
Show file tree
Hide file tree
Showing 29 changed files with 783 additions and 442 deletions.
10 changes: 8 additions & 2 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@
#define COMSIG_ATOM_ENTERED "atom_entered"
/// Sent from the atom that just Entered src. From base of atom/Entered(): (/atom/destination, atom/old_loc, list/atom/old_locs)
#define COMSIG_ATOM_ENTERING "atom_entering"
///from base of atom/movable/Moved(): (atom/movable/arrived, atom/old_loc, list/atom/old_locs)
#define COMSIG_ATOM_ABSTRACT_ENTERED "atom_abstract_entered"
///from base of atom/Exit(): (/atom/movable/exiting, /atom/newloc)
#define COMSIG_ATOM_EXIT "atom_exit"
#define COMPONENT_ATOM_BLOCK_EXIT (1<<0)
///from base of atom/Exited(): (atom/movable/departed, atom/newloc)
#define COMSIG_ATOM_EXITED "atom_exited"
///from base of atom/movable/Moved(): (atom/movable/gone, direction)
#define COMSIG_ATOM_ABSTRACT_EXITED "atom_abstract_exited"
///from base of atom/Bumped(): (/atom/movable)
#define COMSIG_ATOM_BUMPED "atom_bumped"
///from base of atom/ex_act(): (severity, target)
Expand Down Expand Up @@ -190,8 +194,8 @@
///from base of atom/analyser_act(): (mob/living/user, obj/item/I)
#define COMSIG_ATOM_ANALYSER_ACT "atom_analyser_act"
#define COMPONENT_BLOCK_TOOL_ATTACK (1<<0)
///called when teleporting into a protected turf: (channel, turf/origin)
#define COMSIG_ATOM_INTERCEPT_TELEPORT "intercept_teleport"
///called when teleporting into a possibly protected turf: (turf/origin)
#define COMSIG_ATOM_INTERCEPT_TELEPORTING "intercept_teleporting"
#define COMPONENT_BLOCK_TELEPORT (1<<0)
///called when an atom is added to the hearers on get_hearers_in_view(): (list/processing_list, list/hearers)
#define COMSIG_ATOM_HEARER_IN_VIEW "atom_hearer_in_view"
Expand Down Expand Up @@ -353,6 +357,8 @@
///from datum/component/drift/allow_final_movement(): ()
#define COMSIG_MOVABLE_DRIFT_BLOCK_INPUT "movable_drift_block_input"
#define DRIFT_ALLOW_INPUT (1<<0)
///Called before a movable is being teleported from `initTeleport()`: (turf/origin, turf/destination)
#define COMSIG_MOVABLE_TELEPORTING "movable_teleporting"

// /datum/mind signals

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/logs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define INVESTIGATE_RESEARCH "research"
#define INVESTIGATE_SYNDIE_CARGO "syndicate_cargo"
#define INVESTIGATE_WIRES "wires"
#define INVESTIGATE_DEATHS "deaths"

//This is an external call, "true" and "false" are how rust parses out booleans
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
//#define span_blueteamradio(str) ("<span class='blueteamradio'>" + str + "</span>")
//#define span_bold(str) ("<span class='bold'>" + str + "</span>")
#define span_boldannounce(str) ("<span class='boldannounce'>" + str + "</span>")
//#define span_bolddanger(str) ("<span class='bolddanger'>" + str + "</span>")
#define span_bolddanger(str) ("<span class='bolddanger'>" + str + "</span>")
//#define span_boldnicegreen(str) ("<span class='boldnicegreen'>" + str + "</span>")
#define span_boldnotice(str) ("<span class='boldnotice'>" + str + "</span>")
#define span_boldwarning(str) ("<span class='boldwarning'>" + str + "</span>")
Expand Down
8 changes: 8 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
//atom/movable traits
/// Buckling yourself to objects with this trait won't immobilize you
#define TRAIT_NO_IMMOBILIZE "no_immobilize"
///Chasms will be safe to cross if there is something with this trait on it
#define TRAIT_CHASM_STOPPER "chasm_stopper"
/// `do_teleport` will not allow this atom to teleport
#define TRAIT_NO_TELEPORT "no-teleport"

//turf traits
/// Prevent mobs on the turf from being affected by anything below that turf, such as a pulse demon going under it. Added by a /obj/structure with creates_cover set to TRUE
Expand All @@ -19,6 +23,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_TURF_IGNORE_SLOWDOWN "turf_ignore_slowdown"
///Mobs won't slip on a wet turf while it has this trait
#define TRAIT_TURF_IGNORE_SLIPPERY "turf_ignore_slippery"
///Chasms will be safe to cross while they've this trait.
#define TRAIT_CHASM_STOPPED "chasm_stopped"
///Lava will be safe to cross while it has this trait.
#define TRAIT_LAVA_STOPPED "lava_stopped"

//mob traits
#define TRAIT_PACIFISM "pacifism"
Expand Down
10 changes: 10 additions & 0 deletions code/__HELPERS/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
if(istype(checked_atom, type))
. += checked_atom


///Returns true if the src countain the atom target
/atom/proc/contains(atom/target)
if(!target)
return FALSE
for(var/atom/location = target.loc, location, location = location.loc)
if(location == src)
return TRUE


/// Forces atom to drop all the important items while dereferencing them from their
/// containers both ways. To be used to preserve important items before mob gib/self-gib.
/// Returns a list with all saved items.
Expand Down
15 changes: 15 additions & 0 deletions code/__HELPERS/string_lists.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GLOBAL_LIST_EMPTY(string_lists)

/**
* Caches lists with non-numeric stringify-able values (text or typepath).
*/
/proc/string_list(list/values)
var/string_id = values.Join("-")

. = GLOB.string_lists[string_id]

if(.)
return .

return GLOB.string_lists[string_id] = values

8 changes: 0 additions & 8 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2005,14 +2005,6 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
)
return _list

// Check if the source atom contains another atom
/atom/proc/contains(atom/location)
if(!location)
return FALSE
if(location == src)
return TRUE

return contains(location.loc)

/**
* Returns the clean name of an audio channel.
Expand Down
4 changes: 4 additions & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_CMAGGED" = TRAIT_CMAGGED,
),
/atom/movable = list(
"TRAIT_CHASM_STOPPER" = TRAIT_CHASM_STOPPER,
"TRAIT_MOVE_FLOATING" = TRAIT_MOVE_FLOATING,
"TRAIT_MOVE_FLYING" = TRAIT_MOVE_FLYING,
"TRAIT_MOVE_GROUND" = TRAIT_MOVE_GROUND,
Expand All @@ -19,6 +20,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_MOVE_VENTCRAWLING" = TRAIT_MOVE_VENTCRAWLING,
"TRAIT_NO_FLOATING_ANIM" = TRAIT_NO_FLOATING_ANIM,
"TRAIT_NO_IMMOBILIZE" = TRAIT_NO_IMMOBILIZE,
"TRAIT_NO_TELEPORT" = TRAIT_NO_TELEPORT,
),
/mob = list(
"TRAIT_AI_UNTRACKABLE" = TRAIT_AI_UNTRACKABLE,
Expand Down Expand Up @@ -77,6 +79,8 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_WIELDED" = TRAIT_WIELDED,
),
/turf = list(
"TRAIT_CHASM_STOPPED" = TRAIT_CHASM_STOPPED,
"TRAIT_LAVA_STOPPED" = TRAIT_LAVA_STOPPED,
"TRAIT_TURF_COVERED" = TRAIT_TURF_COVERED,
"TRAIT_TURF_IGNORE_SLIPPERY" = TRAIT_TURF_IGNORE_SLIPPERY,
"TRAIT_TURF_IGNORE_SLOWDOWN" = TRAIT_TURF_IGNORE_SLOWDOWN,
Expand Down
4 changes: 0 additions & 4 deletions code/_onclick/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
if(com && com.target)
user.forceMove(get_turf(com.target))

/obj/effect/portal/attack_ghost(mob/user)
if(target)
user.forceMove(get_turf(target))

/obj/machinery/gateway/centerstation/attack_ghost(mob/user)
if(awaygate)
user.forceMove(awaygate.loc)
Expand Down
6 changes: 3 additions & 3 deletions code/controllers/subsystem/processing/dcs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
/datum/controller/subsystem/processing/dcs/Recover()
comp_lookup = SSdcs.comp_lookup

/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments)
/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments, init_element = TRUE)
var/datum/element/eletype = arguments[1]
var/element_id = eletype

Expand All @@ -21,8 +21,8 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
element_id = GetIdFromArguments(arguments)

. = elements_by_type[element_id]
if(.)
return
if(. || !init_element)
return .
. = elements_by_type[element_id] = new eletype

/****
Expand Down
Loading

0 comments on commit caec310

Please sign in to comment.