Ver código fonte

dough, compostables (#151)

* dough, compostables

* bone helmet fix

* hammer and brazier fixes, fence gates not bumpable

* roast potatoes

* changelog
Taislin 7 meses atrás
pai
commit
72324ddb56

+ 3 - 3
.github/workflows/upload-client.yml

@@ -52,7 +52,7 @@ jobs:
       - name: Update Target Repo
         run: |
           # Copy compiled output to target-repo/
-          rsync -av --ignore-existing ./bin/Content.Client/win-x64/ target-repo/Content.Client/ || true
+          rsync -av --update ./bin/Content.Client/win-x64/ target-repo/Content.Client/ || true
           cd target-repo
           cd Content.Client
           git config user.name "GitHub Action"
@@ -62,10 +62,10 @@ jobs:
           git push
           cd -
           # Copy compiled output to target-repo/
-          rsync -av --ignore-existing ./../bin/Content.Server/win-x64/ Content.Server/ || true
+          rsync -av --update ./../bin/Content.Server/win-x64/ Content.Server/ || true
           cd Content.Server
           git config user.name "GitHub Action"
           git config user.email "action@github.com"
           git add .
-          git commit -m "Update compiled server from Civ14 - changed files only"
+          git commit -m "Update compiled server from Civ14"
           git push

+ 129 - 129
Content.Server/Construction/ConstructionSystem.Interactions.cs

@@ -37,8 +37,8 @@ private void InitializeInteractions()
 
             // Event handling. Add your subscriptions here! Just make sure they're all handled by EnqueueEvent.
             SubscribeLocalEvent<ConstructionComponent, InteractUsingEvent>(EnqueueEvent,
-                new []{typeof(AnchorableSystem), typeof(PryingSystem), typeof(WeldableSystem)},
-                new []{typeof(EncryptionKeySystem)});
+                new[] { typeof(AnchorableSystem), typeof(PryingSystem), typeof(WeldableSystem) },
+                new[] { typeof(EncryptionKeySystem) });
             SubscribeLocalEvent<ConstructionComponent, OnTemperatureChangeEvent>(EnqueueEvent);
             SubscribeLocalEvent<ConstructionComponent, PartAssemblyPartInsertedEvent>(EnqueueEvent);
         }
