mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
one of three things.
1. They don't use RegisterWithParent or UnregisterFromParent to unregister
and register signals
2. They use callbacks which refer to a source object, which is usually deleted
on transfer, or lost in some manner, or simply makes no sense at all to be
transferred
3. the component was never designed to be transferred at all
TransferComponents gave no shits about any of this and just blindly transferred
all components, if they were actually capable of it or not.
I only noticed this because it was causing chairs to break as they would not register signals
and verbs correctly for rotation after being picked up and then placed down, and a player
reported that issue via ahelp.
Luckily we caught it before the rot got anywhere, only chairs and the shuttle subystem
tend to use this proc (Shuttle uses it on turfs), can you imagine if everything was using
this LMAO
Which is good because it's more dangerous than a loaded gun
I have added a can_transfer var, that is true when a component is valid to
actually transfer, which means the dev has actually thought about what happens when
you take the parent object away and swap it for another and all the crazy that is entailed
by this
I have done my best to audit what components are actually
transferable, but things are basically a hot mess (Thanks @Cyberboss )
The following components required edits:
Forensics:
did not register/deregister the clean_act signal properly, did not checkblood on new parent
Rotation:
did not use RegisterWithParent or UnregisterFromParent, turned out
to not be transferable anyway due to having callbacks that can be
passed in to the parent with unknown sources that we can't feasibly
reuse (i.e if you're transferred from a chair to a bed, your old rotation
call backs are no longer valid). Turns out the use case it was for (just chairs)
didn't need it anyway, so I just made it non valid for transfer.
Wet Floor:
Honestly this one is just a hot mess, it should be a subtype of the slippery
component with the extra wet turf handling.
As it is it basically manages a slippery component on top of it's own extra
functionality, so that's a major code smell.
I added registration/unregistration of the signals, and made it's pretransfer
remove the slippery component and the posttransfer add it back (via update_flags)
Components that seem transferable without issues
mirage_border
orbiter
decal
spill
storage (I hope to earth)
43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
/datum/component/mirage_border
|
|
can_transfer = TRUE
|
|
var/obj/effect/abstract/mirage_holder/holder
|
|
|
|
/datum/component/mirage_border/Initialize(turf/target, direction, range=world.view)
|
|
if(!isturf(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
if(!target || !istype(target) || !direction)
|
|
. = COMPONENT_INCOMPATIBLE
|
|
CRASH("[type] improperly instanced with the following args: target=\[[target]\], direction=\[[direction]\], range=\[[range]\]")
|
|
|
|
holder = new(parent)
|
|
|
|
var/x = target.x
|
|
var/y = target.y
|
|
var/z = target.z
|
|
var/turf/southwest = locate(CLAMP(x - (direction & WEST ? range : 0), 1, world.maxx), CLAMP(y - (direction & SOUTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
|
|
var/turf/northeast = locate(CLAMP(x + (direction & EAST ? range : 0), 1, world.maxx), CLAMP(y + (direction & NORTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
|
|
//holder.vis_contents += block(southwest, northeast) // This doesnt work because of beta bug memes
|
|
for(var/i in block(southwest, northeast))
|
|
holder.vis_contents += i
|
|
if(direction & SOUTH)
|
|
holder.pixel_y -= world.icon_size * range
|
|
if(direction & WEST)
|
|
holder.pixel_x -= world.icon_size * range
|
|
|
|
/datum/component/mirage_border/Destroy()
|
|
QDEL_NULL(holder)
|
|
return ..()
|
|
|
|
/datum/component/mirage_border/PreTransfer()
|
|
holder.moveToNullspace()
|
|
|
|
/datum/component/mirage_border/PostTransfer()
|
|
if(!isturf(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
holder.forceMove(parent)
|
|
|
|
/obj/effect/abstract/mirage_holder
|
|
name = "Mirage holder"
|
|
anchored = TRUE
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|