Prechádzať zdrojové kódy

Fixes campfire fuel (#109)

* fixes grill burn system

* brazier sprite fix
Taislin 7 mesiacov pred
rodič
commit
597f921275

+ 12 - 8
Content.Server/Civ14/Kitchen/GrillFuelBurnSystem.cs

@@ -71,15 +71,15 @@ private void OnInteractUsing(EntityUid uid, GrillFuelBurnComponent comp, Interac
 
         if (_entityManager.TryGetComponent<StackComponent>(args.Used, out var stackComp))
         {
-            int availableFuel = stackComp.Count;
-            int fuelNeeded = comp.MaxFuel - comp.Fuel;
-            int fuelToAdd = Math.Min(availableFuel, fuelNeeded);
+            float availableFuel = stackComp.Count;
+            float fuelNeeded = comp.MaxFuel - comp.Fuel;
+            float fuelToAdd = Math.Min(availableFuel, fuelNeeded);
 
             if (fuelToAdd > 0)
             {
                 comp.Fuel += fuelToAdd;
                 _remainingBurnTime[uid] += fuelToAdd * burnFuel.BurnTime * 60f;
-                _stackSystem.SetCount(args.Used, stackComp.Count - fuelToAdd, stackComp);
+                _stackSystem.SetCount(args.Used, stackComp.Count - (int)fuelToAdd, stackComp);
 
                 if (stackComp.Count <= 0)
                 {
@@ -108,20 +108,24 @@ public override void Update(float deltaTime)
         var query = EntityQueryEnumerator<GrillFuelBurnComponent, ItemPlacerComponent>();
         while (query.MoveNext(out var uid, out var comp, out var placer))
         {
-            if (comp.IsLit && comp.Expends == true)
+            if (comp.IsLit)
             {
                 if (comp.Fuel <= 0 || _remainingBurnTime.GetValueOrDefault(uid) <= 0)
                 {
-                    var coordinates = Transform(uid).Coordinates;
-                    Spawn("Coal1", coordinates);
-                    QueueDel(uid);
                     _remainingBurnTime.Remove(uid);
                     comp.IsLit = false;
                     AdjustHeaterSetting(uid, comp);
+                    if (comp.Expends == true)
+                    {
+                        var coordinates = Transform(uid).Coordinates;
+                        Spawn("Coal1", coordinates);
+                        QueueDel(uid);
+                    }
                     continue;
                 }
 
                 _remainingBurnTime[uid] -= deltaTime;
+                comp.Fuel -= deltaTime/60f;
                 AdjustHeaterSetting(uid, comp);
 
                 if (comp.Setting != EntityHeaterSetting.Off)

+ 4 - 1
Content.Server/Power/EntitySystems/PowerReceiverSystem.cs

@@ -42,7 +42,10 @@ public override void Initialize()
 
         private void OnExamined(Entity<ApcPowerReceiverComponent> ent, ref ExaminedEvent args)
         {
-            args.PushMarkup(GetExamineText(ent.Comp.Powered));
+            if (ent.Comp.NeedsPower)
+            {
+                args.PushMarkup(GetExamineText(ent.Comp.Powered));
+            }
         }
 
         private void OnGetVerbs(EntityUid uid, ApcPowerReceiverComponent component, GetVerbsEvent<Verb> args)

+ 2 - 2
Content.Shared/Civ14/Kitchen/GrillFuelBurnComponent.cs

@@ -13,13 +13,13 @@ public sealed partial class GrillFuelBurnComponent : Component
     /// Current amount of fuel in the campfire.
     /// </summary>
     [DataField("fuel")]
-    public int Fuel = 2;
+    public float Fuel = 2;
 
     /// <summary>
     /// Maximum amount of fuel the campfire can hold.
     /// </summary>
     [DataField("maxFuel")]
-    public int MaxFuel = 10;
+    public float MaxFuel = 30;
 
     /// <summary>
     /// Current heating setting of the campfire based on fuel level.

+ 1 - 1
Resources/Prototypes/Civ14/Entities/Objects/Specific/cooking.yml

@@ -86,7 +86,7 @@
       heatingRate: 10
     - type: GrillFuelBurn
       fuel: 2
-      maxFuel: 10
+      maxFuel: 30
     - type: PlaceableSurface
     - type: ItemPlacer
       maxEntities: 2

+ 8 - 3
Resources/Prototypes/Civ14/Entities/Structures/warmth.yml

@@ -16,7 +16,7 @@
           visible: false
     - type: PointLight
       enabled: false
-      radius: 5
+      radius: 6
       energy: 5
       color: "#E25822"
     - type: ApcPowerReceiver
@@ -24,6 +24,11 @@
       powerLoad: 0
     - type: HeatEmitter
       heatingRate: 15
+    - type: ItemPlacer
+      maxEntities: 2
+      whitelist:
+        components:
+          - Temperature
     - type: GrillFuelBurn
       fuel: 0
       maxFuel: 60
@@ -54,8 +59,8 @@
           enum.EntityHeaterVisuals.Setting:
             Off: { visible: false }
             Low: { visible: true, state: s_brazier1 }
-            Medium: { visible: true, state: s_brazier1 }
-            High: { visible: true, state: s_brazier1 }
+            Medium: { visible: true, state: s_brazier2 }
+            High: { visible: true, state: s_brazier2 }
 
 - type: entity
   name: tiki torch

+ 16 - 11
Resources/Textures/Civ14/Objects/structures.rsi/meta.json

@@ -664,16 +664,21 @@
             "name": "s_brazier1",
             "delays": [
                 [
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125,
-                    0.125
+                    0.1,
+                    0.1,
+                    0.1,
+                    0.1
+                ]
+            ]
+        },
+        {
+            "name": "s_brazier2",
+            "delays": [
+                [
+                    0.1,
+                    0.1,
+                    0.1,
+                    0.1
                 ]
             ]
         },
@@ -1656,4 +1661,4 @@
             "name": "propstall4"
         }
     ]
-}
+}

BIN
Resources/Textures/Civ14/Objects/structures.rsi/s_brazier1.png


BIN
Resources/Textures/Civ14/Objects/structures.rsi/s_brazier2.png