public override TemplateObject Handle(TagData data)
        {
            if (data.Remaining == 0)
            {
                return(this);
            }
            switch (data[0])
            {
            // <--[tag]
            // @Name StructureTag.asset
            // @Group General Information
            // @ReturnType ItemAssetTag
            // @Returns the item asset that this structure is based off.
            // @Example "2" .asset returns "Floor_Metal".
            // -->
            case "asset":
                return(ItemAssetTag.For(InternalData.structure.id.ToString()).Handle(data.Shrink()));

            // <--[tag]
            // @Name StructureTag.health
            // @Group General Information
            // @ReturnType NumberTag
            // @Returns the current health of the structure.
            // @Example "2" .health returns "1".
            // -->
            case "health":
                return(new NumberTag(InternalData.structure.health).Handle(data.Shrink()));

            default:
                return(new EntityTag(Internal.gameObject).Handle(data));
            }
        }
        public override TemplateObject Handle(TagData data)
        {
            if (data.Remaining == 0)
            {
                return(this);
            }
            switch (data[0])
            {
            // <--[tag]
            // @Name BarricadeTag.asset
            // @Group General Information
            // @ReturnType ItemAssetTag
            // @Returns the item asset that this barricade is based off.
            // @Example "2" .asset returns "Bush_Jade".
            // -->
            case "asset":
                return(ItemAssetTag.For(InternalData.barricade.id.ToString()).Handle(data.Shrink()));

            // <--[tag]
            // @Name BarricadeTag.health
            // @Group General Information
            // @ReturnType NumberTag
            // @Returns the barricade's current health.
            // @Example "2" .health returns "96".
            // -->
            case "health":
                return(new NumberTag(InternalData.barricade.health).Handle(data.Shrink()));

            // <--[tag]
            // @Name BarricadeTag.powered
            // @Group General Information
            // @ReturnType BooleanTag
            // @Returns whether the barricade is currently powered, open, or lit, etc.
            // @Example "2" .powered returns "true".
            // -->
            case "powered":
                Interactable power = Internal.gameObject.GetComponent <Interactable>();
                if (power != null)
                {
                    if (power is InteractableDoor)
                    {
                        return(new BooleanTag(InternalData.barricade.state[16] == 1).Handle(data.Shrink()));
                    }
                    else if (power is InteractableFire || power is InteractableGenerator ||
                             power is InteractableSafezone || power is InteractableSpot)
                    {
                        return(new BooleanTag(InternalData.barricade.state[0] == 1).Handle(data.Shrink()));
                    }
                }
                data.Error("Read 'powered' tag on non-powerable object!");
                return(new NullTag());

            default:
                return(new EntityTag(Internal.gameObject).Handle(data));
            }
        }
Exemple #3
0
        public override TemplateObject Handle(TagData data)
        {
            if (data.Remaining == 0)
            {
                return(this);
            }
            switch (data[0])
            {
            // <--[tag]
            // @Name AnimalAssetTag.name
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the name of the asset.
            // @Example "Cow" .name returns "Cow".
            // -->
            case "name":
                return(new TextTag(Internal.name).Handle(data.Shrink()));

            // <--[tag]
            // @Name AnimalAssetTag.formatted_name
            // @Group General Information
            // @ReturnType TextTag
            // @Returns the formatted name of the asset.
            // @Example "Cow" .formatted_name returns "Cow".
            // -->
            case "formatted_name":
                return(new TextTag(Internal.animalName).Handle(data.Shrink()));

            // <--[tag]
            // @Name AnimalAssetTag.id
            // @Group General Information
            // @ReturnType NumberTag
            // @Returns the ID number of the animal asset.
            // @Example "Cow" .id returns "6".
            // -->
            case "id":
                return(new NumberTag(Internal.id).Handle(data.Shrink()));

            // <--[tag]
            // @Name AnimalAssetTag.pelt
            // @Group General Information
            // @ReturnType ItemAssetTag
            // @Returns the item asset for the pelt this animal drops when it dies.
            // @Example "Cow" .pelt returns "Box_Milk".
            // -->
            case "pelt":
                return(ItemAssetTag.For(Internal.pelt.ToString()).Handle(data.Shrink()));

            // <--[tag]
            // @Name AnimalAssetTag.meat
            // @Group General Information
            // @ReturnType ItemAssetTag
            // @Returns the item asset for the meat this animal drops when it dies.
            // @Example "Cow" .meat returns "Beef_Raw".
            // -->
            case "meat":
                return(ItemAssetTag.For(Internal.meat.ToString()).Handle(data.Shrink()));

            // <--[tag]
            // @Name AnimalAssetTag.health
            // @Group General Information
            // @ReturnType NumberTag
            // @Returns the default health for this animal asset.
            // @Example "Cow" .health returns "100".
            // -->
            case "health":
                return(new NumberTag(Internal.health).Handle(data.Shrink()));

            default:
                return(new TextTag(ToString()).Handle(data));
            }
        }