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

Various link up fixes #67376

Merged
merged 14 commits into from
Aug 2, 2023
Merged

Various link up fixes #67376

merged 14 commits into from
Aug 2, 2023

Conversation

Kamayana
Copy link
Contributor

@Kamayana Kamayana commented Aug 2, 2023

Summary

Bugfixes "Remove error when remote_use item is deleted during its use function"

Purpose of change

There were some leftover issues from #66871.

  1. Tow-cable description said it was longer than it actually is.
  2. Extension cord descriptions didn't mention they can extend other cables now.
  3. Appliances were unable to manually connect by using the menu and...
  4. ...devices couldn't draw power anymore. (Fixes Cable Rework connection issues and tool charging #67364)
  5. Appliances could be connected more than once.
  6. Appliance connections had more slack than they should, letting them get up to 3 tiles apart.
  7. Some documentation needed minor updates.
  8. vehicle::connect wasn't updated to match the code it's copying from.
  9. Devices with ALLOWS_REMOTE_USE could be linked up remotely, which things weren't set up to handle.
  10. avatar_action::use_item assumes devices with ALLOWS_REMOTE_USE won't be deleted during the use action, but that can potentially happen during link_up, and the game throws an error if it does.
  11. Multicookers counted anything in the CABLE pocket as an obstruction, including the oxygen created from generic_device_cable migration. (Fixes Can't use multi-cooker that's plugged into the grid #67348)

Describe the solution

  1. Fixed.
  2. Added.
  3. getabs() was getting called twice on the attachment point, so it was way off.
  4. Fixed a misused variable that was setting every cable's efficiency to 0, and added charge_rate/charge_interval calculation, something I'd mistakenly never gotten around to re-adding when I moved everything to set_link_traits().
  5. Fix a reference to the wrong vehicle.
  6. Set the max length to 2 instead of 3.
  7. Updated.
  8. Updated.
  9. link_up_actor now uses the pnt variable that's fed to iuse functions to properly build the item_locations, and it now works for items outside of an inventory.
  10. Adds a validity check after the item is used in avatar_action::use_item before calling update_lum and make_active, so it doesn't just assume the item will still exist.
  11. Make get_item_with() skip over CABLE pockets. This doesn't screw up anything else, it's not a very widely used function. I also had to edit a couple uses of ammo_remaining() in iuse so they accept linked power. I also did this to the tazer iuse, even though it doesn't have a link_up action right now, because it probably will eventually.

As an extra, I gave the multicooker ALLOWS_REMOTE_USE since I was was working with both, and it seemed weird that you had to pick up multicookers to use them.

Describe alternatives you've considered

The change to avatar_action::use_item is the only change I would say is more than minor, and thus the only thing I mention in the summary. I wanted to avoid doing any big-ish changes like that, but I don't think there's any other way that isn't extremely complicated. It feels like it's probably for the best that ALLOWS_REMOTE_USE items aren't assumed to always stay intact after use anyway, so I went with it.

Testing

5, 6, 9 and 10 were actually added to the list in the first place while testing 3 and 4. After fixing those new issues, went through the list and it all looked good. Followed the steps in #67364 and the errors are gone. Extended the arc welder and it falls out of the camera bag with no errors. Plugged in and extended the arc welder on the ground, works fine. While plugged in its batteries charge and it works as a valid crafting tool, and appropriately draws required power from the battery.

Additional context

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs Appliance/Power Grid Anything to do with appliances and power grid <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Aug 2, 2023
@Kamayana Kamayana marked this pull request as draft August 2, 2023 12:53
@github-actions github-actions bot added the Items: Containers Things that hold other things label Aug 2, 2023
@Kamayana Kamayana marked this pull request as ready for review August 2, 2023 13:57
@Maleclypse Maleclypse merged commit bdfc14e into CleverRaven:master Aug 2, 2023
@Kamayana Kamayana deleted the link_up_fixes branch January 9, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Appliance/Power Grid Anything to do with appliances and power grid astyled astyled PR, label is assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. Items: Containers Things that hold other things [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cable Rework connection issues and tool charging Can't use multi-cooker that's plugged into the grid
2 participants