Commit Graph

46 Commits

Author SHA1 Message Date
oranges
56e5dbb7b1 Add return type annotations to some procs, other lint fixes 2019-07-21 22:16:04 +02:00
yogstation13-bot
2b344101a1 [MIRROR] Makes signal calls async again (#6242)
* Makes signal calls async again

* Mirror fix for #6242
2019-07-19 15:40:37 -04:00
yogstation13-bot
a8c46f8149 Replaces callbacks in signals with simple proc paths 2019-06-22 17:20:22 +01:00
yogstation13-bot
09db3e7879 Make GetComponent throw an error on dupe enabled components 2019-06-06 04:59:53 +01:00
oranges
35a56b92fa 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-06 19:56:49 +01:00
Emmett Gaines
be48501be3 Turn a runtime component sanity check into a unit test (#40851) 2018-10-12 23:40:59 +01:00
oranges
a0e3aa0bc8 Merge pull request #39864 from ninjanomnom/datum-registration
Move signal registration from components to datums
2018-08-26 12:41:01 +01:00
Garen Crownguard
03d2dd8da3 Fix AddComponent(target) not working with instanced components (#39484) 2018-08-06 03:08:16 +01:00
Emmett Gaines
9b95e48355 Fixes redirect component transfers (#39290) 2018-07-26 19:40:54 +02:00
Jordan Brown
a3c3f54066 Merge pull request #39055 from ninjanomnom/shuttle-rotation-fixes
Fixes porta_turret and decal shuttle rotations
2018-07-11 20:12:29 +01:00
Emmett Gaines
3e52d953af 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-04 22:56:50 +01:00
Jordan Brown
30f0b26ddd Merge pull request #38574 from ninjanomnom/glob-signals
Global component signals
2018-06-19 23:18:39 +01:00
Ling
0585328606 Merge pull request #1337 from yogstation13/upstream-merge-38537
[MIRROR] Removes status_effect_listener
2018-06-18 12:05:55 +02:00
Jordan Brown
1725713d33 Removes status_effect_listener (#38537) 2018-06-18 02:54:43 +01:00
Jordan Brown
865aae94bd Merge pull request #38542 from ninjanomnom/do-you-have-a-callback-license
Some minor cleanup to RegisterSignal
2018-06-18 01:31:22 +01:00
Jordan Brown
f8d399cb19 Adds some signal helpers (#38494) 2018-06-16 10:31:49 +01:00
Tad Hardesty
10e0fa2560 Merge pull request #38287 from ninjanomnom/signal-define
Use a define to speed up sending signals to datums with no signals
2018-06-15 12:40:41 +01:00
fludd12
d58f9e5b0e [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 13:51:41 +01:00
Jordan Brown
cd97219f32 Merge pull request #37565 from ninjanomnom/component-limbo
Modifies component transfer to make ChangeTurf able to transfer components
2018-05-01 03:17:15 +01:00
Jordan Brown
6dd45dd630 Removes redundant COMPONENT_INCOMPATIBLE crashes (#37389) 2018-04-25 11:54:25 +01:00
vuonojenmustaturska
9d1a1e28e8 remove 512 version checks 2018-04-11 20:27:17 +01: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