mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Merge pull request #37565 from ninjanomnom/component-limbo
Modifies component transfer to make ChangeTurf able to transfer components
This commit is contained in:
committed by
yogstation13-bot
parent
9af251baa9
commit
cd97219f32
@@ -72,6 +72,9 @@
|
|||||||
#define COMSIG_AREA_ENTERED "area_entered" //from base of area/Entered(): (atom/movable/M)
|
#define COMSIG_AREA_ENTERED "area_entered" //from base of area/Entered(): (atom/movable/M)
|
||||||
#define COMSIG_AREA_EXITED "area_exited" //from base of area/Exited(): (atom/movable/M)
|
#define COMSIG_AREA_EXITED "area_exited" //from base of area/Exited(): (atom/movable/M)
|
||||||
|
|
||||||
|
// /turf signals
|
||||||
|
#define COMSIG_TURF_CHANGE "turf_change" //from base of turf/ChangeTurf(): (path, list/new_baseturfs, flags, list/transferring_comps)
|
||||||
|
|
||||||
// /atom/movable signals
|
// /atom/movable signals
|
||||||
#define COMSIG_MOVABLE_MOVED "movable_moved" //from base of atom/movable/Moved(): (/atom, dir)
|
#define COMSIG_MOVABLE_MOVED "movable_moved" //from base of atom/movable/Moved(): (/atom, dir)
|
||||||
#define COMSIG_MOVABLE_CROSSED "movable_crossed" //from base of atom/movable/Crossed(): (/atom/movable)
|
#define COMSIG_MOVABLE_CROSSED "movable_crossed" //from base of atom/movable/Crossed(): (/atom/movable)
|
||||||
|
|||||||
@@ -101,7 +101,10 @@
|
|||||||
/datum/component/proc/InheritComponent(datum/component/C, i_am_original)
|
/datum/component/proc/InheritComponent(datum/component/C, i_am_original)
|
||||||
return
|
return
|
||||||
|
|
||||||
/datum/component/proc/OnTransfer(datum/new_parent)
|
/datum/component/proc/PreTransfer()
|
||||||
|
return
|
||||||
|
|
||||||
|
/datum/component/proc/PostTransfer()
|
||||||
return
|
return
|
||||||
|
|
||||||
/datum/component/proc/_GetInverseTypeList(our_type = type)
|
/datum/component/proc/_GetInverseTypeList(our_type = type)
|
||||||
@@ -225,23 +228,26 @@
|
|||||||
if(!.)
|
if(!.)
|
||||||
return AddComponent(arglist(args))
|
return AddComponent(arglist(args))
|
||||||
|
|
||||||
/datum/proc/TakeComponent(datum/component/C)
|
/datum/component/proc/RemoveComponent()
|
||||||
if(!C)
|
if(!parent)
|
||||||
return
|
return
|
||||||
var/datum/helicopter = C.parent
|
var/datum/old_parent = parent
|
||||||
if(helicopter == src)
|
PreTransfer()
|
||||||
//if we're taking to the same thing no need for anything
|
_RemoveFromParent()
|
||||||
|
old_parent.SendSignal(COMSIG_COMPONENT_REMOVING, src)
|
||||||
|
|
||||||
|
/datum/proc/TakeComponent(datum/component/target)
|
||||||
|
if(!target)
|
||||||
return
|
return
|
||||||
if(C.OnTransfer(src) == COMPONENT_INCOMPATIBLE)
|
if(target.parent)
|
||||||
var/c_type = C.type
|
target.RemoveComponent()
|
||||||
qdel(C)
|
target.parent = src
|
||||||
|
if(target.PostTransfer() == COMPONENT_INCOMPATIBLE)
|
||||||
|
var/c_type = target.type
|
||||||
|
qdel(target)
|
||||||
CRASH("Incompatible [c_type] transfer attempt to a [type]!")
|
CRASH("Incompatible [c_type] transfer attempt to a [type]!")
|
||||||
return
|
if(target == AddComponent(target))
|
||||||
C._RemoveFromParent()
|
target._JoinParent()
|
||||||
helicopter.SendSignal(COMSIG_COMPONENT_REMOVING, C)
|
|
||||||
C.parent = src
|
|
||||||
if(C == AddComponent(C))
|
|
||||||
C._JoinParent()
|
|
||||||
|
|
||||||
/datum/proc/TransferComponents(datum/target)
|
/datum/proc/TransferComponents(datum/target)
|
||||||
var/list/dc = datum_components
|
var/list/dc = datum_components
|
||||||
|
|||||||
@@ -23,10 +23,12 @@
|
|||||||
remove()
|
remove()
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/component/decal/OnTransfer(atom/thing)
|
/datum/component/decal/PreTransfer()
|
||||||
remove()
|
remove()
|
||||||
remove(thing)
|
|
||||||
apply(thing)
|
/datum/component/decal/PostTransfer()
|
||||||
|
remove()
|
||||||
|
apply()
|
||||||
|
|
||||||
/datum/component/decal/proc/generate_appearance(_icon, _icon_state, _dir, _layer, _color)
|
/datum/component/decal/proc/generate_appearance(_icon, _icon_state, _dir, _layer, _color)
|
||||||
if(!_icon || !_icon_state)
|
if(!_icon || !_icon_state)
|
||||||
|
|||||||
@@ -238,5 +238,5 @@
|
|||||||
cd++
|
cd++
|
||||||
CHECK_TICK
|
CHECK_TICK
|
||||||
|
|
||||||
/datum/component/lockon_aiming/OnTransfer(datum/new_parent)
|
/datum/component/lockon_aiming/PostTransfer(datum/new_parent)
|
||||||
CRASH("Warning: Lockon aiming component transfer attempted, but transfer behavior is not implemented!")
|
return COMPONENT_INCOMPATIBLE
|
||||||
|
|||||||
@@ -27,10 +27,13 @@
|
|||||||
QDEL_NULL(holder)
|
QDEL_NULL(holder)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/component/mirage_border/OnTransfer(atom/thing)
|
/datum/component/mirage_border/PreTransfer()
|
||||||
if(!isturf(thing))
|
holder.moveToNullspace()
|
||||||
|
|
||||||
|
/datum/component/mirage_border/PostTransfer()
|
||||||
|
if(!isturf(parent))
|
||||||
return COMPONENT_INCOMPATIBLE
|
return COMPONENT_INCOMPATIBLE
|
||||||
holder.forceMove(thing)
|
holder.forceMove(parent)
|
||||||
|
|
||||||
/obj/effect/abstract/mirage_holder
|
/obj/effect/abstract/mirage_holder
|
||||||
name = "Mirage holder"
|
name = "Mirage holder"
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
var/transfer_contents_on_component_transfer = FALSE
|
var/transfer_contents_on_component_transfer = FALSE
|
||||||
var/list/datum/component/storage/slaves = list()
|
var/list/datum/component/storage/slaves = list()
|
||||||
|
|
||||||
|
var/list/_contents_limbo // Where objects go to live mid transfer
|
||||||
|
var/list/_user_limbo // The last users before the component started moving
|
||||||
|
|
||||||
/datum/component/storage/concrete/Initialize()
|
/datum/component/storage/concrete/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
RegisterSignal(COMSIG_ATOM_CONTENTS_DEL, .proc/on_contents_del)
|
RegisterSignal(COMSIG_ATOM_CONTENTS_DEL, .proc/on_contents_del)
|
||||||
@@ -23,6 +26,8 @@
|
|||||||
for(var/i in slaves)
|
for(var/i in slaves)
|
||||||
var/datum/component/storage/slave = i
|
var/datum/component/storage/slave = i
|
||||||
slave.change_master(null)
|
slave.change_master(null)
|
||||||
|
QDEL_LIST(_contents_limbo)
|
||||||
|
_user_limbo = null
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/component/storage/concrete/master()
|
/datum/component/storage/concrete/master()
|
||||||
@@ -31,22 +36,28 @@
|
|||||||
/datum/component/storage/concrete/real_location()
|
/datum/component/storage/concrete/real_location()
|
||||||
return parent
|
return parent
|
||||||
|
|
||||||
/datum/component/storage/concrete/OnTransfer(datum/new_parent)
|
/datum/component/storage/concrete/PreTransfer()
|
||||||
if(!isatom(new_parent))
|
|
||||||
return COMPONENT_INCOMPATIBLE
|
|
||||||
var/list/mob/_is_using
|
|
||||||
if(is_using)
|
if(is_using)
|
||||||
_is_using = is_using.Copy()
|
_user_limbo = is_using.Copy()
|
||||||
close_all()
|
close_all()
|
||||||
if(transfer_contents_on_component_transfer)
|
if(transfer_contents_on_component_transfer)
|
||||||
var/atom/old = parent
|
_contents_limbo = list()
|
||||||
for(var/i in old)
|
for(var/atom/movable/AM in parent)
|
||||||
|
_contents_limbo += AM
|
||||||
|
AM.moveToNullspace()
|
||||||
|
|
||||||
|
/datum/component/storage/concrete/PostTransfer()
|
||||||
|
if(!isatom(parent))
|
||||||
|
return COMPONENT_INCOMPATIBLE
|
||||||
|
if(transfer_contents_on_component_transfer)
|
||||||
|
for(var/i in _contents_limbo)
|
||||||
var/atom/movable/AM = i
|
var/atom/movable/AM = i
|
||||||
AM.forceMove(new_parent)
|
AM.forceMove(parent)
|
||||||
if(_is_using)
|
_contents_limbo = null
|
||||||
for(var/i in _is_using)
|
if(_user_limbo)
|
||||||
var/mob/M = i
|
for(var/i in _user_limbo)
|
||||||
show_to(M)
|
show_to(i)
|
||||||
|
_user_limbo = null
|
||||||
|
|
||||||
/datum/component/storage/concrete/_insert_physical_item(obj/item/I, override = FALSE)
|
/datum/component/storage/concrete/_insert_physical_item(obj/item/I, override = FALSE)
|
||||||
. = TRUE
|
. = TRUE
|
||||||
|
|||||||
@@ -108,7 +108,7 @@
|
|||||||
LAZYCLEARLIST(is_using)
|
LAZYCLEARLIST(is_using)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/component/storage/OnTransfer(datum/new_parent)
|
/datum/component/storage/PreTransfer()
|
||||||
update_actions()
|
update_actions()
|
||||||
|
|
||||||
/datum/component/storage/proc/update_actions()
|
/datum/component/storage/proc/update_actions()
|
||||||
|
|||||||
@@ -135,12 +135,14 @@
|
|||||||
for(var/i in time_left_list)
|
for(var/i in time_left_list)
|
||||||
. |= text2num(i)
|
. |= text2num(i)
|
||||||
|
|
||||||
/datum/component/wet_floor/OnTransfer(datum/to_datum)
|
/datum/component/wet_floor/PreTransfer()
|
||||||
if(!isopenturf(to_datum))
|
|
||||||
return COMPONENT_INCOMPATIBLE
|
|
||||||
var/turf/O = parent
|
var/turf/O = parent
|
||||||
O.cut_overlay(current_overlay)
|
O.cut_overlay(current_overlay)
|
||||||
var/turf/T = to_datum
|
|
||||||
|
/datum/component/wet_floor/PostTransfer()
|
||||||
|
if(!isopenturf(parent))
|
||||||
|
return COMPONENT_INCOMPATIBLE
|
||||||
|
var/turf/T = parent
|
||||||
T.add_overlay(current_overlay)
|
T.add_overlay(current_overlay)
|
||||||
|
|
||||||
/datum/component/wet_floor/proc/add_wet(type, duration_minimum = 0, duration_add = 0, duration_maximum = MAXIMUM_WET_TIME, _permanent = FALSE)
|
/datum/component/wet_floor/proc/add_wet(type, duration_minimum = 0, duration_add = 0, duration_maximum = MAXIMUM_WET_TIME, _permanent = FALSE)
|
||||||
|
|||||||
@@ -68,11 +68,20 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
|
|||||||
blueprint_data = null
|
blueprint_data = null
|
||||||
|
|
||||||
var/list/old_baseturfs = baseturfs
|
var/list/old_baseturfs = baseturfs
|
||||||
changing_turf = TRUE
|
|
||||||
|
|
||||||
|
var/list/transferring_comps = list()
|
||||||
|
SendSignal(COMSIG_TURF_CHANGE, path, new_baseturfs, flags, transferring_comps)
|
||||||
|
for(var/i in transferring_comps)
|
||||||
|
var/datum/component/comp = i
|
||||||
|
comp.RemoveComponent()
|
||||||
|
|
||||||
|
changing_turf = TRUE
|
||||||
qdel(src) //Just get the side effects and call Destroy
|
qdel(src) //Just get the side effects and call Destroy
|
||||||
var/turf/W = new path(src)
|
var/turf/W = new path(src)
|
||||||
|
|
||||||
|
for(var/i in transferring_comps)
|
||||||
|
W.TakeComponent(i)
|
||||||
|
|
||||||
if(new_baseturfs)
|
if(new_baseturfs)
|
||||||
W.baseturfs = new_baseturfs
|
W.baseturfs = new_baseturfs
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user