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

[Fixed] Catapult flying away if shooting from a Mounted Bow which is in a Catapult's Mag #1311

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Jul 8, 2022

Status

  • READY: this PR is (to the best of your knowledge) ready to be incorporated into the game.

Description

Fixes #1247.

I decided to make this a separate PR and not to include this in #1251.

When a Mounted Bow is in a Catapult's mag and you are firing from that Mounted Bow, the catapult would fly away.
This change fixes that so when shooting from the Mounted Bow, it will shoot arrows and not detach.
The Mounted Bow can be shot forward normally if firing from the catapult's gunner position.

Apparently, the code assumes a Mounted Bow on its own does not have a "MAG" attachment point.
However, when it is attached to the Catapult, it will return a "MAG" attachment point - the one by the catapult.
By changing this.getAttachments().getAttachmentPointByName("MAG");
to this.getAttachments().getAttachmentPoint("MAG", true);, it will only return the "MAG" attachment point if the blob is the socket - The Mounted Bow will therefore never somehow fetch a wrong mag attachment point now and the bug won't happen.

As a bonus, another bug has been fixed by this:
Mounted Bow won't show a wrong "load item" button after it was previously in a Catapult's mag.
It will now still only show a load button if you have arrows in your inventory or hand.

Steps to Test or Reproduce

Place changed file in a mod folder.
Start your dev install with the mod.
Go to Save the Princess.
!tradingpost
!999 coins
Buy a Mounted Bow
!catapult
Place the Mounted Bow in the Catapult's mag
Attach to the Mounted Bow and fire.
Notice the catapult will fly away. After this change, it will shoot arrows and not detach from the catapult.

@asumagic asumagic merged commit 3bcdf8f into transhumandesign:master Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mounted Bow on Catapult bug
3 participants