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

Create atom/item specific procs to handle most in-combat material procs and make most of these material procs compatible with atoms #15057

Merged
merged 20 commits into from Aug 5, 2023

Conversation

M-Earthfire
Copy link
Contributor

[Material][Quality][Refactor]

About the PR

This PR moves most direct calls of material procs into item- or atom specific procs. To accomodate it, most material procs that are affected by this are refactored to be passed the broadest class possible, which is for many of these procs atoms.

This fixes #12093

Thus, multiple procs are introduced,

atom/proc/material_on_attack_use is used when the material is used for an attack

atom/proc/material_trigger_on_mob_attacked is called on every atom in a mob when that mob that contains something out of the material is attacked. "situation modifier" gets passed on this proc the attack zone that the attack tries to hit, if there was any. The respectable material proc was only called on items in the mob, e.g. implants, now it is called on equipped items as well. With some caveat.

atom/proc/material_trigger_on_bullet has the same behaviour, just for bullet hits.

atom/proc/material_trigger_when_attacked is called when an item out of the material is affected. This now gets passed mobs as attacking atoms for cases like wall shamshes or laywer hands on tables

/atom/proc/material_trigger_on_temp, atom/proc/material_trigger_on_explosion, atom/proc/material_trigger_on_blob_attacked, atom/proc/material_trigger_on_chems, /obj/item/proc/material_on_drop, /obj/item/proc/material_on_pickup were added for their respectable triggers.

This two material procs that are not routed to atom-calls are triggersOnLife and triggersOnEntered. These require some untangling and more severe modification, to some degree in their design, because of which i decided to move these into their own PR's

To show off these what these procs enable, the behaviour on how equipped items on mobs call their material effects when the mob is hit was added.

Before, equipped items didn't reacted at all if you attacked someone. Now, they get affected, based on hit location and object size. If you target a location that is covered by a clothing, that clothing's material effect gets triggered.

For items that are not clothing, they are only affected guaranteed when you are blocking with them. Else, there is a chance based of the item size to hit it.

In general, that means someone with an erebite PDA might find it exploding with a small chance while they are wearing it.

Beyond that, multiple occassions were fixed where the wrong proc was called, e.g. when destroying plated handcuffs

Why's this needed?

In general, routing material procs of the respectable atoms enables to more finetune when and how the effects of materials are called. This is especially important since matsci items (spacesuits, spears, arrows) are very janky to make their material effects work properly. This PR will very easy enable to e.g. make the shaft affect the on-entered or on-life effect and the tip of the spear to affect the on-attack-effect.

Also, the cleanup has some interesting side effects. Like reflective walls being able to reflect bullets again. This will also apply to mobs made out of the material now (e.g. syreline-ore-chickens).

Changelog

(u)Lord_Earthfire
(+)Material effects on-attacks are now happening more consistent, e.g. erebite hats weared on you will explode if you get bonked on the head.

@keywordlabeler keywordlabeler bot added the C-Bug A bug that impacts usage of a feature label Jul 23, 2023
@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 23, 2023
@ZeWaka ZeWaka added C-Code-Quality Cleans up code, refactors things to be more readable or intuitive A-Materials Deals with our materials system in some way labels Jul 26, 2023
code/modules/materials/Mat_ProcsDefines.dm Outdated Show resolved Hide resolved
@M-Earthfire M-Earthfire requested a review from ZeWaka August 3, 2023 06:48
Copy link
Member

@ZeWaka ZeWaka left a comment

Choose a reason for hiding this comment

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

ideally this would be done using signals but this is fine for now i think

@ZeWaka ZeWaka merged commit 90d4f44 into goonstation:master Aug 5, 2023
21 checks passed
github-actions bot pushed a commit that referenced this pull request Aug 5, 2023
@M-Earthfire M-Earthfire deleted the matsci_tool_parts_matter branch August 5, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Materials Deals with our materials system in some way C-Bug A bug that impacts usage of a feature C-Code-Quality Cleans up code, refactors things to be more readable or intuitive size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flock walls don't reflect projectiles
2 participants