Esempio n. 1
0
 public CraftedBody(
     ComponentManager Manager,
     string name,
     Matrix localTransform,
     Vector3 bboxExtents,
     Vector3 bboxPos,
     CraftDetails details) :
     base(Manager, name, localTransform, bboxExtents, bboxPos)
 {
     this.SetFlag(Flag.ShouldSerialize, true);
     AddChild(details);
 }
Esempio n. 2
0
        public CraftedBody(
            ComponentManager Manager,
            string name,
            Matrix localTransform,
            Vector3 bboxExtents,
            Vector3 bboxPos,
            CraftDetails details) :
            base(Manager, name, localTransform, bboxExtents, bboxPos)
        {
            this.SetFlag(Flag.ShouldSerialize, true);
            AddChild(details);

            LocalPosition += VertexNoise.GetNoiseVectorFromRepeatingTexture(LocalPosition);
        }
Esempio n. 3
0
        public override IEnumerable <Status> Run()
        {
            if (!Creature.Faction.CraftBuilder.IsDesignation(Voxel))
            {
                yield return(Status.Fail);
            }

            // Use the existing entity instead of creating a new one.
            var item = Item.Entity;

            item.SetFlagRecursive(GameComponent.Flag.Active, true);
            item.SetTintRecursive(Color.White);
            item.SetFlagRecursive(GameComponent.Flag.Visible, true);

            if (Item.ItemType.Moveable)
            {
                item.Tags.Add("Moveable");
            }

            if (Item.WorkPile != null)
            {
                Item.WorkPile.Die();
            }

            CraftDetails details = item.GetComponent <CraftDetails>();

            if (details == null)
            {
                item.AddChild(new CraftDetails(Creature.Manager)
                {
                    Resources = Item.SelectedResources.ConvertAll(p => new ResourceAmount(p)),
                    CraftType = Item.ItemType.Name
                });

                if (Item.SelectedResources.Count > 0)
                {
                    item.Name = Item.SelectedResources.FirstOrDefault().ResourceType + " " + item.Name;
                }
            }

            if (Item.ItemType.AddToOwnedPool)
            {
                Creature.Faction.OwnedObjects.Add(item);
            }

            Creature.Manager.World.ParticleManager.Trigger("puff", Voxel.WorldPosition + Vector3.One * 0.5f, Color.White, 10);
            Creature.Faction.Designations.RemoveEntityDesignation(item, DesignationType.Craft);
            Creature.AI.AddXP((int)(5 * (Item.ItemType.BaseCraftTime / Creature.AI.Stats.BuffedInt)));
            yield return(Status.Success);
        }
Esempio n. 4
0
 public CraftedFixture(ComponentManager manager, Vector3 position, SpriteSheet sheet, Point frame, CraftDetails details, SimpleSprite.OrientMode OrientMode = SimpleSprite.OrientMode.Spherical) :
     base(manager, position, sheet, frame, OrientMode)
 {
     this.SetFlag(Flag.ShouldSerialize, true);
     AddChild(details);
 }
Esempio n. 5
0
        public override IEnumerable <Status> Run()
        {
            Item.Finished = true;
            var item = Item.Entity;

            item.SetFlagRecursive(GameComponent.Flag.Active, true);
            item.SetVertexColorRecursive(Color.White);
            var tinters = item.EnumerateAll().OfType <Tinter>();

            foreach (var tinter in tinters)
            {
                tinter.Stipple = false;
            }

            item.SetFlagRecursive(GameComponent.Flag.Visible, true);

            if (Item.ItemType.Moveable)
            {
                item.Tags.Add("Moveable");
            }

            if (Item.ItemType.Deconstructable)
            {
                item.Tags.Add("Deconstructable");
            }

            if (Item.WorkPile != null)
            {
                Item.WorkPile.Die();
            }

            CraftDetails details = item.GetComponent <CraftDetails>();

            if (details == null)
            {
                item.AddChild(new CraftDetails(Creature.Manager)
                {
                    Resources = Item.SelectedResources.ConvertAll(p => new ResourceAmount(p)),
                    CraftType = Item.ItemType.Name
                });

                if (Item.SelectedResources.Count > 0)
                {
                    item.Name = Item.SelectedResources.FirstOrDefault().ResourceType + " " + item.Name;
                }
            }
            else
            {
                details.CraftType = Item.ItemType.Name;
                details.Resources = Item.SelectedResources.ConvertAll(p => new ResourceAmount(p));
            }

            if (Item.ItemType.AddToOwnedPool)
            {
                Creature.Faction.OwnedObjects.Add(item);
            }

            Creature.Manager.World.ParticleManager.Trigger("puff", Voxel.WorldPosition + Vector3.One * 0.5f, Color.White, 10);
            Creature.AI.AddXP((int)(5 * (Item.ItemType.BaseCraftTime / Creature.AI.Stats.BuffedInt)));
            yield return(Status.Success);
        }