Commit Graph

72 Commits

Author SHA1 Message Date
SkyratBot
c82b3ca3d7 [MIRROR] makes vent scrubbers only activate if a gas they filter is on their tile, again! alive edition [MDB IGNORE] (#12381)
* makes vent scrubbers only activate if a gas they filter is on their tile, again! alive edition (#65591)

Alsonce scrubbers only wake up if something they can filter is on the tile an existing bug where scrubbers dont filter very small but non garbage collectable amounts of a gas becomes a big issue, as in without changing scrubbing rates you can breathe once on a tile with a scrubber set to scrub co2 and that co2 wont go away barring any other factors and the scrubber wont go to sleep. so now with the idea of rohesie and permission of lemon i changed how scrubbers removed small molar amounts of gas from their turf. now scrubbers will look through 100% of the turfs air mix for filtering, but will only remove up to
gas moles * (scrubber volume / turf volume) * (gas moles / total filterable moles) moles from each filterable gas in the turfs mix unless that amount is less than either MOLAR_ACCURACY * 100 or the number of moles of that filterable gas, in which case all of the moles of that gas are subtracted from the mix. this is to make it easier for the scrubber to remove very small amounts of gas with filters without changing how fast they scrub large amounts of gas, thus making scrubbers able to go to sleep faster only after a gas has been reduced to near zero

scrubbers are the biggest proportion of SSair's machine processing cost which is a non trivial amount of SSair's total cost. now they will only do most of their work if they can actually scrub anything on the tile which is a minority of the time.

* makes vent scrubbers only activate if a gas they filter is on their tile, again! alive edition

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
2022-03-30 14:59:15 +01:00
SkyratBot
73010c500b [MIRROR] Fixes GetComponents() returning a list with a null entry when there's no component of a given type (#8094)
* Fixes GetComponents() returning a list with a null entry when there's no component of a given type (#61267)

Fixes GetComponents() returning a list with a null entry when there's no component of a given type

This can cause runtimes. The lists should only contains instances of a specific component type.

* Fixes GetComponents() returning a list with a null entry when there's no component of a given type

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2021-09-11 16:28:40 +01:00
SkyratBot
169c42a262 [MIRROR] Refactors connect_loc_behalf into a component (#7613)
* Refactors connect_loc_behalf into a component (#60678)

See title. Also refactors caltrops into a component because they use connect_loc_behalf which requires them to hold the state.

This also fixes COMPONENT_DUPE_SELECTIVE from just outright not working.

connect_loc_behalf doesn't make sense as an element because it tries to hold states. There is also no way to maintain current behaviour and not have the states that it needs.
Due to the fact that it tries to hold states, it means the code itself is a lot more buggy because it's a lot harder to successfully manage these states without runtimes or bugs. 

On metastation, there is only 2519 connect_loc_behalf components at roundstart. MrStonedOne has told me that datums take up this much space:
image

If we do the (oversimplified) math, there are only ever 5 variables that'll likely be changed on most connect_loc_behalf components at runtime:
connections,
tracked,
signal_atom,
parent,
signal_procs

This means that on metastation at roundstart, we take up this amount: (24 + 16 * 5) * 2519 = 261.97600 kilobytes
This is not really significant and the benefits of moving this to a component greatly outweighs the memory cost.

(Basically the memory cost is outweighed by the maint cost of tracking down issues with the thing. It's too buggy to be viable longterm basically)

* Update glass.dm

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-08-17 20:29:11 +01:00
SkyratBot
b845d13fd2 [MIRROR] Renames RemoveComponent, fixes a dumb runtime in Destroy (#7347)
* Renames RemoveComponent, fixes a dumb runtime in Destroy (#60653)

* Renames RemoveComponent, as its purpose was unclear. Fixes up some dumb uses, and properly docs its status as a helper proc for transfering components

* Renames RemoveComponent, fixes a dumb runtime in Destroy

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2021-08-03 20:06:15 +01:00
SkyratBot
0196826791 [MIRROR] Complains about annomalus unregisters, hopefully this helps downline (#6096)
* Unregistering with a list of lists will fail, but not loudly, which causes some really painful errors. Let's make a stack trace for it, and fix the one case I know of (#59434)

* Complains about annomalus unregisters, hopefully this helps downline

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2021-06-03 15:20:39 +12:00
SkyratBot
b7d3a948dd [MIRROR] Protects against signal race condition (#6094)
* Protects against signal race condition (#59432)

* Protects against signal race condition

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2021-06-03 14:56:03 +12:00
SkyratBot
2977a55932 [MIRROR] optimizes some internals of signal and component code (#5873)
* optimizes some internals of signal and component code (#59154)

* optimizes some internals of signal and component code

* comment and a better var name

* gets rid of DF_SIGNAL_ENABLED and all referencing code because its dumb

* gets rid of NONE | CallAsync(stuff)

* fixes conflicts

* puts NONE back in

* optimizes some internals of signal and component code

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
2021-05-23 04:57:15 +01:00
SkyratBot
22a553a0c4 [MIRROR] Removes SIGNAL_HANDLER_DOES_SLEEP and makes signals synchronous (#5845)
* Removes SIGNAL_HANDLER_DOES_SLEEP and makes signals synchronous (#59176)

* Removes SIGNAL_HANDLER_DOES_SLEEP and makes signals synchronous

* a

* Update peacekeeper_clothing.dm

* Update peacekeeper_clothing.dm

* Update peacekeeper_clothing.dm

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-05-21 14:51:00 +01:00
SkyratBot
2e473b758e [MIRROR] makes LoadComponent() a macro like AddComponent() is so it supports named arguments (#5802)
* makes LoadComponent() a macro like AddComponent() is so it supports named arguments

* Update miscellaneous.dm

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
2021-05-20 23:27:18 +01:00
SkyratBot
37f63eee04 [MIRROR] Fixes a bug in signal unregistration code (#5822)
* Fixes a bug in signal unregistration code that was causing unrelated objects to lose their registration in a (#59116)

This was causing unrelated objects to lose their registration in a hyper rare case.

The process went something like:
when object foo is registered to something and object bar is registered to the same object with a different
signal it will remove foo's signal only when foo is the only one registered to the object with that signal
Why it's good for the game

This was breaking #58918 when blood wasn't qdel'd post test. I'm so happy I found this.
It's a rare case, so I doubt it'll effect a lot of things, but I can trust UnregisterSignal again, which is very nice.

* Fixes a bug in signal unregistration code

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2021-05-20 22:57:07 +01:00
SkyratBot
d5423c9ec5 [MIRROR] Makes it so you cant apply component to qdeleted targets (#4230)
* Makes it so you cant apply component to qdeleted targets (#57773)

This shouldn't be happening but it seems it does in at least one case with forensics component being applied to some qdeleted gibs.

* Makes it so you cant apply component to qdeleted targets

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
2021-03-18 18:04:10 +00:00
SkyratBot
b332b46b65 [MIRROR] Remove hideous inline tab indentation, and bans it in contributing guidelines (#3394)
* Remove hideous inline tab indentation, and bans it in contributing guidelines

* a

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
2021-02-15 15:32:02 +00:00
SkyratBot
d46f728fa5 [MIRROR] Moves /datum/var/signal_enabled to datum flags (#3171)
* Moves /datum/var/signal_enabled to datum flags (#56372)

* Moves /datum/var/signal_enabled to datum flags

`signal_enabled` is a variable on /datum, so present almost every object
in the game. Folding it into the existing `datum_flags` variable will
save allocating a variable on every datum in the game.

- Clown weaponry was using the `signal_enabled` variable to turn their
  attached slippery component on and off when the shield/sword was
  toggled. They now just remove/add the component, rather than touching
  deep datum internals.

* Moves /datum/var/signal_enabled to datum flags

Co-authored-by: coiax <yellowbounder@gmail.com>
2021-02-07 14:09:15 +00:00
SkyratBot
c487c73f39 [MIRROR] Grep for space indentation (#1969)
* Grep for space indentation

* aa

* Update species.dm

* Update species.dm

* Update maps.dm

* Update examine.dm

Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
Co-authored-by: Azarak <azarak10@gmail.com>
2020-12-01 12:26:41 +01:00
jdawg1290
62676e72a8 Force LF line endings with gitattributes and convert repo (#52266)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
2020-07-16 03:02:40 +03:00
ShizCalev
1059a64a98 I before E, except after C. (#51543) 2020-06-10 23:23:50 +02:00
spessman-007
5ae305ec9f Resolve issues with incorrect usage of a/an (#51095)
Co-authored-by: NewSta <spessman-007@users.noreply.github.com>
2020-05-25 01:34:34 +08:00
Ryll Ryll
5c174800fb Grenades and projectiles can have shrapnel and embed, all carbons can suffer embeds, some bullets can ricochet, sizable refactor of embedding (#49634)
About The Pull Request

It annoyed me that we have a perfectly good frag grenade item, and a perfectly good shrapnel component, but no crossover episode between the two. This remedies that, and does a lot, lot more.

dreamseeker_2020-03-30_05-01-13.png

dreamseeker_2020-03-30_05-01-26.png

Big points:

    Adds new component: pellet_cloud, which can be used by ammo casings, guns, and landmines to spray shrapnel and display aggregate hit messages ("You're hit by 6 buckshot pellets!" vs "You're hit by the buckshot pellet in the X" x6). All gun ammo that shoot multiple pellets now use this component on firing.
    Adds stingbangs, premium less-lethal grenades that shoot off lots of stinger pellets, to cargo. Frag grenades are also reworked to have smaller booms, but shoot off lots of shrapnel shards. You can jump on top of these grenades to absorb a portion of the shrapnel to save those around you! There's an achievement for dying this way, called "Look Out, Sir!"
    Projectiles can now embed items/shrapnel. Adds .38 DumDum ammo to cargo that does less damage and has negative armor pen, but can embed in people. This is the only ammo that currently embeds.
    Bullets can now ricochet off walls, structures, and machinery (harder surfaces are more likely to ricochet). Only standard .38 and Match Grade .38/.357/L6 ammo can ricochet, with Match Grade being much better at ricocheting. You can buy Match Grade .38 from cargo and Match Grade L6 ammo from the nuke uplink, while Match .357 is admin only.
    Armor now protects you from harmful embeds, taking the better of the bullet/bomb armor on the affected limb. Armor penetration can modify this of course, and many blunt embeds like stingbangs and DumDum bullets are significantly worse if you have even 1 armor.

Other misc fixes/changes

    Refactored the embed element a bunch and fixed it creating new elements for every instance rather than expected bespoke behavior. There are new /obj/item helpers for modifying and adding embedding.
    Fixes #49989: Spears can no longer embed in turfs cause their sprite is annoying to me, it's generally harder for most things to embed in turfs
    Fixes #49741: New carbon helpers for removing embedded objects
    Fixes #46416: Handles embedded objects getting qdel'd or moved while embedded
    Renamed the old shrapnel component for RPG loot to MIRV to avoid confusion
    Repathed frag grenades from under minibombs to under base grenades, and added explosion vars to base grenades

Why It's Good For The Game

Fixes a bunch of janky design with embeds, adds lots of new avenues for projectile and grenade variety, ricochets and collateral damage are fun!
Changelog

🆑 Ryll/Shaps
add: Adds stingbangs to cargo (and one in the sec vendor premium), premium less-lethal grenades that shoot off a giant swarm of stingball pellets to help incapacitate swarms of people in tight quarters. You can jump on top of a live one to be a hero and absorb a bunch of shrapnel, same with frag grenades. There's even an achievement for dying to a grenade you jumped on!
add: Projectiles can now embed in people! Or at least grenade shrapnel and the new .38 DumDum ammo, now available in cargo, can. DumDum rounds excel against unarmored targets, but are pricey and do poorly against armored targets.
add: Bullets can now ricochet! Or at least, standard .38 and the new .38/L6 Match Grade ammo can. Match Grade ammo is finely tuned to ricochet easier and seek targets off bounces better, and can be purchased from cargo (for the .38) or nuke ops uplink (for the L6), but standard .38 ammo has a chance to ricochet as well.
tweak: Frag grenades now have smaller explosions but shoot off a bunch of devastating shrapnel, excellent for soft targets!
tweak: Shotguns and other multi-pellet guns now print aggregate messages, so you'll get one "You've been hit by 6 buckshot pellets!" rather than 6 "You've been hit by the buckshot pellet in the X!" messages. Bye bye lag!
balance: Armor can now protect against embedding weapons, taking the best of either the bullet or bomb armor for the limb in question away from the embed chance. Some weapons are better at piercing armor than others!
/🆑
2020-04-03 16:58:38 +13:00
spookydonut
cea5360e4b Updates codedocs with links (#49497)
About The Pull Request

Updating the best written documentation with the new linking feature.
2020-02-25 08:17:45 +13: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
ece3c04ca3 Fixes an issue where you could unregister someone else's signal (#49224) 2020-02-07 19:46:41 +01:00
spookydonut
9ce2bdae8c COMPONENT_DUPE_SELECTIVE (#48021)
* COMPONENT_DUPE_SELECTIVE

* a

* changes per review

* webedit
2019-12-25 22:02:27 -08:00
Emmett Gaines
22564a3eaf Moves documentation from the component readme to doc comments (#46544)
Also improves some wording and structure
We never remembered to update the readme anyway
2019-09-25 18:43:43 -07:00
oranges
b48ce19e54 Initial pass of documentation on components (#46493) 2019-09-16 16:44:25 +12:00
oranges
3316f0dcbe Merge pull request #44895 from ninjanomnom/signal-async
Makes signal calls async again
2019-07-05 09:34:04 +12:00
ninjanomnom
55b8aa1837 Makes signal calls async again 2019-06-30 21:04:30 -04:00
Tad Hardesty
0f0604575f Add return type annotations to some procs 2019-06-25 23:03:38 -07:00
Emmett Gaines
d615abf23c Replaces callbacks in signals with simple proc paths (#44579) 2019-06-22 18:21:57 +02:00
Emmett Gaines
7250d0ed71 Make GetComponent warn on dupe enabled components (#44226)
GetComponent gets a singular component, if you're trying to get a
component which allows duplicates on the object then you're doing
something that can very easily break. Stop it.

I'll straight up disable the capability once everything that does this
has been cleaned up but each and every one is its own project.
2019-06-05 21:01:12 -07:00
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