Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduction of the assembly component and refactoring of pipeframe assemblies #15687

Merged
merged 11 commits into from Sep 12, 2023

Conversation

M-Earthfire
Copy link
Contributor

[Game-Objects][Code-Quality][QoL]

About the PR

This PR introduces /datum/component/assembly. It can be added to an atom to call a proc on the atom whenever another atom that is specified in the component is used on it. Optionally, the same proc can be called when the atom the component is added on is used on that specified component.

The component takes the following arguments in the order given here:

  • to_combine_item: this specifies which items will trigger the interaction defined in proc_to_call. This field works with 3 different input types: if a path is given, it checks for this atom path. If a list is given, the component checks against each path within the list. If a tool flag, e.g. TOOL_CUTTING, is given, it checks for the corresponding tool type.
  • proc_to_call: This takes a PROC_REF to call when the interaction goes off. Make sure this proc returns TRUE if the assembly was successfull and you don't want the attack to go through
  • on_tool_attack: If set to TRUE, the interaction will work if either the component-atom is used on a compatible atom or the compatible atom is used on the atom with the component. Set this to FALSE if you want interactions like tools being used on the atom in question.

To demonstrate the use of this component, all assembly steps of the pipeframe were refactored to use this component. This includes many of the pipeshot steps and the pipebomb assemblies.

Since this PR makes assemblies by hitting cabled frames with igniter-assemblies and vice-versa, the standard pipebomb now requires a timer instead of a timer/igniter-assembly.

This PR fixes #14525

Also, this PR fixes a bug where pipebomb assemblies made out of wired frames didn't carry special items in them, but pipebomb assemblies made out of standard pipebombs did.

Why's this needed?

having to juggle multiple states on assembly process is very cumbersome and requires escalating if-trees. Splitting the steps off by a component enables to just add the new steps and remove the old ones from the item once it has reached a new state. This clear up the code. Also the two-side compability of the component enables to add the component once to the parent that should carry the logic instead of having to copy the assembly step on multiple items.

The refactor of the pipebomb assembly steps serves as an example of it's use. I tried to hold myself back and not make the PR explode too much in scope, since working on pipebomb-, mousetrap- or igniter-assemblies made me scream on multiple occassions. E.g. complete refactor of igniter-assemblies is out of scope of this PR, although the integration of the component helped clean it up.

On the player side, not having to specifically hit the pipebomb with the assemblies helped clear up some confusions and makes construction less of a hassle. The drawback was the necessity to move the standard pipebomb to use a timer.

Changelog

(u)Lord_Earthfire
(+)Pipebomb- and beaker-assemblies should be more intutive to create now.
(+)Standard pipebombs are now created by using a timer instead of a timer/igniter-assembly with a pipebomb frame.

@keywordlabeler keywordlabeler bot added C-Bug A bug that impacts usage of a feature C-QoL A quality of life improvement that makes the game easier to play labels Sep 4, 2023
@github-actions github-actions bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 4, 2023
@ZeWaka ZeWaka added the A-Game-Objects The point of this PR is to deal with a specific game object label Sep 5, 2023
@@ -653,6 +702,94 @@ Contains:
src.name = "Radio/Igniter/Beaker Assembly"
return

// proximity-ignite-assemblies
//Oh for fucks sake, why the fuck aren't these under a single parent? I have added these assembly procs three times already.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're already rewriting them, why not make this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it, but then i would add tons of mapping changes and would need to touch how these are assembled as well. This means i would be touching signaler/igniter/timer and proximity sensor code as well. Overall, i have searched for a point to say "ok, somewhere i got to split it to make the PR not explode too much" and decided to stop at the point where the pipebomb frame interacts with the assemblies. And this PR is already XXL-sized...

But i would definetly tackle the refactor next once this is merged.

@github-actions github-actions bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 5, 2023
@ZeWaka ZeWaka added E-Add-To-Wiki A PR that will require changes to the wiki A-Internal Deals with major internal, generally non-player facing code - e.g. types labels Sep 9, 2023
code/datums/components/_component.dm Outdated Show resolved Hide resolved
code/datums/components/assembly_comp.dm Show resolved Hide resolved
code/datums/components/assembly_comp.dm Outdated Show resolved Hide resolved
code/datums/components/assembly_comp.dm Outdated Show resolved Hide resolved
M-Earthfire and others added 5 commits September 9, 2023 19:44
Co-authored-by: ZeWaka <zewakagamer@gmail.com>
Co-authored-by: ZeWaka <zewakagamer@gmail.com>
Co-authored-by: ZeWaka <zewakagamer@gmail.com>
Co-authored-by: ZeWaka <zewakagamer@gmail.com>
@frawhst frawhst merged commit 1376a5d into goonstation:master Sep 12, 2023
21 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 12, 2023
@M-Earthfire M-Earthfire deleted the Assembly-Component branch September 12, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Game-Objects The point of this PR is to deal with a specific game object A-Internal Deals with major internal, generally non-player facing code - e.g. types C-Bug A bug that impacts usage of a feature C-QoL A quality of life improvement that makes the game easier to play E-Add-To-Wiki A PR that will require changes to the wiki size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Igniter/signaller assemblies do not combine with pipebombs
5 participants