Переглянути джерело

anvil and kiln recipes, fuel burn (attempted) fix

Taislin 7 місяців тому
батько
коміт
5f7e3c989a

+ 7 - 15
Content.Server/Civ14/Kitchen/GrillFuelBurnSystem.cs

@@ -26,8 +26,6 @@ public sealed class GrillFuelBurnSystem : EntitySystem
 
     [Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;
 
-    private readonly Dictionary<EntityUid, float> _remainingBurnTime = new();
-
     public override void Initialize()
     {
         base.Initialize();
@@ -39,7 +37,6 @@ public override void Initialize()
 
     private void OnMapInit(EntityUid uid, GrillFuelBurnComponent component, MapInitEvent args)
     {
-        _remainingBurnTime[uid] = component.Fuel * 2f * 60f;
         component.IsLit = false;
     }
 
@@ -52,7 +49,7 @@ private void OnInteractUsing(EntityUid uid, GrillFuelBurnComponent comp, Interac
     {
         if (_entityManager.TryGetComponent<IgnitionSourceComponent>(args.Used, out var ignitionSource))
         {
-            if (!comp.IsLit && ignitionSource.Ignited && _remainingBurnTime[uid] > 0)
+            if (!comp.IsLit && ignitionSource.Ignited && comp.Fuel > 0)
             {
                 comp.IsLit = true;
                 AdjustHeaterSetting(uid, comp);
@@ -77,10 +74,8 @@ private void OnInteractUsing(EntityUid uid, GrillFuelBurnComponent comp, Interac
 
             if (fuelToAdd > 0)
             {
-                comp.Fuel += fuelToAdd;
-                _remainingBurnTime[uid] += fuelToAdd * burnFuel.BurnTime * 60f;
+                comp.Fuel += fuelToAdd * burnFuel.BurnTime;
                 _stackSystem.SetCount(args.Used, stackComp.Count - (int)fuelToAdd, stackComp);
-
                 if (stackComp.Count <= 0)
                 {
                     QueueDel(args.Used);
@@ -94,8 +89,7 @@ private void OnInteractUsing(EntityUid uid, GrillFuelBurnComponent comp, Interac
         {
             if (comp.Fuel < comp.MaxFuel)
             {
-                comp.Fuel++;
-                _remainingBurnTime[uid] += burnFuel.BurnTime * 60f;
+                comp.Fuel += burnFuel.BurnTime;
                 QueueDel(args.Used);
                 AdjustHeaterSetting(uid, comp);
                 args.Handled = true;
@@ -110,9 +104,8 @@ public override void Update(float deltaTime)
         {
             if (comp.IsLit)
             {
-                if (comp.Fuel <= 0 || _remainingBurnTime.GetValueOrDefault(uid) <= 0)
+                if (comp.Fuel <= 0)
                 {
-                    _remainingBurnTime.Remove(uid);
                     comp.IsLit = false;
                     AdjustHeaterSetting(uid, comp);
                     if (comp.Expends == true)
@@ -124,8 +117,7 @@ public override void Update(float deltaTime)
                     continue;
                 }
 
-                _remainingBurnTime[uid] -= deltaTime;
-                comp.Fuel -= deltaTime/60f;
+                comp.Fuel -= deltaTime / 60f;
                 AdjustHeaterSetting(uid, comp);
 
                 if (comp.Setting != EntityHeaterSetting.Off)
@@ -145,7 +137,7 @@ private void OnExamined(EntityUid uid, GrillFuelBurnComponent comp, ExaminedEven
         if (!args.IsInDetailsRange)
             return;
 
-        var remainingTime = _remainingBurnTime.GetValueOrDefault(uid) / 60f;
+        var remainingTime = comp.Fuel;
         args.PushMarkup($"Has approximately {remainingTime:F1} minutes of fuel remaining.");
     }
 
@@ -198,7 +190,7 @@ private void AdjustHeaterSetting(EntityUid uid, GrillFuelBurnComponent comp)
             return;
         }
 
-        var remainingTimeSeconds = _remainingBurnTime.GetValueOrDefault(uid);
+        var remainingTimeSeconds = comp.Fuel * 60f;
         EntityHeaterSetting newSetting;
 
         if (remainingTimeSeconds > 600f) // > 10 minutes

+ 3 - 0
Resources/Prototypes/Civ14/Entities/Structures/Craft/anvil.yml

@@ -27,6 +27,9 @@
         tags:
           - Sheet
           - Ingot
+    - type: Construction
+      graph: AnvilStone
+      node: end
 
 - type: latheCategory
   id: AnvilBronze

+ 3 - 0
Resources/Prototypes/Civ14/Entities/Structures/Craft/fletchers.yml

@@ -27,6 +27,9 @@
           - Sheet
           - RawMaterial
           - Ingot
+    - type: Construction
+      graph: FletchersWorkstation
+      node: end
 
 - type: latheCategory
   id: Fletcher

+ 6 - 0
Resources/Prototypes/Civ14/Entities/Structures/Craft/metallurgy.yml

@@ -33,6 +33,9 @@
       runningState: stone_kiln_on
       staticPacks:
         - StoneKiln
+    - type: Construction
+      graph: StoneKiln
+      node: end
 
 - type: latheRecipePack
   id: StoneKiln
@@ -120,6 +123,9 @@
       runningState: bloomery_on
       staticPacks:
         - Bloomery
+    - type: Construction
+      graph: Bloomery
+      node: end
 
 - type: latheRecipePack
   id: Bloomery

+ 31 - 2
Resources/Prototypes/Civ14/Recipes/Construction/metallurgy.yml

@@ -9,7 +9,6 @@
             - material: Stone
               amount: 25
               doAfter: 15
-
     - node: end
       entity: StoneKiln
 
@@ -41,7 +40,6 @@
             - material: Stone
               amount: 25
               doAfter: 15
-
     - node: end
       entity: Bloomery
 
@@ -61,3 +59,34 @@
   canBuildInImpassable: false
   conditions:
     - !type:TileNotBlocked
+
+- type: constructionGraph
+  id: StoneAnvil
+  start: start
+  graph:
+    - node: start
+      edges:
+        - to: end
+          steps:
+            - material: Stone
+              amount: 20
+              doAfter: 15
+    - node: end
+      entity: StoneAnvil
+
+- type: construction
+  name: stone anvil
+  id: AnvilStone
+  graph: AnvilStone
+  startNode: start
+  targetNode: end
+  category: construction-category-production
+  description: A metalworking tool to produce weapons and armours.
+  icon: { sprite: Civ14/Objects/metallurgy.rsi, state: stone_anvil }
+  objectType: Structure
+  agemin: 0
+  agemax: 8
+  placementMode: SnapgridCenter
+  canBuildInImpassable: false
+  conditions:
+    - !type:TileNotBlocked