Commit Graph

15 Commits

Author SHA1 Message Date
LemonInTheDark ae5a4f955d Pulls apart the vestiges of components still hanging onto signals (#75914)
## About The Pull Request

Signals were initially only usable with component listeners, which while
no longer the case has lead to outdated documentation, names, and a
similar location in code.

This pr pulls the two apart. Partially because mso thinks we should, but
also because they really aren't directly linked anymore, and having them
in this midstate just confuses people.

[Renames comp_lookup to listen_lookup, since that's what it
does](https://github.com/tgstation/tgstation/commit/102b79694fa8eb57ecf7b36032616a9e368ccced)

[Moves signal procs over to their own
file](https://github.com/tgstation/tgstation/commit/33d07d01fd336726b4f6f6f1b61bb0b3f11a00dc)

[Renames the PREQDELETING and QDELETING comsigs to drop the parent bit
since they can hook to more then just comps
now](https://github.com/tgstation/tgstation/commit/335ea4ad081ec63c42cfa05856e582cca833af6e)

[Does something similar to the attackby comsigs (PARENT ->
ATOM)](https://github.com/tgstation/tgstation/commit/210e57051df63f88dac3dd83321236da825aae5e)

[And finally passes over the examine
signals](https://github.com/tgstation/tgstation/commit/65917658fb8a1e7d28ae23c9437a583d646f0302)

## Why It's Good For The Game

Code makes more sense, things are better teased apart, s just good imo

## Changelog
🆑
refactor: Pulled apart the last vestiges of names/docs directly linking
signals to components
/🆑
2023-06-09 06:14:31 +00:00
LemonInTheDark daf55e611c Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars (#75769)
## About The Pull Request

[Improves the documentation of DCS lists, removes old list of callback
docs that no longer
apply](https://github.com/tgstation/tgstation/commit/c3821d9f5ffaeaa4772f927c819da0c1de0ca27c)

[Adds a second signal register to decal rotating, adds a trait to
objects under a tile. STOP DIRECTLY READING HIDDEN LISTS I SWEAR TO
GOD](https://github.com/tgstation/tgstation/commit/6b3f97a76a6f7d24ab952739a1561633922994e1)

[Removes direct reads of the timer list, they were redundant
mostly](https://github.com/tgstation/tgstation/commit/14fcd9f8a6d1b2d42ec6df3493ebc76fe7c12032)

[Please stop directly reading/modifying the traits list to ensure your
dna rot follows the
brain](https://github.com/tgstation/tgstation/commit/ec0e5237ec2b7c3b7806cb993670acc8ce388bdc)

[Marks internal datum lists as well internal with
_](https://github.com/tgstation/tgstation/pull/75769/commits/57c6577ff61629b8ea792ee37ec4f2490a8e2865)

[57c6577](https://github.com/tgstation/tgstation/pull/75769/commits/57c6577ff61629b8ea792ee37ec4f2490a8e2865)

Does the same to _clear_signal_refs() in hopes of keeping people from
touching it

## Why It's Good For The Game

They pissed me off.

Users should not be touching these lists, especially in ways that make
assumptions about their structure and are thus prone to breaking if that
ever changes.
Most of these are close to zero cost changes, using a wrapper to solve
the problem, or just yeeting it

Two aren't, Decals with a direction have gained a second signal register
on init, and things that sit underfloor (cables/pipes) now get a trait
when inserted there.

This should have a minimal impact on memory/init time, bugging
@Mothblocks about it just in case
2023-06-05 22:25:09 -06:00
oranges 74e43bc556 Improve the naming of the element argument hash index selector (#71319)
So confusing name
2022-11-19 17:04:28 -08:00
AnturK 4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00
Mothblocks 673038b3ef Micro-optimize GetIdFromArguments to be 48% faster, gaining 0.48s of init time on local (likely more in prod) (#69659)
About The Pull Request

    Avoids stringifying key unless its necessary. This was done redundantly twice, but I locked it to just the isnum path, as REF will always return a string, and the other path passes istext.
    Use sortTim directly instead of sort_list. sort_list is just sortTim but it copies the list, so it's just wasted cost.

I still would like the bespoke element key option, as that's the only way to drastically cut down costs on things like item descriptions and decals, but this is good for the general use case, and makes it marginally less pressing.

I also want to test if we'd be better off inserting into the list in sorted order rather than sorting it all in the end, but I suspect not.
2022-09-04 09:39:17 +12:00
Ghilker 95c8e00af7 cleanup _HELPERS/_lists.dm and all the necessary files (#61827)
Bring _HELPERS/_lists.dm to latest standards by:
-Adding proper documentation and fixing existing one
-Giving vars proper names
-Procs now use snake case as per standard (many files that use those procs will be affected)
2021-10-12 14:48:51 +01:00
LemonInTheDark 319d7079c3 Revert "Finishes the allocation refactor (#55965)" (#56137)
This reverts commit 87234f3fd8.
2021-01-13 01:17:59 +00:00
TiviPlus 87234f3fd8 Finishes the allocation refactor (#55965)
#53841 continuation
I recall that the reason for infinite stuns and such was that the priority wasn't being cleared properly when something hitched and I fixed it and I don't remember where exactly but it works now (TM)
A variation of this is TMed on TGMC and it works fine
2021-01-11 15:42:00 -03:00
Donkie 53b212ddf2 Process procs now properly utilize deltatime when implementing rates, timers and probabilities (#52981)
* Process procs now properly use deltatime when implementing rates, timers and probabilities

* Review fixes

* Geiger counters cleanup

Made hardsuit geiger code more similar to geiger counter code
Geiger counters are more responsive now

* Moved SS*_DT defines to subsystems.dm

* Rebase fix

* Redefined the SS*_DT defines to use the subsystem wait vars

* Implemented suggested changes by @AnturK

* Commented /datum/proc/process about the deltatime stuff

* Send delta_time as a process parameter instead of the defines

Also DTfied acid_processing

* Dtfied new acid component
2020-09-08 10:24:05 +02:00
Emmett Gaines 9e34b3d6a1 Supports named arguments in AddComponent and AddElement (#49098)
AddComponent/AddElement now support named arguments. This requires passing around an argument list instead of using actual proc args which a bit gross but we can blame byond for forcing this.

InheritComponent uses mirrored init arguments instead of an argument list which means no more accessing it via index to get to the same arguments as in init.

As a small bonus I restructured dcs defines to be a bit more manageable. Mainly just splits them into separate files and gives them their own folder.
2020-02-17 17:57:52 +13:00
Emmett Gaines 12a4983b75 Adds a flag for bespoke elements (#47807)
* Adds a flag for bespoke elements

And applies it to firestacker

* Improves bespoke documentation
2019-11-25 17:53:00 +01:00
Emmett Gaines 328fc7b1f1 Adds elements: Lightweight shared components/Global components (#44817)
If you came here thinking this was some game feature then you are in the wrong place. Here is where I ramble about code.

This adds /datum/element as a sort of sibling to components. Only one of each type gets instanced and they do not get tied directly to any particular thing like a component does. Basically they're a very lightweight component for doing simple functionality that doesn't have much state.

Originally this concept came about as a kind of component that could be shared between many parents to reduce some resource costs. Doing this would allow us to componentize more behaviors that are a part of too many things to be viable to have a whole component for every single one. For example a component on every space turf would be entirely unviable. With elements it's much more reasonable.

This implements a prety bare framework and a couple components are migrated to it. It's ready to be used but I fully expect I'm going to need to refine how it works for all the usecases we'll want it for.

Also: this fixes the qdeleted signal. This signal isn't even possible because after qdel is done there's nothing to receive a signal anyway. I've changed it to a qdeling signal instead. I need it to work for some elements to know when to clean themselves up.
2019-07-09 11:26:51 +12: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 b889b7bc49 Comment and subsystem recover 2018-06-18 15:40:53 -04:00
ninjanomnom 71e2354d48 Adds global signals and a silly example use case 2018-06-18 03:06:09 -04:00