Item give command, define panzerium as item

This commit is contained in:
crumblingstatue 2023-04-16 01:16:14 +02:00
parent 4dfb0ff7d7
commit 5f7924b696
5 changed files with 30 additions and 2 deletions

View file

@ -18,7 +18,7 @@ use crate::{
game::{for_each_tile_on_screen, Biome, GameState},
graphics::{self, ScreenSc, ScreenVec},
input::Input,
inventory::{TileLayer, UseAction},
inventory::{ItemId, Slot, TileLayer, UseAction},
math::{center_offset, TILE_SIZE},
res::Res,
CliArgs,
@ -404,6 +404,16 @@ impl App {
Cmd::TeleportPlayerSpawn => {
self.game.world.player.col_en.en.pos = self.game.spawn_point.to_s2dc()
}
Cmd::GiveItemByName(name) => {
for (i, item) in self.game.itemdb.db.iter().enumerate() {
if item.name == name {
self.game.inventory.slots.push(Slot {
id: i as ItemId,
qty: 1,
})
}
}
}
}
}
}