the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 42 lines 1.2 kB view raw
1#include "stdafx.h" 2#include "Container.h" 3#include "EntitySelector.h" 4 5const EntitySelector *EntitySelector::ENTITY_STILL_ALIVE = new AliveEntitySelector(); 6const EntitySelector *EntitySelector::CONTAINER_ENTITY_SELECTOR = new ContainerEntitySelector(); 7 8bool AliveEntitySelector::matches(shared_ptr<Entity> entity) const 9{ 10 return entity->isAlive(); 11} 12 13bool ContainerEntitySelector::matches(shared_ptr<Entity> entity) const 14{ 15 return (dynamic_pointer_cast<Container>(entity) != NULL) && entity->isAlive(); 16} 17 18MobCanWearArmourEntitySelector::MobCanWearArmourEntitySelector(shared_ptr<ItemInstance> item) 19{ 20 this->item = item; 21} 22 23bool MobCanWearArmourEntitySelector::matches(shared_ptr<Entity> entity) const 24{ 25 if ( !entity->isAlive() ) return false; 26 if ( !entity->instanceof(eTYPE_LIVINGENTITY) ) return false; 27 28 shared_ptr<LivingEntity> mob = dynamic_pointer_cast<LivingEntity>(entity); 29 30 if (mob->getCarried(Mob::getEquipmentSlotForItem(item)) != NULL) return false; 31 32 if ( mob->instanceof(eTYPE_MOB) ) 33 { 34 return dynamic_pointer_cast<Mob>(mob)->canPickUpLoot(); 35 } 36 else if (mob->instanceof(eTYPE_PLAYER)) 37 { 38 return true; 39 } 40 41 return false; 42}