Add dynamic item support
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import ItemBuilder from "../../engine/builders/item";
|
||||
import Item from "../../engine/item";
|
||||
|
||||
export default new ItemBuilder()
|
||||
.withID("cup")
|
||||
.withName("a cup")
|
||||
.withDescription("A standard coffee cup")
|
||||
.isTakeable(true)
|
||||
.isUsable(false)
|
||||
import ItemBuilder from "../../engine/builders/item";
|
||||
import Item from "../../engine/item";
|
||||
|
||||
export default new ItemBuilder()
|
||||
.withID("cup")
|
||||
.withName("a cup")
|
||||
.withDescription("A standard coffee cup")
|
||||
.isTakeable(true)
|
||||
.isUsable(true)
|
||||
.withUseCallback((context) => {
|
||||
const item = context.getItem("cup");
|
||||
const cloned = item.clone();
|
||||
cloned.name = 'A cloned cup';
|
||||
console.log(cloned);
|
||||
context.player.addItem(cloned.dynamicID);
|
||||
context.print("You touch the cup and a new one somehow appears in your inventory.");
|
||||
})
|
||||
.create();
|
||||
Reference in New Issue
Block a user