diff --git a/Examples/AltRecipe/Server/Mods/UserCode/ExoticSaladAlt.cs b/Examples/AltRecipe/Server/Mods/UserCode/ExoticSaladAlt.cs
index 280e5b3..0ee9929 100644
--- a/Examples/AltRecipe/Server/Mods/UserCode/ExoticSaladAlt.cs
+++ b/Examples/AltRecipe/Server/Mods/UserCode/ExoticSaladAlt.cs
@@ -2,21 +2,13 @@
// See LICENSE file in the project root for full license information.
//
+using Eco.Gameplay.Components;
+using Eco.Gameplay.Items.Recipes;
+using Eco.Gameplay.Skills;
+using Eco.Shared.Localization;
+
namespace Eco.Mods.TechTree
{
- using System;
- using System.Collections.Generic;
- using Eco.Gameplay.Components;
- using Eco.Gameplay.DynamicValues;
- using Eco.Gameplay.Items;
- using Eco.Gameplay.Players;
- using Eco.Gameplay.Skills;
- using Eco.Shared.Utils;
- using Eco.World;
- using Eco.World.Blocks;
- using Gameplay.Systems.TextLinks;
- using Eco.Shared.Localization;
-
///
/// An example alternative server side recipe definition for "ExoticSalad". This recipe can be crafted at a Campfire instead of a Iron Stove.
/// More information about RecipeFamily objects can be found at https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.RecipeFamily.html
@@ -37,7 +29,7 @@ public ExoticSaladAltRecipe()
{
new IngredientElement(typeof(PricklyPearFruitItem), 6, typeof(CookingSkill), typeof(CookingLavishResourcesTalent)),
new IngredientElement(typeof(CriminiMushroomsItem), 6, typeof(CookingSkill), typeof(CookingLavishResourcesTalent)),
- new IngredientElement(typeof(RiceItem), 6, typeof(CookingSkill), typeof(CookingLavishResourcesTalent)),
+ new IngredientElement(typeof(RiceItem), 6, typeof(CookingSkill), typeof(CookingLavishResourcesTalent)),
},
// Define our recipe output items.
diff --git a/Examples/AutogenUI/Server/ComponentInterface.cs b/Examples/AutogenUI/Server/ComponentInterface.cs
new file mode 100644
index 0000000..319955f
--- /dev/null
+++ b/Examples/AutogenUI/Server/ComponentInterface.cs
@@ -0,0 +1,94 @@
+using Eco.Core.Controller;
+using Eco.Core.PropertyHandling;
+using Eco.Gameplay.Objects;
+using Eco.Shared.Localization;
+using Eco.Shared.Networking;
+using Eco.Shared.Serialization;
+
+namespace Eco.Mods.Components
+{
+ [Serialized]
+ [AutogenClass]
+ [LocDisplayName("Component Interface")]
+ [LocDescription("An example interface for a component.")]
+ [NoIcon]
+ [CreateComponentTabLoc("Interface")]
+ public partial class ComponentInterfaceExample : WorldObjectComponent
+ {
+ // A read only property formated into a LocString
+
+ [LocDisplayName("Readonly Property"), LocDescription("This property is readonly.")]
+ [SyncToView, Notify, Autogen] public string ReadonlyPropertyDisplay => Localizer.DoStr($"This property is set to {ChangingProperty}."); // formats the value into a string
+ // Called when a user trys to set the value. Only updates value to ensure ui is up to date.
+ [RPC] public void SetReadonlyPropertyDisplay(string value) => this.FirePropertyChanged(nameof(ReadonlyPropertyDisplay));
+
+ [Serialized] private float _ChangingProperty = 0;
+ public float ChangingProperty
+ {
+ get => _ChangingProperty;
+ set
+ {
+ if (_ChangingProperty == value) return;
+ // Fires all displays that use this value to update the client
+ this.FirePropertyChanged(nameof(ReadonlyPropertyDisplay));
+
+ _ChangingProperty = value;
+ }
+ }
+
+ // A read only property as raw
+
+ [Serialized] private float _ChangingProperty_2 = 0;
+
+ [LocDisplayName("Readonly Raw Property"), LocDescription("This property is readonly from its raw value format.")]
+ [SyncToView, Notify, Autogen] public float ChangingProperty_2
+ {
+ get => _ChangingProperty_2;
+ set
+ {
+ if (_ChangingProperty_2 == value) return;
+ // Fires all displays that use this value to update the client
+ this.FirePropertyChanged(nameof(ChangingProperty_2));
+
+ _ChangingProperty_2 = value;
+ }
+ }
+ [RPC] public void SetChangingProperty_2(string value) => this.FirePropertyChanged(nameof(ChangingProperty_2));
+
+ // A static property
+
+ [LocDisplayName("Static Property"), LocDescription("This property is static and wont update.")]
+ [SyncToView, Notify, Autogen] public string StaticPropertyDisplay => Localizer.DoStr($"This property is set to {Property}."); // formats the value into a string
+ // Called when a user trys to set the value. Does nothing to ensure its read only.
+ [RPC] public void SetStaticPropertyDisplay(string value) => this.FirePropertyChanged(nameof(StaticPropertyDisplay));
+
+ public float Property => 18;
+
+ // A editable property
+
+ [Serialized] private string _Words = Localizer.DoStr("Potato");
+
+ [LocDisplayName("Editable Words"), LocDescription("This property can be changed per your will.")]
+ [SyncToView, Notify, Autogen]
+ public string Words
+ {
+ get => _Words;
+ set
+ {
+ if (_Words == value) return;
+ // Fires all displays that use this value to update the client
+ this.FirePropertyChanged(nameof(Words));
+
+ _Words = value;
+ }
+ }
+ [RPC] public void SetWords(string value) => Words = value;
+
+ public override void Tick()
+ {
+ ChangingProperty += 1;
+ ChangingProperty_2 -= 1.5f;
+ base.Tick();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Examples/Blockset/Server/StainedGlass.cs b/Examples/Blockset/Server/StainedGlass.cs
index c00f0b3..bd1f4d3 100644
--- a/Examples/Blockset/Server/StainedGlass.cs
+++ b/Examples/Blockset/Server/StainedGlass.cs
@@ -1,25 +1,16 @@
-namespace Eco.Mods.TechTree
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using Eco.Gameplay.Blocks;
- using Eco.Gameplay.Components;
- using Eco.Gameplay.DynamicValues;
- using Eco.Gameplay.Items;
- using Eco.Gameplay.Objects;
- using Eco.Gameplay.Players;
- using Eco.Gameplay.Skills;
- using Eco.Gameplay.Systems;
- using Eco.Gameplay.Systems.TextLinks;
- using Eco.Core.Items;
- using Eco.Shared.Localization;
- using Eco.Shared.Serialization;
- using Eco.Shared.Utils;
- using Eco.World;
- using Eco.World.Blocks;
- using Eco.Gameplay.Pipes;
+using Eco.Gameplay.Blocks;
+using Eco.Gameplay.Components;
+using Eco.Gameplay.Items;
+using Eco.Gameplay.Objects;
+using Eco.Gameplay.Skills;
+using Eco.Core.Items;
+using Eco.Shared.Localization;
+using Eco.Shared.Serialization;
+using Eco.World.Blocks;
+using Eco.Gameplay.Items.Recipes;
+namespace Eco.Mods.TechTree
+{
[RequiresSkill(typeof(GlassworkingSkill), 1)]
public partial class GreenStainedGlassRecipe : RecipeFamily
{
@@ -66,16 +57,16 @@ public partial class GreenStainedGlassBlock : Block, IRepresentsItem
[Serialized]
[LocDisplayName("Green Stained Glass")]
+ [LocDescription("A transparent, solid material useful for more than just windows.")]
[MaxStackSize(20)]
[Weight(10000)]
- [Ecopedia("Blocks", "Building Materials", createAsSubPage: true, display: InPageTooltip.DynamicTooltip)]
+ [Ecopedia("Blocks", "Building Materials", createAsSubPage: true, displayOnPage: true)]
[Currency][Tag("Currency")]
- [Tag("Constructable", 1)]
+ [Tag("Constructable")]
[Tier(2)]
public partial class GreenStainedGlassItem : BlockItem
{
- public override LocString DisplayNamePlural { get { return Localizer.DoStr("Green Stained Glass"); } }
- public override LocString DisplayDescription { get { return Localizer.DoStr("A transparent, solid material useful for more than just windows."); } }
+ public override LocString DisplayNamePlural { get { return Localizer.DoStr("Green Stained Glass"); } }
public override bool CanStickToWalls { get { return false; } }
@@ -88,10 +79,10 @@ public partial class GreenStainedGlassItem : BlockItem
public override Type[] BlockTypes { get { return blockTypes; } }
}
- [Serialized, Solid] public class GreenStainedGlassStacked1Block : PickupableBlock { }
- [Serialized, Solid] public class GreenStainedGlassStacked2Block : PickupableBlock { }
- [Serialized, Solid] public class GreenStainedGlassStacked3Block : PickupableBlock { }
- [Serialized, Solid,Wall] public class GreenStainedGlassStacked4Block : PickupableBlock { } //Only a wall if it's all 4 Glass
+ [Serialized, Solid] public class GreenStainedGlassStacked1Block : PickupableBlock { }
+ [Serialized, Solid] public class GreenStainedGlassStacked2Block : PickupableBlock { }
+ [Serialized, Solid] public class GreenStainedGlassStacked3Block : PickupableBlock { }
+ [Serialized, Solid, Wall] public class GreenStainedGlassStacked4Block : PickupableBlock { } //Only a wall if it's all 4 Glass
[Serialized]
[Wall, Constructed, Solid, BuildRoomMaterialOption]
diff --git a/Examples/CornOnTheCob/Server/CornOnTheCob.cs b/Examples/CornOnTheCob/Server/CornOnTheCob.cs
index b63739d..6c7311d 100644
--- a/Examples/CornOnTheCob/Server/CornOnTheCob.cs
+++ b/Examples/CornOnTheCob/Server/CornOnTheCob.cs
@@ -1,11 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Eco.Core.Items;
+using Eco.Core.Items;
using Eco.Gameplay.Components;
using Eco.Gameplay.Items;
+using Eco.Gameplay.Items.Recipes;
using Eco.Gameplay.Players;
using Eco.Gameplay.Skills;
using Eco.Shared.Localization;
@@ -14,18 +10,18 @@
namespace Eco.Mods.TechTree
{
[Serialized]
- [LocDisplayName("Corn on the cob")]
[Weight(300)]
- [Tag("BakedVegetable", 1)]
- [Tag("BakedFood", 1)]
+ [Tag("BakedFood")]
+ [Tag("BakedVegetable")]
+ [LocDisplayName("Corn on the cob")]
+ [LocDescription("A warmly colored kernel studded vegetable.")]
public partial class CornOnTheCobItem : FoodItem
{
- public override LocString DisplayNamePlural => Localizer.DoStr("Corn on the Cob ");
- public override LocString DisplayDescription => Localizer.DoStr("A warmly colored kernel studded vegetable.");
- public override Nutrients Nutrition => new Nutrients { Carbs = 12, Fat = 2, Protein = 3, Vitamins = 11};
+ public override LocString DisplayNamePlural => Localizer.DoStr("Corn on the Cob ");
+ public override Nutrients Nutrition => new Nutrients { Carbs = 12, Fat = 2, Protein = 3, Vitamins = 11};
- public override float Calories => 250;
- public override int ShelfLife => 86000;
+ public override float Calories => 250;
+ protected override float BaseShelfLife => 86000;
}
diff --git a/Examples/Flag/Server/FlagObject.cs b/Examples/Flag/Server/FlagObject.cs
index 003e86f..614405a 100644
--- a/Examples/Flag/Server/FlagObject.cs
+++ b/Examples/Flag/Server/FlagObject.cs
@@ -1,62 +1,51 @@
-namespace Eco.Mods.TechTree
-{
- using Eco.Gameplay.Components;
- using Eco.Gameplay.Components.Auth;
- using Eco.Gameplay.Items;
- using Eco.Shared.Localization;
- using Eco.Gameplay.Objects;
- using Eco.Shared.Serialization;
- using Eco.Shared.Math;
- using System.Collections.Generic;
- using Eco.Core.Items;
- using Eco.Gameplay.Players;
-
+using Eco.Gameplay.Components;
+using Eco.Gameplay.Components.Auth;
+using Eco.Gameplay.Items;
+using Eco.Shared.Localization;
+using Eco.Gameplay.Objects;
+using Eco.Shared.Serialization;
+using Eco.Shared.Math;
+using Eco.Core.Items;
+using Eco.Gameplay.Occupancy;
+using Eco.Gameplay.Items.Recipes;
+namespace Eco.Mods.TechTree
+{
[Serialized]
- [RequireComponent(typeof(SolidGroundComponent))]
- [RequireComponent(typeof(RoomRequirementsComponent))]
+ [LocDisplayName("Test Flag")]
[RequireComponent(typeof(OnOffComponent))]
[RequireComponent(typeof(PropertyAuthComponent))]
- public partial class FlagObject : WorldObject
+ public partial class FlagObject : WorldObject, IRepresentsItem
{
- public override LocString DisplayName { get { return Localizer.DoStr("Test Flag"); } }
- public bool isRoom { get; set; }
- protected override void Initialize()
- {
-
- }
+ public virtual Type RepresentedItemType => typeof(FlagItem);
- public override void Destroy()
- {
- base.Destroy();
- }
+ // Runs on object placement/load before its first tick.
+ protected override void Initialize() => base.Initialize();
+ protected override void PostInitialize() => base.PostInitialize();
- protected override void PostInitialize()
- {
- base.PostInitialize();
- }
+ // Runs before the destruction of the object in world.
+ protected override void OnDestroy() => base.OnDestroy();
}
[Serialized]
- [LocDisplayName("Test Flag")]
- [Ecopedia("Housing Objects", "Flags", createAsSubPage: true, display: InPageTooltip.DynamicTooltip)]
+ [LocDisplayName("Test Flag")] // Allows you to change the name the player sees for this item
+ [LocDescription("A piece of fabric with something on it. can be used for decorating.")] // The tooltip discription of the item.
+ [Ecopedia("Housing Objects", "Flags", createAsSubPage: true, DisplayOnPage = true)] // Creates a new subpage in Flags in the Housing Objects section for this item.
[Weight(10)]
public partial class FlagItem : WorldObjectItem
{
- public override LocString DisplayDescription { get { return Localizer.DoStr("A piece of fabric with something on it. can be used for decorating."); } }
-
static FlagItem()
{
+ // Adds occupancy to the object in all the blocks listed in orentation of the root (front left bottom)
WorldObject.AddOccupancy(new List(){
- new BlockOccupancy(new Vector3i(0, 0, 0)),
- new BlockOccupancy(new Vector3i(0, 1, 0)),
+ new(new Vector3i(0, 0, 0)),
+ new(new Vector3i(0, 1, 0)),
});
}
}
- public partial class FlagRecipe :
-RecipeFamily
+ public partial class FlagRecipe : RecipeFamily
{
public FlagRecipe()
{
diff --git a/Examples/GameActionsExample/Eco.Examples.GameActionListener/GarbageDetectionPlugin.cs b/Examples/GameActionsExample/Eco.Examples.GameActionListener/GarbageDetectionPlugin.cs
index f1efe9c..538cb47 100644
--- a/Examples/GameActionsExample/Eco.Examples.GameActionListener/GarbageDetectionPlugin.cs
+++ b/Examples/GameActionsExample/Eco.Examples.GameActionListener/GarbageDetectionPlugin.cs
@@ -1,14 +1,10 @@
-/*
- *
- *
- */
-
-using Eco.Core.Plugins.Interfaces;
+using Eco.Core.Plugins.Interfaces;
using Eco.Core.Utils;
+using Eco.Gameplay.Aliases;
using Eco.Gameplay.GameActions;
+using Eco.Gameplay.Property;
using Eco.Gameplay.Systems.Messaging.Notifications;
using Eco.Shared.Localization;
-using System.Threading.Tasks;
namespace Eco.Examples.GameActionListener
{
@@ -20,7 +16,8 @@ namespace Eco.Examples.GameActionListener
public class GarbageDetectionPlugin : IModKitPlugin, IGameActionAware, IInitializablePlugin, IShutdownablePlugin
{
/// Retrieves the current status of the .
- public string GetStatus() => "Ready!";
+ public string GetStatus() => "Ready!";
+ public string GetCategory() => "Mods";
#region IInitializablePlugin/IShutdownablePlugin Interface
/// Called on plugin instantiation to register our selves with the listeners.
@@ -60,6 +57,16 @@ public void ActionPerformed(GameAction action)
/// The being performed. This variable can be compared against the interfaces and defined action models to find out what is being processed.
/// The containing the modified authorization result.
public LazyResult ShouldOverrideAuth(GameAction action) => LazyResult.Succeeded; // Don't change the authorization behaviour of this action
+
+ void IGameActionAware.ActionPerformed(GameAction action)
+ {
+ throw new NotImplementedException();
+ }
+
+ LazyResult ICanOverrideAuth.ShouldOverrideAuth(IAlias? alias, IOwned? property, GameAction? action)
+ {
+ throw new NotImplementedException();
+ }
#endregion
}
}
diff --git a/Examples/ModkitPlugin/ModkitPlugin/WelcomeUserPlugin.cs b/Examples/ModkitPlugin/ModkitPlugin/WelcomeUserPlugin.cs
index b784342..f47baf1 100644
--- a/Examples/ModkitPlugin/ModkitPlugin/WelcomeUserPlugin.cs
+++ b/Examples/ModkitPlugin/ModkitPlugin/WelcomeUserPlugin.cs
@@ -12,7 +12,6 @@
using Eco.Gameplay.Players;
using Eco.Shared.Localization;
using Eco.Shared.Utils;
-using System.Threading.Tasks;
namespace Eco.WelcomePlugin
{
@@ -92,5 +91,7 @@ public void OnEditObjectChanged(object o, string param) { }
/// Custom ToString override for properly naming our plugin into the Eco server UI
public override string ToString() => "Welcome User";
+
+ string IServerPlugin.GetCategory() => "Mods";
}
}