@@ -56,13 +56,13 @@ private HandleResult HandleEvent(EntityUid uid, object ev, bool validation, Cons
                 return HandleResult.False;
 
             // If the state machine is in an invalid state (not on a valid node) we can't do anything, ever.
-            if (GetCurrentNode(uid, construction) is not {} node)
+            if (GetCurrentNode(uid, construction) is not { } node)
             {
                 return HandleResult.False;
             }
 
             // If we're currently in an edge, we'll let the edge handle or validate the interaction.
-            if (GetCurrentEdge(uid, construction) is {} edge)
+            if (GetCurrentEdge(uid, construction) is { } edge)
             {
                 var result = HandleEdge(uid, ev, edge, validation, construction);
 
@@ -258,166 +258,166 @@ private HandleResult HandleInteraction(EntityUid uid, object ev, ConstructionGra
                 // Note: Please use braces for your new case, it's convenient.
 
                 case EntityInsertConstructionGraphStep insertStep:
-                {
-                    // EntityInsert steps only work with InteractUsing!
-                    if (ev is not InteractUsingEvent interactUsing)
-                        break;
-
-                    // TODO: Sanity checks.
+                    {
+                        // EntityInsert steps only work with InteractUsing!
+                        if (ev is not InteractUsingEvent interactUsing)
+                            break;
 
-                    user = interactUsing.User;
+                        // TODO: Sanity checks.
 
-                    var insert = interactUsing.Used;
+                        user = interactUsing.User;
 
-                    // Since many things inherit this step, we delegate the "is this entity valid?" logic to them.
-                    // While this is very OOP and I find it icky, I must admit that it simplifies the code here a lot.
-                    if(!insertStep.EntityValid(insert, EntityManager, _factory))
-                        return HandleResult.False;
+                        var insert = interactUsing.Used;
 
-                    // If we're only testing whether this step would be handled by the given event, then we're done.
-                    if (validation)
-                        return HandleResult.Validated;
+                        // Since many things inherit this step, we delegate the "is this entity valid?" logic to them.
+                        // While this is very OOP and I find it icky, I must admit that it simplifies the code here a lot.
+                        if (!insertStep.EntityValid(insert, EntityManager, _factory))
+                            return HandleResult.False;
 
-                    // If we still haven't completed this step's DoAfter...
-                    if (doAfterState == DoAfterState.None && insertStep.DoAfter > 0)
-                    {
-                        var doAfterEv = new ConstructionInteractDoAfterEvent(EntityManager, interactUsing);
+                        // If we're only testing whether this step would be handled by the given event, then we're done.
+                        if (validation)
+                            return HandleResult.Validated;
 
-                        var doAfterEventArgs = new DoAfterArgs(EntityManager, interactUsing.User, step.DoAfter, doAfterEv, uid, uid, interactUsing.Used)
+                        // If we still haven't completed this step's DoAfter...
+                        if (doAfterState == DoAfterState.None && insertStep.DoAfter > 0)
                         {
-                            BreakOnDamage = false,
-                            BreakOnMove = true,
-                            NeedHand = true,
-                        };
+                            var doAfterEv = new ConstructionInteractDoAfterEvent(EntityManager, interactUsing);
 
-                        var started  = _doAfterSystem.TryStartDoAfter(doAfterEventArgs);
+                            var doAfterEventArgs = new DoAfterArgs(EntityManager, interactUsing.User, step.DoAfter, doAfterEv, uid, uid, interactUsing.Used)
+                            {
+                                BreakOnDamage = false,
+                                BreakOnMove = true,
+                                NeedHand = true,
+                            };
 
-                        if (!started)
-                            return HandleResult.False;
+                            var started = _doAfterSystem.TryStartDoAfter(doAfterEventArgs);
+
+                            if (!started)
+                                return HandleResult.False;
 
 #if DEBUG
-                        // Verify that the resulting DoAfter event will be handled by the current construction state.
-                        // if it can't what is even the point of raising this DoAfter?
-                        doAfterEv.DoAfter = new(default, doAfterEventArgs, default);
-                        var result = HandleInteraction(uid, doAfterEv, step, validation: true, out _, construction);
-                        DebugTools.Assert(result == HandleResult.Validated);
+                            // Verify that the resulting DoAfter event will be handled by the current construction state.
+                            // if it can't what is even the point of raising this DoAfter?
+                            doAfterEv.DoAfter = new(default, doAfterEventArgs, default);
+                            var result = HandleInteraction(uid, doAfterEv, step, validation: true, out _, construction);
+                            DebugTools.Assert(result == HandleResult.Validated);
 #endif
-                        return HandleResult.DoAfter;
-                    }
+                            return HandleResult.DoAfter;
+                        }
 
-                    // Material steps, which use stacks, are handled specially. Instead of inserting the whole item,
-                    // we split the stack in two and insert the split stack.
-                    if (insertStep is MaterialConstructionGraphStep materialInsertStep)
-                    {
-                        if (_stackSystem.Split(insert, materialInsertStep.Amount, Transform(interactUsing.User).Coordinates) is not {} stack)
-                            return HandleResult.False;
+                        // Material steps, which use stacks, are handled specially. Instead of inserting the whole item,
+                        // we split the stack in two and insert the split stack.
+                        if (insertStep is MaterialConstructionGraphStep materialInsertStep)
+                        {
+                            if (_stackSystem.Split(insert, materialInsertStep.Amount, Transform(interactUsing.User).Coordinates) is not { } stack)
+                                return HandleResult.False;
 
-                        insert = stack;
-                    }
+                            insert = stack;
+                        }
 
-                    // Container-storage handling.
-                    if (!string.IsNullOrEmpty(insertStep.Store))
-                    {
-                        // In the case we want to store this item in a container on the entity...
-                        var store = insertStep.Store;
+                        // Container-storage handling.
+                        if (!string.IsNullOrEmpty(insertStep.Store))
+                        {
+                            // In the case we want to store this item in a container on the entity...
+                            var store = insertStep.Store;
 
-                        // Add this container to the collection of "construction-owned" containers.
-                        // Containers in that set will be transferred to new entities in the case of a prototype change.
-                        construction.Containers.Add(store);
+                            // Add this container to the collection of "construction-owned" containers.
+                            // Containers in that set will be transferred to new entities in the case of a prototype change.
+                            construction.Containers.Add(store);
 
-                        // The container doesn't necessarily need to exist, so we ensure it.
-                        _container.Insert(insert, _container.EnsureContainer<Container>(uid, store));
+                            // The container doesn't necessarily need to exist, so we ensure it.
+                            _container.Insert(insert, _container.EnsureContainer<Container>(uid, store));
+                        }
+                        else
+                        {
+                            // If we don't store the item in a container on the entity, we just delete it right away.
+                            Del(insert);
+                        }
+
+                        // Step has been handled correctly, so we signal this.
+                        return HandleResult.True;
                     }
-                    else
+
+                case ToolConstructionGraphStep toolInsertStep:
                     {
-                        // If we don't store the item in a container on the entity, we just delete it right away.
-                        Del(insert);
-                    }
+                        if (ev is not InteractUsingEvent interactUsing)
+                            break;
 
-                    // Step has been handled correctly, so we signal this.
-                    return HandleResult.True;
-                }
+                        // TODO: Sanity checks.
 
-                case ToolConstructionGraphStep toolInsertStep:
-                {
-                    if (ev is not InteractUsingEvent interactUsing)
-                        break;
+                        user = interactUsing.User;
 
-                    // TODO: Sanity checks.
+                        // If we're validating whether this event handles the step...
+                        if (validation)
+                        {
+                            // Then we only really need to check whether the tool entity has that quality or not.
+                            return _toolSystem.HasQuality(interactUsing.Used, toolInsertStep.Tool)
+                                ? HandleResult.Validated
+                                : HandleResult.False;
+                        }
 
-                    user = interactUsing.User;
+                        // If we're handling an event after its DoAfter finished...
+                        if (doAfterState == DoAfterState.Completed)
+                            return HandleResult.True;
+
+                        var result = _toolSystem.UseTool(
+                            interactUsing.Used,
+                            interactUsing.User,
+                            uid,
+                            TimeSpan.FromSeconds(toolInsertStep.DoAfter),
+                            new[] { toolInsertStep.Tool },
+                            new ConstructionInteractDoAfterEvent(EntityManager, interactUsing),
+                            out var doAfter,
+                            toolInsertStep.Fuel);
+
+                        return result && doAfter != null ? HandleResult.DoAfter : HandleResult.False;
+                    }
 
-                    // If we're validating whether this event handles the step...
-                    if (validation)
+                case TemperatureConstructionGraphStep temperatureChangeStep:
                     {
-                        // Then we only really need to check whether the tool entity has that quality or not.
-                        return _toolSystem.HasQuality(interactUsing.Used, toolInsertStep.Tool)
-                            ? HandleResult.Validated
-                            : HandleResult.False;
-                    }
+                        if (ev is not OnTemperatureChangeEvent)
+                            break;
 
-                    // If we're handling an event after its DoAfter finished...
-                    if (doAfterState == DoAfterState.Completed)
-                        return  HandleResult.True;
-
-                    var result  = _toolSystem.UseTool(
-                        interactUsing.Used,
-                        interactUsing.User,
-                        uid,
-                        TimeSpan.FromSeconds(toolInsertStep.DoAfter),
-                        new [] { toolInsertStep.Tool },
-                        new ConstructionInteractDoAfterEvent(EntityManager, interactUsing),
-                        out var doAfter,
-                        toolInsertStep.Fuel);
-
-                    return result && doAfter != null ? HandleResult.DoAfter : HandleResult.False;
-                }
+                        // Some things, like microwaves, might need to block the temperature construction step from kicking in, or override it entirely.
+                        var tempEvent = new OnConstructionTemperatureEvent();
+                        RaiseLocalEvent(uid, tempEvent, true);
 
-                case TemperatureConstructionGraphStep temperatureChangeStep:
-                {
-                    if (ev is not OnTemperatureChangeEvent)
-                        break;
+                        if (tempEvent.Result is not null)
+                            return tempEvent.Result.Value;
 
-                    // Some things, like microwaves, might need to block the temperature construction step from kicking in, or override it entirely.
-                    var tempEvent = new OnConstructionTemperatureEvent();
-                    RaiseLocalEvent(uid, tempEvent, true);
+                        // prefer using InternalTemperature since that's more accurate for cooking.
+                        float temp;
+                        if (TryComp<InternalTemperatureComponent>(uid, out var internalTemp))
+                        {
+                            temp = internalTemp.Temperature;
+                        }
+                        else if (TryComp<TemperatureComponent>(uid, out var tempComp))
+                        {
+                            temp = tempComp.CurrentTemperature;
+                        }
+                        else
+                        {
+                            return HandleResult.False;
+                        }
 
-                    if (tempEvent.Result is not null)
-                        return tempEvent.Result.Value;
+                        if ((!temperatureChangeStep.MinTemperature.HasValue || temp >= temperatureChangeStep.MinTemperature.Value) &&
+                            (!temperatureChangeStep.MaxTemperature.HasValue || temp <= temperatureChangeStep.MaxTemperature.Value))
+                        {
+                            return HandleResult.True;
+                        }
 
-                    // prefer using InternalTemperature since that's more accurate for cooking.
-                    float temp;
-                    if (TryComp<InternalTemperatureComponent>(uid, out var internalTemp))
-                    {
-                        temp = internalTemp.Temperature;
-                    }
-                    else if (TryComp<TemperatureComponent>(uid, out var tempComp))
-                    {
-                        temp = tempComp.CurrentTemperature;
-                    }
-                    else
-                    {
                         return HandleResult.False;
                     }
 
-                    if ((!temperatureChangeStep.MinTemperature.HasValue || temp >= temperatureChangeStep.MinTemperature.Value) &&
-                        (!temperatureChangeStep.MaxTemperature.HasValue || temp <= temperatureChangeStep.MaxTemperature.Value))
-                    {
-                        return HandleResult.True;
-                    }
-
-                    return HandleResult.False;
-                }
-
                 case PartAssemblyConstructionGraphStep partAssemblyStep:
-                {
-                    if (ev is not PartAssemblyPartInsertedEvent)
-                        break;
+                    {
+                        if (ev is not PartAssemblyPartInsertedEvent)
+                            break;
 
-                    if (partAssemblyStep.Condition(uid, EntityManager))
-                        return HandleResult.True;
-                    return HandleResult.False;
-                }
+                        if (partAssemblyStep.Condition(uid, EntityManager))
+                            return HandleResult.True;
+                        return HandleResult.False;
+                    }
 
                 #endregion
                 // --- CONSTRUCTION STEP EVENT HANDLING FINISH ---

+ 11 - 0
Resources/Changelog/Changelog.yml

@@ -123,3 +123,14 @@ Entries:
     id: 10
     time: "2025-04-21T00:00:00.0000000+00:00"
     url: https://github.com/Civ13/Civ14/pull/127
+  - author: Taislin
+    changes:
+      - message: Adds plant matter and some other foods to the compostables list.
+        type: Tweak
+      - message: Dough can be cooked in the campfire/brazier now.
+        type: Add
+      - message: Potatoes can be cooked in the campfire/brazier now. Eating raw potatoes will make you sick now!
+        type: Add
+    id: 11
+    time: "2025-04-23T00:00:00.0000000+00:00"
+    url: https://github.com/Civ13/Civ14/pull/151

Diferenças do arquivo suprimidas por serem muito extensas
+ 395 - 395
Resources/Prototypes/Civ14/Entities/Clothing/entities_clothing_hats.yml


+ 1 - 0
Resources/Prototypes/Civ14/Entities/Objects/Materials/civ_materials.yml

@@ -23,6 +23,7 @@
       tags:
         - RawMaterial
         - Burnable
+        - Compostable
     - type: BurnFuel
       burnTime: 1
 

+ 8 - 0
Resources/Prototypes/Civ14/Entities/Objects/Tools/tools.yml

@@ -212,6 +212,14 @@
       damage:
         types:
           Blunt: 3
+    - type: Tag
+      tags:
+        - Wrench
+    - type: Tool
+      qualities:
+        - Anchoring
+      useSound:
+        path: /Audio/Items/ratchet.ogg
     - type: Construction
       graph: WoodHammer
       node: woodhammer

+ 2 - 1
Resources/Prototypes/Civ14/Entities/Structures/Furniture/compostbin.yml

@@ -45,7 +45,8 @@
         - Bread
         - Pizza
         - Cheese
-      compostTime: 20.0
+        - Compostable
+      compostTime: 10.0
     - type: Construction
       agemin: 0
       agemax: 8

+ 1 - 1
Resources/Prototypes/Civ14/Entities/Structures/Walls/fences.yml

@@ -68,7 +68,7 @@
       canPry: false
       occludes: false
       changeAirtight: false
-      bumpOpen: true
+      bumpOpen: false
       clickOpen: true
       canCrush: true
       closeTimeOne: 0

+ 12 - 0
Resources/Prototypes/Civ14/Entities/Structures/warmth.yml

@@ -19,6 +19,18 @@
       radius: 6
       energy: 5
       color: "#E25822"
+    - type: Fixtures
+      fixtures:
+        fix1:
+          shape: !type:PhysShapeAabb
+            bounds: "-0.08,-0.35,0.15,0.25"
+          mask:
+            - TabletopMachineMask
+          layer:
+            - Impassable
+            - MidImpassable
+            - LowImpassable
+          hard: true
     - type: ApcPowerReceiver
       needsPower: false
       powerLoad: 0

+ 32 - 0
Resources/Prototypes/Civ14/Recipes/Construction/food.yml

@@ -0,0 +1,32 @@
+- type: constructionGraph
+  id: CookBread
+  start: start
+  graph:
+    - node: start
+      edges:
+        - to: bread
+          steps:
+            - minTemperature: 305
+    - node: bread
+      entity: FoodBreadPlain
+
+- type: foodSequenceElement
+  id: CookBread
+  sprites:
+    - sprite: Objects/Consumable/Food/Baked/bread.rsi
+      state: plain
+  tags:
+    - Cooked
+    - Bread
+
+- type: constructionGraph
+  id: RoastPotato
+  start: start
+  graph:
+    - node: start
+      edges:
+        - to: roastpotato
+          steps:
+            - minTemperature: 305
+    - node: roastpotato
+      entity: FoodPotatoRoast

+ 5 - 3
Resources/Prototypes/Entities/Objects/Consumable/Food/Baked/bread.yml

@@ -22,14 +22,13 @@
           reagents:
             - ReagentId: Nutriment
               Quantity: 20
-
+    - type: STWeight
+      self: 0.75
 - type: entity
   parent: FoodBreadBase
   id: FoodBreadSliceBase
   abstract: true
   components:
-    - type: STWeight
-      self: 0.75
     - type: Item
       size: Tiny
     - type: FlavorProfile
@@ -415,6 +414,9 @@
         - state: plain
     - type: SliceableFood
       slice: FoodBreadPlainSlice
+    - type: Construction
+      graph: CookBread
+      node: bread
 
 - type: entity
   name: bread slice

+ 13 - 2
Resources/Prototypes/Entities/Objects/Consumable/Food/ingredients.yml

@@ -294,9 +294,20 @@
       count: 3
       slice: FoodDoughSlice
     - type: Construction
-      graph: Pizza
+      graph: CookBread
       node: start
-
+      defaultTarget: bread
+    - type: Tag
+      tags:
+        - Compostable
+    - type: AtmosExposed
+    - type: Temperature
+      currentTemperature: 290
+    # required for cooking to work
+    - type: InternalTemperature
+      thickness: 0.02
+      area: 0.02 # arbitrary number
+      conductivity: 0.8
 - type: entity
   name: dough slice
   parent: FoodBakingBase

+ 55 - 6
Resources/Prototypes/Entities/Objects/Consumable/Food/produce.yml

@@ -17,7 +17,11 @@
     - type: Appearance
     - type: Extractable
       grindableSolutionName: food
-
+    - type: Tag
+      tags:
+        - Compostable
+    - type: STWeight
+      self: 0.5
 # For produce that can be immediately eaten
 
 - type: entity
@@ -57,6 +61,7 @@
     - type: Tag
       tags:
         - Wheat
+        - Compostable
 
 - type: entity
   name: meatwheat bushel
@@ -791,7 +796,7 @@
   name: potato
   parent: FoodProduceBase
   id: FoodPotato
-  description: The space Irish starved to death after their potato crops died. Sadly they were unable to fish for space carp due to it being the queen's space. Bringing this up to any space IRA member will drive them insane with anger.
+  description: A simple potato. You should cook it before eating.
   components:
     - type: FlavorProfile
       flavors:
@@ -799,12 +804,14 @@
     - type: SolutionContainerManager
       solutions:
         food:
-          maxVol: 14
+          maxVol: 8
           reagents:
+            - ReagentId: Toxin
+              Quantity: 2
             - ReagentId: Nutriment
-              Quantity: 10
-            - ReagentId: Vitamin
               Quantity: 4
+            - ReagentId: Vitamin
+              Quantity: 2
     - type: Sprite
       sprite: Objects/Specific/Hydroponics/potato.rsi
     - type: Item
@@ -820,11 +827,53 @@
       tags:
         - Potato
         - Vegetable
+        - Compostable
     - type: FoodSequenceElement
       entries:
         Burger: Potato
         Taco: Potato
-
+    - type: Construction
+      graph: RoastPotato
+      node: start
+      defaultTarget: roastpotato
+    - type: AtmosExposed
+    - type: Temperature
+      currentTemperature: 290
+    # required for cooking to work
+    - type: InternalTemperature
+      thickness: 0.02
+      area: 0.02 # arbitrary number
+      conductivity: 0.8
+- type: entity
+  name: roast potato
+  parent: FoodPotato
+  id: FoodPotatoRoast
+  description: A roast potato.
+  components:
+    - type: SolutionContainerManager
+      solutions:
+        food:
+          maxVol: 14
+          reagents:
+            - ReagentId: Nutriment
+              Quantity: 10
+            - ReagentId: Vitamin
+              Quantity: 4
+    - type: Sprite
+      sprite: Objects/Specific/Hydroponics/potato.rsi
+    - type: Extractable
+      juiceSolution:
+        reagents:
+          - ReagentId: JuicePotato
+            Quantity: 10
+    - type: Tag
+      tags:
+        - Potato
+        - Vegetable
+        - Compostable
+    - type: Construction
+      graph: RoastPotato
+      node: roastpotato
 - type: entity
   name: tomato
   parent: [FoodProduceBase, ItemHeftyBase]

+ 2 - 0
Resources/Prototypes/tags.yml

@@ -1426,3 +1426,5 @@
   id: Bridgeable
 - type: Tag
   id: Bridging
+- type: Tag
+  id: Compostable

+ 4 - 1
Resources/Textures/Objects/Specific/Hydroponics/potato.rsi/meta.json

@@ -16,6 +16,9 @@
         {
             "name": "produce"
         },
+        {
+            "name": "roastpotato"
+        },
         {
             "name": "seed"
         },
@@ -40,4 +43,4 @@
             "directions": 4
         }
     ]
-}
+}

BIN
Resources/Textures/Objects/Specific/Hydroponics/potato.rsi/roastpotato.png


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff