the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 50 lines 1.1 kB view raw
1#pragma once 2 3#include "TargetGoal.h" 4#include "EntitySelector.h" 5 6class NearestAttackableTargetGoal; 7 8// Anonymous class from NearestAttackableTargetGoal 9class SubselectEntitySelector : public EntitySelector 10{ 11private: 12 EntitySelector *m_subselector; 13 NearestAttackableTargetGoal *m_parent; 14 15public: 16 SubselectEntitySelector(NearestAttackableTargetGoal *parent, EntitySelector *subselector); 17 ~SubselectEntitySelector(); 18 bool matches(shared_ptr<Entity> entity) const; 19}; 20 21class NearestAttackableTargetGoal : public TargetGoal 22{ 23 friend class SubselectEntitySelector; 24public: 25 class DistComp 26 { 27 private: 28 Entity *source; 29 30 public: 31 DistComp(Entity *source); 32 33 bool operator() (shared_ptr<Entity> e1, shared_ptr<Entity> e2); 34 }; 35 36private: 37 const type_info& targetType; 38 int randomInterval; 39 DistComp *distComp; 40 EntitySelector *selector; 41 weak_ptr<LivingEntity> target; 42 43public: 44 NearestAttackableTargetGoal(PathfinderMob *mob, const type_info& targetType, int randomInterval, bool mustSee, bool mustReach = false, EntitySelector *entitySelector = NULL); 45 46 virtual ~NearestAttackableTargetGoal(); 47 48 virtual bool canUse(); 49 void start(); 50};