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

Barrel/well interaction rework. #4660

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

MistakeNot4892
Copy link
Contributor

@MistakeNot4892 MistakeNot4892 commented Dec 20, 2024

Description of changes

Really not sure about the implementation of this one. Going to pull it into Pyrelight volatile for testing over the weekend.

  • Adds get_standard_interactions() and calls it similarly to alt interactions at the root of attackby() and attack_hand().
  • Moves dipping, filling and emptying into interaction handlers provided as needed by the alt interaction proc.
  • Barrels and wells also provide these interaction handlers to their standard interaction procs. Basically: you can pick what interaction you want if you have a bucket to fill or empty, or a wrench to unanchor with or put into storage.
  • Generalized several structure procs to allow for tool interactions in a similar vein.
  • Let barrels be anchored/unanchored.

Why and what will this PR improve

We are at a point where the UX for some structures is getting stupid. Barrels and wells are the most obvious/severe example: if you have a half full bucket, and a half full well, and you click the bucket on the well, the interaction has to be mediated by flag checks and a toggle on the well atom, or workarounds like drag-drop.

This puts support in place for similar interactions in the future, and solves the immediate barrel/well issues.

Authorship

Myself.

Changelog

🆑
tweak: The way you interact with barrels and well has been significantly reworked; clicking with a bucket or tool should give a list of options to pick from. Please report bugs with this on the tracker.
/:cl:

@MistakeNot4892 MistakeNot4892 added the work in progress This PR is under development and shouldn't be merged. label Dec 20, 2024
@MistakeNot4892
Copy link
Contributor Author

Something has broken in the fill/pour interactions and now they aren't showing up on barrels. Augh. Issue for tomorrow.

@MistakeNot4892 MistakeNot4892 added ready for review This PR is ready for review and merge. and removed work in progress This PR is under development and shouldn't be merged. labels Dec 21, 2024
@MistakeNot4892 MistakeNot4892 deleted the rework/barrels branch December 27, 2024 23:07
@MistakeNot4892 MistakeNot4892 restored the rework/barrels branch December 27, 2024 23:08
@MistakeNot4892 MistakeNot4892 added the do not merge This PR is on hold, do not merge it. label Dec 28, 2024
@MistakeNot4892
Copy link
Contributor Author

DNM, need to check if this has clobbered hammer deconstruction.

@MistakeNot4892 MistakeNot4892 removed the do not merge This PR is on hold, do not merge it. label Jan 1, 2025
@MistakeNot4892
Copy link
Contributor Author

Ready to go.

Comment on lines 23 to 29
// This is not ideal but I don't want to pass a callback through here as a param and call it. :(
if(check_alt_interactions)
if(!(choice.type in get_alt_interactions(user)))
return TRUE
else
if(!(choice.type in get_standard_interactions(user)))
return TRUE
Copy link
Member

Choose a reason for hiding this comment

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

maybe var/list/new_interactions = check_alt_interactions ? get_alt_interactions(user) : get_standard_interactions(user)? that way you would only need one !(choice.type in new_interactions) check. it wouldn't fix the coupling issue (it's a niche control flag) but it'd make the code marginally nicer

Suggested change
// This is not ideal but I don't want to pass a callback through here as a param and call it. :(
if(check_alt_interactions)
if(!(choice.type in get_alt_interactions(user)))
return TRUE
else
if(!(choice.type in get_standard_interactions(user)))
return TRUE
// This is not ideal but I don't want to pass a callback through here as a param and call it. :(
var/list/new_interactions = check_alt_interactions ? get_alt_interactions(user) : get_standard_interactions(user)
if(!(choice.type in new_interactions))
return TRUE

that said, it should probably use a callback, because someone might accidentally call it with standard interactions but use the alt interactions flag (or the opposite). but. meh. i might do it at some point

Copy link
Member

Choose a reason for hiding this comment

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

this was not meant to be blocking, i was gonna approve until i noticed the soil plot thing

@@ -19,11 +19,6 @@

var/obj/item/stack/material/brick/reinforced_with

/obj/machinery/portable_atmospherics/hydroponics/soil/get_alt_interactions(var/mob/user)
. = ..()
. -= /decl/interaction_handler/drink
Copy link
Member

Choose a reason for hiding this comment

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

was this moved? if so i can't find it, but you definitely shouldn't be able to wash your hands in or drink from a plot of soil. it's not got standing water, it's absorbed into the soil

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 think I removed it thinking it was an addition. Will revert.

Copy link
Member

Choose a reason for hiding this comment

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

still has wash hands. for that matter uhhh, i think all the reagent interactions except /decl/interaction_handler/empty_into should be removed on this. that or can_be_poured_from should return FALSE on soil trays, which should lead to uh. dip into and fill from being disabled. maybe wash hands should also check that and then we could pretty tidily solve it without needing a get_alt_interactions override at all?

@@ -19,11 +19,6 @@

var/obj/item/stack/material/brick/reinforced_with

/obj/machinery/portable_atmospherics/hydroponics/soil/get_alt_interactions(var/mob/user)
. = ..()
. -= /decl/interaction_handler/drink
Copy link
Member

Choose a reason for hiding this comment

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

still has wash hands. for that matter uhhh, i think all the reagent interactions except /decl/interaction_handler/empty_into should be removed on this. that or can_be_poured_from should return FALSE on soil trays, which should lead to uh. dip into and fill from being disabled. maybe wash hands should also check that and then we could pretty tidily solve it without needing a get_alt_interactions override at all?

Copy link
Member

@out-of-phaze out-of-phaze left a comment

Choose a reason for hiding this comment

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

works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for review and merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants