public GoToZoneAct(CreatureAI agent, Zone zone) : base(agent) { Tree = null; Name = "Goto zone : " + zone.ID; Destination = zone; }
public PlaceRoomResourcesAct(CreatureAI agent, BuildRoomOrder buildRoom, List<ResourceAmount> resources) : base(agent) { Name = "Place BuildRoom resources"; BuildRoom = buildRoom; Resources = resources; }
public StockResourceAct(CreatureAI agent, ResourceAmount item) : base(agent) { ItemToStock = item.CloneResource(); Name = "Stock Item"; Tree = null; }
public DigAct(CreatureAI creature, string targetVoxel) : base(creature) { TargetVoxelName = targetVoxel; Name = "Dig!"; EnergyLoss = 10.0f; }
public CraftItemAct(CreatureAI creature, Voxel voxel, string type) : base(creature) { ItemType = type; Voxel = voxel; Name = "Build craft item"; }
public SearchFreeStockpileAct(CreatureAI creature, string stockName, string voxName) : base(creature) { Name = "Search Stockpile " + stockName; StockpileName = stockName; VoxelName = voxName; }
public SetTargetVoxelFromEntityAct(CreatureAI creature, string entityName, string voxelOut) : base(creature) { Name = "Set Target Voxel"; VoxelOutName = voxelOut; EntityName = entityName; }
public GoToEntityAct(Body entity, CreatureAI creature) : base(creature) { Name = "Go to entity"; EntityName = "TargetEntity"; Entity = entity; }
public GatherManager(CreatureAI creature) { Creature = creature; ItemsToGather = new List<Body>(); StockOrders = new List<StockOrder>(); VoxelOrders = new List<BuildVoxelOrder>(); }
public GatherItemAct(CreatureAI agent, Body item) : base(agent) { ItemToGather = item; Name = "Gather Item"; Tree = null; }
public SearchFreeStockpileAct(CreatureAI creature, string stockName, string voxName, ResourceAmount itemToStock) : base(creature) { Name = "Search Stockpile " + stockName; StockpileName = stockName; VoxelName = voxName; Item = itemToStock; }
public PutResourceInZone(CreatureAI agent, string stockpileName, string voxelname, string resourceName) : base(agent) { VoxelName = voxelname; Name = "Put Item"; StockpileName = stockpileName; ResourceName = resourceName; }
public SleepAct(CreatureAI creature) : base(creature) { Name = "Sleep"; RechargeRate = 1.0f; Teleport = false; Type = SleepType.Sleep; }
public FindAndEatFoodAct(CreatureAI agent, bool MustPay) : base(agent) { Name = "Find and Eat Edible"; FoodTag = "PreparedFood"; FallbackTag = "Edible"; this.MustPay = MustPay; }
public IEnumerable <Act.Status> OnRechargeEnd(CreatureAI creature) { creature.Creature.OverrideCharacterMode = false; creature.Creature.CurrentCharacterMode = CharacterMode.Idle; creature.Creature.Physics.Orientation = Physics.OrientMode.RotateY; creature.Physics.Active = true; yield return(Act.Status.Success); }
public WanderAct(CreatureAI creature, float seconds, float turnTime, float radius) : base(creature) { Name = "Wander"; WanderTime = new Timer(seconds, false); TurnTime = new Timer(turnTime, false); Radius = radius; }
public PutMoneyInZoneAct(CreatureAI agent, string stockpileName, string voxelname, DwarfBux money) : base(agent) { Money = money; VoxelName = voxelname; Name = "Stash money in zone"; StockpileName = stockpileName; }
public GatherItemAct(CreatureAI agent, string item) : base(agent) { ItemID = item; Tree = null; ItemToGather = null; Name = "Gather Item"; }
public CraftResourceAct(CreatureAI creature, CraftItem CraftItem, List <ResourceApparentTypeAmount> RawMaterials, ResourceDes Des) : base(creature) { this.ItemType = CraftItem; this.RawMaterials = RawMaterials; this.Des = Des; Name = "Build craft item"; }
public StockResourceAct(CreatureAI agent, string item) : base(agent) { ItemID = item; Tree = null; ItemToStock = null; Name = "Stock Item"; }
public GoToVoxelAct(VoxelHandle voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 3.0f) : base(creature) { Radius = radius; Voxel = voxel; Name = "Go to DestinationVoxel"; PlanType = planType; }
public GoToZoneAct(CreatureAI agent, string zone) : base(agent) { Tree = null; Name = "Goto zone : " + zone; Destination = null; DestinationName = zone; }
public DigAct(CreatureAI creature, KillVoxelTask OwnerTask) : base(creature) { Name = "Dig!"; EnergyLoss = 10.0f; this.OwnerTask = OwnerTask; }
public GoToVoxelAct(Voxel voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 0.0f) : base(creature) { Radius = radius; Voxel = voxel; Name = "Go to Voxel"; PlanType = planType; }
public GoToNamedVoxelAct(string voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 3.0f) : base(creature) { Radius = radius; PlanType = planType; VoxelName = voxel; Name = "Go to DestinationVoxel " + voxel; }
public GoToEntityAct(Body entity, CreatureAI creature) : base(creature) { Name = "Go to entity"; EntityName = "TargetEntity"; Entity = entity; MovingTarget = true; }
public GetNearestFreeVoxelInZone(CreatureAI agent, Zone targetZone, string outputVoxel, bool reserve) : base(agent) { Name = "Get Free Voxel"; OutputVoxel = outputVoxel; TargetZone = targetZone; ReserveVoxel = reserve; }
public CreateCraftItemAct(VoxelHandle voxel, CreatureAI agent, CraftDesignation itemType) : base(agent) { Agent = agent; Voxel = voxel; Name = "Create craft item"; Item = itemType; }
public PlaceVoxelAct(Voxel voxel, CreatureAI agent, ResourceAmount resource) : base(agent) { Agent = agent; Voxel = voxel; Name = "Build Voxel " + voxel.ToString(); Resource = resource; }
public CreateCraftItemAct(Voxel voxel, CreatureAI agent, string itemType) : base(agent) { Agent = agent; Voxel = voxel; Name = "Create craft item"; ItemType = itemType; }
public StashAct(CreatureAI agent, PickUpType type, Zone zone, string targetName, string stashedItemOut) : base(agent) { Name = "Stash " + targetName; PickType = type; Zone = zone; TargetName = targetName; StashedItemOut = stashedItemOut; }
protected virtual void OnFire(CreatureAI creature) { MinionFired handler = Fire; if (handler != null) { handler(creature); } }
public void AddFailureReason(CreatureAI Agent, String Reason) { FailureReasons.RemoveAll(r => r.StartsWith(Agent.Stats.FullName)); FailureReasons.Add(String.Format("{0}: {1}", Agent.Stats.FullName, Reason)); if (FailureReasons.Count > ReasonsToKeep) { FailureReasons.RemoveAt(0); } }
public GetResourcesAct(CreatureAI agent, Resource.ResourceTags resources) : base(agent) { Name = "Get Resources"; Resources = new List <Quantitiy <Resource.ResourceTags> >() { new Quantitiy <Resource.ResourceTags>(resources) }; }
public bool Verify(CreatureAI creature) { if (creature.Blackboard.GetData <bool>("NoPath", false)) { return(false); } return(Entity != null && !Entity.IsDead); }
public bool Validate(CreatureAI creature, VoxelHandle voxel, ResourceTypeAmount Resource) { if (creature.Blackboard.GetData <bool>("NoPath", false)) { return(false); } return(creature.Creature.Inventory.HasResource(Resource)); }
public KillEntityAct(Body entity, CreatureAI creature, KillEntityTask.KillType mode) : base(creature) { Mode = mode; Entity = entity; Name = "Kill Entity"; Tree = new ForLoop(new Parallel(new Sequence(new GoToEntityAct(entity, creature), new MeleeAct(Agent, entity)), new Wrap(Verify)), 5, true); }
public GetResourcesWithTag(CreatureAI agent, String Tag) : base(agent) { Name = "Get Resources"; Resources = new List <ResourceTagAmount>() { new ResourceTagAmount(Tag, 1) }; }
public bool CheckIsDigDesignation(CreatureAI creature, KillVoxelTask OwnerTask) { if (OwnerTask.Voxel.IsValid) { return(creature.World.PersistentData.Designations.IsVoxelDesignation(OwnerTask.Voxel, DesignationType.Dig)); } return(false); }
public void Sense() { if (Allies == null && Creature != null) { Allies = Creature.Faction; } List <CreatureAI> sensed = new List <CreatureAI>(); VoxelHandle currentVoxel = new VoxelHandle(World.ChunkManager.ChunkData, GlobalVoxelCoordinate.FromVector3(Position)); if (!(currentVoxel.IsValid && currentVoxel.IsEmpty)) { return; } foreach (var thing in Manager.World.CollisionManager.EnumerateIntersectingObjects(BoundingBox, CollisionManager.CollisionType.Both)) { Body body = thing as Body; if (body == null) { continue; } CreatureAI minion = body.GetRoot().GetComponent <CreatureAI>(); if (minion == null) { continue; } Faction faction = minion.Faction; if (World.Diplomacy.GetPolitics(Allies, faction).GetCurrentRelationship() != Relationship.Hateful) { continue; } if (!minion.Active) { continue; } float dist = (minion.Position - GlobalTransform.Translation).LengthSquared(); if (dist < SenseRadius && !VoxelHelpers.DoesRayHitSolidVoxel( Manager.World.ChunkManager.ChunkData, Position, minion.Position)) { sensed.Add(minion); } } if (sensed.Count > 0) { OnEnemySensed.Invoke(sensed); } }
public BuildVoxelsAct(CreatureAI creature, List<Voxel> voxels, List<VoxelType> types) : base(creature) { Voxels = new List<KeyValuePair<Voxel, VoxelType>>(); for (int i = 0; i < voxels.Count; i++) { Voxels.Add(new KeyValuePair<Voxel, VoxelType>(voxels[i], types[i])); } Name = "Build voxels"; }
public FollowPathAct(CreatureAI agent, string pathName) : base(agent) { Name = "Follow path"; PathName = pathName; ValidPathTimer = new Timer(.75f, false); RandomTimeOffset = MathFunctions.Rand(0.0f, 0.1f); BlendStart = true; BlendEnd = true; }
public BuildVoxelsAct(CreatureAI creature, List <Voxel> voxels, List <VoxelType> types) : base(creature) { Voxels = new List <KeyValuePair <Voxel, VoxelType> >(); for (int i = 0; i < voxels.Count; i++) { Voxels.Add(new KeyValuePair <Voxel, VoxelType>(voxels[i], types[i])); } Name = "Build voxels"; }
public FlyWanderAct(CreatureAI creature, float seconds, float turnTime, float radius, float altitude) : base(creature) { Altitude = altitude; Name = "FlyWander " + seconds; WanderTime = new Timer(seconds, false); TurnTime = new Timer(turnTime, false); Radius = radius; YRadius = 2.0f; GravityCompensation = 0.1f; Damping = 0.25f; TurnThreshold = 2.0f; }
public GoToVoxelAct(string voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 0.0f) : base(creature) { Name = "Go to Voxel " + voxel; Tree = new Sequence( new ForLoop( new Sequence( new PlanAct(Agent, "PathToVoxel", voxel, planType) { Radius = radius}, new FollowPathAnimationAct(Agent, "PathToVoxel") ) , 3, true), new StopAct(Agent)); }
public GoToVoxelAct(Voxel voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 0.0f) : base(creature) { Voxel = voxel; Name = "Go to Voxel"; if(Voxel != null) { Tree = new Sequence( new SetBlackboardData<Voxel>(Agent, "TargetVoxel", Voxel), new PlanAct(Agent, "PathToVoxel", "TargetVoxel", planType) { Radius = radius}, new FollowPathAnimationAct(Agent, "PathToVoxel"), new StopAct(Agent)); } }
public GuardVoxelAct(CreatureAI agent, Voxel voxel) : base(agent) { Voxel = voxel; Name = "Guard Voxel " + voxel; Tree = new Sequence ( new GoToVoxelAct(voxel, PlanAct.PlanType.Adjacent, agent), new StopAct(Agent), new WhileLoop(new WanderAct(Agent, 1.0f, 0.5f, 0.1f), new Condition(LoopCondition)), new Condition(ExitCondition) ); }
public PlanAct(CreatureAI agent, string pathOut, string target, PlanType planType) : base(agent) { Type = planType; Name = "Plan to " + target; PlannerTimer = new Timer(1.0f, false); MaxExpansions = 1000; PathOut = pathOut; TargetName = target; PlanSubscriber = new PlanSubscriber(PlayState.PlanService); WaitingOnResponse = false; MaxTimeouts = 4; Timeouts = 0; Radius = 0; }
public KillVoxelAct(Voxel voxel, CreatureAI creature) : base(creature) { Voxel = voxel; Name = "Kill Voxel " + voxel.Position; Tree = new Sequence( new SetBlackboardData<Voxel>(creature, "DigVoxel", voxel), new Sequence( new Wrap(() => IncrementAssignment(creature, "DigVoxel", 1)), new GoToVoxelAct(voxel, PlanAct.PlanType.Adjacent, creature), new Wrap(() => CheckIsDigDesignation(creature, "DigVoxel")), new DigAct(Agent, "DigVoxel"), new ClearBlackboardData(creature, "DigVoxel") ) | new Wrap(() => IncrementAssignment(creature, "DigVoxel", -1)) & false); }
public BuildRoomAct(CreatureAI agent, BuildRoomOrder buildRoom) : base(agent) { Name = "Build BuildRoom " + buildRoom.ToString(); Resources = buildRoom.ListRequiredResources(); Tree = new Sequence(new GetResourcesAct(Agent, Resources), new Sequence( new Wrap(() => IsRoomBuildOrder(buildRoom)), SetTargetVoxelFromRoomAct(buildRoom, "TargetVoxel"), new Wrap(() => IsRoomBuildOrder(buildRoom)), new GoToVoxelAct("TargetVoxel", PlanAct.PlanType.Adjacent, Agent), new Wrap(() => IsRoomBuildOrder(buildRoom)), new Wrap(() => Creature.HitAndWait(buildRoom.VoxelOrders.Count * 0.5f / agent.Stats.BuildSpeed, true)), new Wrap(() => IsRoomBuildOrder(buildRoom)), new PlaceRoomResourcesAct(Agent, buildRoom, Resources) , new Wrap(Creature.RestockAll)) | new Wrap(Creature.RestockAll) ); }
public FarmAct(CreatureAI agent) : base(agent) { Name = "Work a farm"; }
public void Initialize() { Physics.Orientation = Physics.OrientMode.RotateY; Sprite = new CharacterSprite(Graphics, Manager, "Elf Sprite", Physics, Matrix.CreateTranslation(new Vector3(0, 0.35f, 0))); foreach (Animation animation in Stats.CurrentClass.Animations) { Sprite.AddAnimation(animation.Clone()); } Hands = new Grabber("hands", Physics, Matrix.Identity, new Vector3(0.1f, 0.1f, 0.1f), Vector3.Zero); Sensors = new EnemySensor(Manager, "EnemySensor", Physics, Matrix.Identity, new Vector3(20, 5, 20), Vector3.Zero); AI = new CreatureAI(this, "Elf AI", Sensors, PlanService); Attacks = new List<Attack>() { new Attack(Stats.CurrentClass.Attacks[0]) }; Inventory = new Inventory("Inventory", Physics) { Resources = new ResourceContainer { MaxResources = 16 } }; Matrix shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f); shadowTransform.Translation = new Vector3(0.0f, -0.5f, 0.0f); SpriteSheet shadowTexture = new SpriteSheet(ContentPaths.Effects.shadowcircle); Shadow = new Shadow(Manager, "Shadow", Physics, shadowTransform, shadowTexture); List<Point> shP = new List<Point> { new Point(0, 0) }; Animation shadowAnimation = new Animation(Graphics, new SpriteSheet(ContentPaths.Effects.shadowcircle), "sh", 32, 32, shP, false, Color.Black, 1, 0.7f, 0.7f, false); Shadow.AddAnimation(shadowAnimation); shadowAnimation.Play(); Shadow.SetCurrentAnimation("sh"); Physics.Tags.Add("Goblin"); DeathParticleTrigger = new ParticleTrigger("blood_particle", Manager, "Death Gibs", Physics, Matrix.Identity, Vector3.One, Vector3.Zero) { TriggerOnDeath = true, TriggerAmount = 5, SoundToPlay = ContentPaths.Entities.Goblin.Audio.goblinhurt1 }; Flames = new Flammable(Manager, "Flames", Physics, this); NoiseMaker.Noises["Hurt"] = new List<string> { ContentPaths.Entities.Goblin.Audio.goblinhurt1, ContentPaths.Entities.Goblin.Audio.goblinhurt2, ContentPaths.Entities.Goblin.Audio.goblinhurt3, ContentPaths.Entities.Goblin.Audio.goblinhurt4, }; MinimapIcon minimapIcon = new MinimapIcon(Physics, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 3, 0)); NoiseMaker.Noises["Chew"] = new List<string> { ContentPaths.Audio.chew }; NoiseMaker.Noises["Jump"] = new List<string> { ContentPaths.Audio.jump }; Stats.FullName = TextGenerator.GenerateRandom("$elfname"); //Stats.LastName = TextGenerator.GenerateRandom("$elffamily"); Stats.Size = 4; }
public ClearBlackboardData(CreatureAI creature, string data) : base(creature) { Name = "Clear " + data; DataKey = data; }
public CreatureAct(CreatureAI agent) { Agent = agent; Name = "Creature Act"; }