mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
Merge branch 'master' of https://github.com/tgstation/tgstation into xpokee-test-upstream-sync
This commit is contained in:
@@ -50,5 +50,8 @@
|
||||
/datum/element/crusher_loot/proc/make_path(mob/living/target, path)
|
||||
if(drop_immediately)
|
||||
new path(get_turf(target))
|
||||
else
|
||||
target.guaranteed_butcher_results[path] = 1
|
||||
return
|
||||
|
||||
if (!target.guaranteed_butcher_results)
|
||||
target.guaranteed_butcher_results = list()
|
||||
target.guaranteed_butcher_results[path] = 1
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
|
||||
src.pixel_shift = pixel_shift
|
||||
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
||||
RegisterSignal(target, COMSIG_ATOM_ENTERING, PROC_REF(on_source_entering))
|
||||
RegisterSignal(target, COMSIG_ATOM_EXITING, PROC_REF(on_source_exiting))
|
||||
|
||||
var/atom/atom_target = target
|
||||
register_turf(atom_target, atom_target.loc)
|
||||
|
||||
/datum/element/elevation/Detach(atom/movable/source)
|
||||
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
|
||||
UnregisterSignal(source, list(COMSIG_ATOM_ENTERING, COMSIG_ATOM_EXITING))
|
||||
unregister_turf(source, source.loc)
|
||||
REMOVE_TRAIT(source, TRAIT_ELEVATING_OBJECT, ref(src))
|
||||
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
|
||||
return ..()
|
||||
|
||||
/datum/element/elevation/proc/reset_elevation(turf/target)
|
||||
@@ -45,10 +45,13 @@
|
||||
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)
|
||||
/datum/element/elevation/proc/on_source_entering(atom/movable/source, atom/entering, atom/old_loc)
|
||||
SIGNAL_HANDLER
|
||||
unregister_turf(source, oldloc)
|
||||
register_turf(source, source.loc)
|
||||
register_turf(source, entering)
|
||||
|
||||
/datum/element/elevation/proc/on_source_exiting(atom/movable/source, atom/exiting)
|
||||
SIGNAL_HANDLER
|
||||
unregister_turf(source, exiting)
|
||||
|
||||
/datum/element/elevation/proc/register_turf(atom/movable/source, atom/location)
|
||||
if(!isturf(location))
|
||||
@@ -67,17 +70,15 @@
|
||||
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.
|
||||
/// When a turf with elevated objects changes, we need to unregister all the elevating objects on it. When a turf Initializes(),
|
||||
/// it calls Entered() on all of its moveable contents, which will invoke on_source_entering(), which will register each elevating
|
||||
/// object with the new turf. We need to do this because turfs do not keep their traits when changed, and so the check for
|
||||
/// TRAIT_TURF_HAS_ELEVATED_OBJ above will fail and cause override runtimes when we attempt to register the signals again.
|
||||
/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)
|
||||
for(var/source in trait_sources)
|
||||
ADD_TRAIT(changed, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift), source)
|
||||
reset_elevation(changed)
|
||||
for (var/atom/movable/content as anything in changed)
|
||||
if(HAS_TRAIT_FROM(content, TRAIT_ELEVATING_OBJECT, ref(src)))
|
||||
unregister_turf(content, changed)
|
||||
|
||||
#define ELEVATE_TIME 0.2 SECONDS
|
||||
#define ELEVATION_SOURCE(datum) "elevation_[REF(datum)]"
|
||||
|
||||
@@ -269,10 +269,10 @@
|
||||
return STRIPPABLE_OBSCURING_NONE
|
||||
|
||||
var/mob/living/carbon/carbon_source = source
|
||||
if (carbon_source.check_obscured_slots() & item_slot)
|
||||
if (hidden_slots_to_inventory_slots(carbon_source.obscured_slots) & item_slot)
|
||||
return STRIPPABLE_OBSCURING_COMPLETELY
|
||||
|
||||
if (carbon_source.check_covered_slots() & item_slot)
|
||||
if (hidden_slots_to_inventory_slots(carbon_source.covered_slots) & item_slot)
|
||||
return STRIPPABLE_OBSCURING_INACCESSIBLE
|
||||
|
||||
return STRIPPABLE_OBSCURING_NONE
|
||||
|
||||
Reference in New Issue
Block a user