@ -302,21 +302,7 @@ void System::collision(GameLevel &level) {
world . send < Events : : GUI > ( Events : : GUI : : COMBAT_START , entity , entity ) ;
world . send < Events : : GUI > ( Events : : GUI : : COMBAT_START , entity , entity ) ;
}
}
} else if ( world . has < InventoryItem > ( entity ) ) {
} else if ( world . has < InventoryItem > ( entity ) ) {
auto item = world . get < InventoryItem > ( entity ) ;
dbc : : log ( " Hit an inventory item, use Sysem::pickup? " ) ;
auto & item_pos = world . get < Position > ( entity ) ;
if ( world . has < ritual : : JunkPile > ( entity ) ) {
auto & pile = world . get < ritual : : JunkPile > ( entity ) ;
auto & blanket = world . get_the < ritual : : Blanket > ( ) ;
for ( auto & junk : pile . contents ) {
blanket . add ( junk ) ;
}
}
collider . remove ( item_pos . location ) ;
world . remove < Tile > ( entity ) ;
world . send < Events : : GUI > ( Events : : GUI : : LOOT , entity , item ) ;
} else if ( world . has < Device > ( entity ) ) {
} else if ( world . has < Device > ( entity ) ) {
System : : device ( world , player . entity , entity ) ;
System : : device ( world , player . entity , entity ) ;
} else {
} else {
@ -330,6 +316,28 @@ void System::collision(GameLevel &level) {
}
}
}
}
void System : : pickup ( GameLevel & level , DinkyECS : : Entity entity ) {
auto & world = * level . world ;
if ( world . has < InventoryItem > ( entity ) ) {
auto item = world . get < InventoryItem > ( entity ) ;
auto & item_pos = world . get < Position > ( entity ) ;
if ( world . has < ritual : : JunkPile > ( entity ) ) {
auto & pile = world . get < ritual : : JunkPile > ( entity ) ;
auto & blanket = world . get_the < ritual : : Blanket > ( ) ;
for ( auto & junk : pile . contents ) {
blanket . add ( junk ) ;
}
}
level . collision - > remove ( item_pos . location ) ;
world . remove < Tile > ( entity ) ;
world . send < Events : : GUI > ( Events : : GUI : : LOOT , entity , item ) ;
}
}
void System : : device ( DinkyECS : : World & world , DinkyECS : : Entity actor , DinkyECS : : Entity item ) {
void System : : device ( DinkyECS : : World & world , DinkyECS : : Entity actor , DinkyECS : : Entity item ) {
auto & device = world . get < Device > ( item ) ;
auto & device = world . get < Device > ( item ) ;