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

Fix vendor machines and add multiple options and stock #1439

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

David-Goru
Copy link
Contributor

Summary

Vendor machine code has been updated to work with more than one product and to have stock. The current four vendor machines (VendorHotDrinks, VendorYouTool, VendorSecTech, VendorRobustDrinks) have at least one product to be dispensed with an initial stock. Both products and stocks are placeholders, so they have functionality for now and can be tested.

They also now run a sound when dispensing, and an error sound when there are is no stock of the product selected. Both sound effects are placeholders.

PR checklist

  • The game builds properly without errors.
  • No unrelated changes are present.
  • No "trash" files are committed.
  • Relevant code is documented.
  • Update the related GitBook document, or create a new one if needed.

Pictures/Videos

Vendor.machines.mp4

imagen

Testing

Place a vendor and right-click on it to show the interaction menu, left click different items to dispense. All four vendors should have something to dispense and work correctly. When the stock of one product reaches 0 it should no longer dispense anything.

Networking checklist

  • Works from host in host mode.
  • Works from server in server mode.
  • Works on server in client mode.
  • Works and is syncronized across different clients.
  • Is persistent.

Changes

VendingMachine.cs has been updated to accept several products.
DispenseProductInteraction.cs has been updated so it works for a specific product, including the index of the product in the VendingMachine and the name/stock of the product to display in the interaction.
VendingMachineProductStock.cs has been created to deal with different products and their stock. Is not an struct, so we can update it easily.
Products are now referenced using the ItemObjectSo instead of the GameObject prefab directly. I'm not 100% sure if that's the correct approach, let me know if we should use something different.

Related issues/PRs

Closes #1437

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.

Fix vendor machines
1 participant