Commit Graph

43 Commits

Author SHA1 Message Date
oranges
0267bce949 Turns out a bunch of components do not properly transfer because of (#42691)
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)
2019-03-05 20:27:29 +01:00
Emmett Gaines
f1d19d5787 Turn a runtime component sanity check into a unit test (#40851) 2018-10-12 15:41:55 -07:00
ninjanomnom
57c8c10be7 Move signal registration from components to datums 2018-08-22 14:04:48 -04:00
Garen Crownguard
12c5990364 Fix AddComponent(target) not working with instanced components (#39484) 2018-08-05 22:08:52 -04:00
Emmett Gaines
418ea4fa2a Fixes redirect component transfers (#39290) 2018-07-24 21:03:53 +02:00
ninjanomnom
e274ff1b18 Fixes porta_turret and decal shuttle rotations
Also removes a related unused signal
2018-07-10 18:30:23 -04:00
Emmett Gaines
34a3d2da4d Refactors component signals registration (#38798)
Datums know what signals are being listened for and components can now be registered to listen for signals on more than one object.
2018-07-05 00:56:39 +03:00
ninjanomnom
71e2354d48 Adds global signals and a silly example use case 2018-06-18 03:06:09 -04:00
Jordan Brown
98903e3d43 Removes status_effect_listener (#38537) 2018-06-17 21:54:02 -04:00
ninjanomnom
6657ee8def Some minor cleanup to RegisterSignal 2018-06-16 19:04:15 -04:00
Jordan Brown
e8c61536a1 Adds some signal helpers (#38494) 2018-06-15 21:01:20 -07:00
ninjanomnom
0ac63dbde7 Primary changes 2018-06-13 19:18:44 -04:00
fludd12
0d429e01b8 [READY][FINALLY] Various Crossbreed Updates (#38039)
* A Variety Of Updates

* Lovey Sprites!

* Adds implementation for listening status effects.

* Fixes implementation, uses defines instead of magic strings.

* Completely reworks status effect listeners

* Fixes Love Potions

* Fixes Approximately All The Things.jpg
2018-06-08 15:51:03 +03:00
AnturK
74e646b554 Revert "Removes unused optimization from SendSignal (#37551)" (#37776)
This reverts commit 8b8fc1a22c.
2018-05-10 11:35:26 +02:00
Jordan Brown
8b8fc1a22c Removes unused optimization from SendSignal (#37551) 2018-05-10 09:06:47 +02:00
ninjanomnom
5028239b35 Modifies the component transfer to make ChangeTurf work 2018-04-29 18:11:02 -04:00
Jordan Brown
a1b89c3643 Removes redundant COMPONENT_INCOMPATIBLE crashes (#37389) 2018-04-25 06:53:43 -04:00
vuonojenmustaturska
8addcd5217 remove 512 version checks 2018-04-11 14:26:22 -05:00
vuonojenmustaturska
1c8e450f15 Fixes geiger counters on engiborgs (#35423)
* a commit

* Update geiger_counter.dm
2018-02-08 12:21:06 -05:00
Jordan Brown
9271f46f8f Adds component incompatible crash to root level so everything doesn't have to do it itself 2018-01-15 13:46:29 -05:00
jammer312
ff2647363c replaced all these dumb commits with one 2017-12-30 17:49:42 +03:00
ninjanomnom
00a21c94f8 renames define to UNIQUE_PASSARGS 2017-12-19 18:15:00 -05:00
ninjanomnom
a93b957cb5 adds instanceless component dupe mode 2017-12-19 18:15:00 -05:00
Jordan Brown
8cdf67f9a3 Minor component optimizations (#33269)
* Minor component optimizations

* Second argument of list.Copy is optional
2017-12-05 15:51:36 -06:00
Jordan Brown
3aba012d67 Removes ComponentActivated in favor of callbacks (#33274)
* Removes ComponentActivated

* Removes a bit of proc call overhead

* Fix callback definition
2017-12-05 15:41:56 -06:00
Jordan Brown
4e01bba3b5 SendSignal optimization (#33220)
* SendSignal optimization

* Update component README

* Readd required null checks
2017-12-04 06:29:39 -05:00
Emmett Gaines
d56a47253e Bitflag returns from component signals (#33186)
* For more useful returns from sendsignal

* removes a needless else/indentation

* cleanup
2017-12-01 14:09:25 -05:00
Jordan Brown
807311a2cc Fixes component runtimes (#33045) 2017-11-23 20:12:02 +01:00
Leo
b26180de77 Merge pull request #32979 from tgstation/Cyberboss-patch-4
Adds some sanity checks to component creation
2017-11-23 09:47:03 -02:00
Jordan Brown
7cfb48e04f Adds some sanity checks to component creation 2017-11-21 17:45:09 -05:00
kevinz000
beb255dbf1 Refactors uplinks to a component 2017-11-20 00:13:26 -08:00
Emmett Gaines
0f0d39ebff fixes 512 compile reminders (#32582) 2017-11-11 21:32:10 +01:00
Emmett Gaines
f76ccb8de0 fixes null parent in destroy for components (#32351)
* fixes parent being null in destroy

* extends qdel
2017-11-08 09:35:09 +13:00
Emmett Gaines
910be9f4e2 Signal redirection component (#32298)
* redirection component

* makes register signal accept callbacks

* this is a very lightweight component
2017-11-02 15:03:54 -06:00
Jordan Brown
bcbf3030a9 Adds a temporary workaround for a BYOND bug 2017-10-31 21:54:23 -04:00
Jordan Brown
81485cd60d Replace most islist calls in components with length() (#32158)
islist was used to check if a thing was

A. A list of things
B. 1 thing

length was profiled to be faster
2017-11-01 09:11:32 +13:00
Jordan Brown
d088549da0 Minor optimization for _GetInverseTypeList (#32155)
* Minor optimization for _GetInverseTypeList

* We also need to make sure the root component is never instantiated to avoid stack overflows
2017-11-01 09:10:51 +13:00
Jordan Brown
82a4ba34f0 Fixes TakeComponent (#32156)
* Fixes TakeComponent

* Add the note about OnTransfer and COMPONENT_INCOMPATIBLE

* Fix behaviour

* Missed datum.dm
2017-10-30 09:52:18 +01:00
oranges
5cefa88579 Merge pull request #31941 from tgstation/Cyberboss-patch-2
Adds a method to transfer all components from one datum to another
2017-10-28 11:39:40 +13:00
Jordan Brown
82e70ff429 Allows components to qdel from Initialize 2017-10-26 00:01:19 -05:00
Jordan Brown
1bdea2db01 Adds a method to transfer all components from one datum to another 2017-10-19 22:36:48 -04:00
Jordan Brown
49feced945 RegisterSignal() can now accept a list (#31098)
* RegisterSignal may now accept a list of signals

* Update old calls to RegisterSignal()
2017-09-30 14:58:52 +02:00
Jordan Brown
8fdea0d473 SendSignal() speedup (#30929)
* Rename component.dm to _component.dm

* Merges RecieveSignal() into SendSignal()

* Makes ComponentActivated() and AfterComponentActivated() async
2017-09-23 20:31:03 +10:00