the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 50 lines 952 B view raw
1#pragma once 2 3#include "Goal.h" 4 5class PathfinderMob; 6 7class TargetGoal : public Goal 8{ 9 10public: 11 static const int TargetFlag = 1; 12 13private: 14 static const int EmptyReachCache = 0; 15 static const int CanReachCache = 1; 16 static const int CantReachCache = 2; 17 static const int UnseenMemoryTicks = 60; 18 19protected: 20 PathfinderMob *mob; // Owner of this goal 21 bool mustSee; 22 23private: 24 bool mustReach; 25 int reachCache; 26 int reachCacheTime; 27 int unseenTicks; 28 29 void _init(PathfinderMob *mob, bool mustSee, bool mustReach); 30 31public: 32 TargetGoal(PathfinderMob *mob, bool mustSee); 33 TargetGoal(PathfinderMob *mob, bool mustSee, bool mustReach); 34 virtual ~TargetGoal() {} 35 36 virtual bool canContinueToUse(); 37 38protected: 39 virtual double getFollowDistance(); 40 41public: 42 virtual void start(); 43 virtual void stop(); 44 45protected: 46 virtual bool canAttack(shared_ptr<LivingEntity> target, bool allowInvulnerable); 47 48private: 49 bool canReach(shared_ptr<LivingEntity> target); 50};