mirror of
https://github.com/chase-manning/pokemon-js.git
synced 2025-07-29 07:09:13 +00:00
🐛 items not going into inventory
This commit is contained in:
parent
bf86dc93f8
commit
be0e7d3018
2 changed files with 5 additions and 2 deletions
src
|
@ -8,6 +8,7 @@ import useEvent from "../app/use-event";
|
|||
import { Event } from "../app/emitter";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
addInventory,
|
||||
collectItem,
|
||||
selectCollectedItems,
|
||||
selectDirection,
|
||||
|
@ -66,7 +67,10 @@ const Item = ({ item }: Props) => {
|
|||
dispatch(
|
||||
showTextThenAction({
|
||||
text: [`${name} found ${itemData[item.item].name}!`],
|
||||
action: () => dispatch(collectItem(item)),
|
||||
action: () => {
|
||||
dispatch(collectItem(item));
|
||||
dispatch(addInventory({ item: item.item, amount: 1 }));
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -334,7 +334,6 @@ export const gameSlice = createSlice({
|
|||
collectItem: (state, action: PayloadAction<MapItemType>) => {
|
||||
const id = `${state.map}-${action.payload.pos.x}-${action.payload.pos.y}`;
|
||||
state.collectedItems.push(id);
|
||||
addInventory({ item: action.payload.item, amount: 1 });
|
||||
},
|
||||
completeQuest: (state, action: PayloadAction<string>) => {
|
||||
state.completedQuests.push(action.payload);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue