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

Better refactor #8

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft

Better refactor #8

wants to merge 43 commits into from

Conversation

brandonhoughton
Copy link
Member

No description provided.

@ccodel
Copy link

ccodel commented Mar 3, 2019

Documented changes in the betterRefactor branch:

Addition of "Sparse" argument on rewards. Allows rewards to be given as the action is partially completed, or all in one reward upon full completion.

Modification of some behavior in "CraftingHelper," specifically regarding auto-crafting and auto-smelting. Now, an ItemCraftedEvent or ItemSmeltedEvent is fired that corresponds to a crafting matrix with the ingredients to craft the requested output. To keep from overlapping inventory change events in other classes, the GainItemEvent and LoseItemEvent classes were modified to include a "cause" of what created them, with a default of 0, 1 for auto-craft, and 2 for auto-smelt.

Modification of "AgentQuitFromCollectingItemImplementation" to match the addition of "quantity" for an InventoryObject. Will now reward the player upon the collection of an item with a specified quantity and/or variant. If no variant is specified, any item within that class (e.g. any variant of plank for planks) will contribute to a counter. If no quantity is specified, a default of "1" is given. Note that if an agent drops or removes an item from its inventory, the CollectingItem counter doesn't reflect that, so an agent may drop and pick up items to artificially raise the counter.

Modification of "RewardFromCollectingItemImplementation" to match the addition of "quantity" for an InventoryObject. See the above notes on "AgentQuitFromCollectingItemImplementation" to get a sense to the changes here.

Addition of "AgentQuitFromPossessingItemImplementation" and "RewardForPossessingItemImplementation." Like the above "CollectingItem," except it reflects negative changes in the agent's inventory, e.g. a dropped item or crafting ingredients removed. Rewards given only when forward progress made in acquiring the requested item stack.

Addition of "NearbyCraftCommand" and "NearbyCraftCommands" to restrict when agents can craft. The class tracks where agents place crafting tables. When a "craftNearby" command is sent, the class checks if a crafting table is nearby. If one is, and it is within the agent's view, then will attempt to craft the given item with the items in the agent's inventory, similar to "SimpleCraftCommands." Does not smelt.

Addition of "NearbySmeltCommand" and "NearbySmeltCommands" to restrict when agents can smelt. Very similar to the above. The agent must have fuel in its inventory to smelt.

Addition of "PlaceCommand" and "PlaceCommands" which allows agents to place a block or item in their inventory into the world without having to swap it into their hotbar. The agent specifies which item it wishes to place, and if the agent has that item, the agent will then attempt to place it into the world.

Addition of "AgentQuitFromCraftingItemImplementation" and "RewardForCraftingItemImplementation" to reward agents for acquiring items specifically from crafting. See above notes for behavior, excepting that the counter cannot be decremented by losing items due to tossing or crafting.

Addition of "AgentQuitFromSmeltingItemImplementation" and "RewardForSmeltingItemImplementation" to reward agents for acquiring items specifically from smelting. See above notes for behavior, excepting that the counter cannot be decremented by losing items due to tossing or crafting.

Addition of an "inventory_handlers.xml" file in the sample_missions that showcases the new handlers. See comments in the .xml for how they are applied.

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.

2 participants