Parcourir la source

update block type config for new config schema

Kolja Strohm il y a 2 jours
Parent
commit
59f1a6a18d

+ 5 - 2
FactoryCraft/Animal.cpp

@@ -105,6 +105,9 @@ const char* AnimalEntityTypeFactory::getTypeToken() const
 JSONObjectValidationBuilder* AnimalEntityTypeFactory::addToValidator(
     JSONObjectValidationBuilder* builder) const
 {
-    return builder->withRequiredAttribute(
-        "ai", Game::INSTANCE->zTypeRegistry()->getValidator<AnimalAI>());
+    return builder
+        /* TODO: write AnimalAI factories
+        ->withRequiredAttribute(
+        "ai", Game::INSTANCE->zTypeRegistry()->getValidator<AnimalAI>())*/
+        ;
 }

+ 1 - 3
FactoryCraft/BlockType.h

@@ -230,9 +230,7 @@ public:
                     ->addAcceptedTypeInArray(Game::INSTANCE->zTypeRegistry()
                             ->getValidator<DropConfig>())
                     ->withDefault(defaultDrops)
-                    ->finishArray(),
-                false,
-                true);
+                    ->finishArray());
     }
 
 protected:

+ 1 - 0
FactoryCraft/TypeRegistry.cpp

@@ -135,6 +135,7 @@ TypeRegistry::TypeRegistry()
     registerSubType(new DropConditionNegationFactory());
     registerSubType(new DropUsedItemConditionFactory());
     registerSubType(new DropNoUsedItemConditionFactory());
+    registerSubType(new DropAllwaysConditionFactory());
 
     // drop configs
     registerSubType(new DefaultBlockItemDropFactory());

+ 141 - 66
Windows Version/data/blocks/blockTypes.json

@@ -1,22 +1,24 @@
 [
-    {
-        "type": "basicBlock",
-        "name": "Dirt",
-        "itemType": "Dirt",
-        "model": {
-            "modelPath": "cube",
-            "texturePaths": [
-                "blocks.ltdb/dirt.png",
-                "blocks.ltdb/dirt.png",
-                "blocks.ltdb/dirt.png",
-                "blocks.ltdb/dirt.png",
-                "blocks.ltdb/lawn.png",
-                "blocks.ltdb/dirt.png"
-            ]
-        },
-        "mapColor": "0xFF3C7C29",
-        "groupNames": [ "Shovel" ]
+  {
+    "type": "basicBlock",
+    "name": "Dirt",
+    "itemType": "Dirt",
+    "model": {
+      "modelPath": "cube",
+      "texturePaths": [
+        "blocks.ltdb/dirt.png",
+        "blocks.ltdb/dirt.png",
+        "blocks.ltdb/dirt.png",
+        "blocks.ltdb/dirt.png",
+        "blocks.ltdb/lawn.png",
+        "blocks.ltdb/dirt.png"
+      ]
     },
+    "mapColor": "0xFF3C7C29",
+    "groupNames": [
+      "Shovel"
+    ]
+  },
   {
     "type": "basicBlock",
     "name": "Stone",
@@ -52,7 +54,9 @@
     },
     "mapColor": "0xFFAE8558",
     "hardness": 0.5,
-    "groupNames": [ "Shovel" ]
+    "groupNames": [
+      "Shovel"
+    ]
   },
   {
     "type": "basicBlock",
@@ -71,10 +75,12 @@
     },
     "mapColor": "0xFF7F7A70",
     "hardness": 1.5,
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
-    "type": "additionalItemsBlockType",
+    "type": "basicBlock",
     "name": "Oak Wood Leaves",
     "itemType": "Oak Wood Leaves",
     "model": {
@@ -90,12 +96,15 @@
     },
     "mapColor": "0xFF6A7C37",
     "hardness": 0.1,
-    "spawns": [
+    "drops": [
       {
-        "min": 1,
-        "max": 1,
-        "itemType": "Oak Wood Sapling",
-        "chance": 0.015
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.015
+        },
+        "amount": 1,
+        "itemType": "Oak Wood Sapling"
       }
     ],
     "groupNames": [
@@ -119,7 +128,9 @@
     },
     "mapColor": "0xFF928D8C",
     "hardness": 0.75,
-    "groupNames": [ "Shovel" ]
+    "groupNames": [
+      "Shovel"
+    ]
   },
   {
     "type": "basicBlock",
@@ -173,10 +184,12 @@
     },
     "mapColor": "0xFF99999D",
     "hardness": 1.5,
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
-    "type": "additionalItemsBlockType",
+    "type": "basicBlock",
     "name": "Birch Wood Leaves",
     "itemType": "Birch Wood Leaves",
     "model": {
@@ -192,12 +205,15 @@
     },
     "mapColor": "0xFF6A7C37",
     "hardness": 0.1,
-    "spawns": [
+    "drops": [
       {
-        "min": 1,
-        "max": 1,
-        "itemType": "Birch Wood Sapling",
-        "chance": 0.03
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.03
+        },
+        "amount": 1,
+        "itemType": "Birch Wood Sapling"
       }
     ],
     "groupNames": [
@@ -221,10 +237,12 @@
     },
     "mapColor": "0xFF778172",
     "hardness": 1.5,
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
-    "type": "additionalItemsBlockType",
+    "type": "basicBlock",
     "name": "Beech Wood Leaves",
     "itemType": "Beech Wood Leaves",
     "model": {
@@ -240,12 +258,15 @@
     },
     "mapColor": "0xFF6A7C37",
     "hardness": 0.1,
-    "spawns": [
+    "drops": [
       {
-        "min": 1,
-        "max": 1,
-        "itemType": "Beech Wood Sapling",
-        "chance": 0.02
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.02
+        },
+        "amount": 1,
+        "itemType": "Beech Wood Sapling"
       }
     ],
     "groupNames": [
@@ -287,10 +308,12 @@
     },
     "mapColor": "0xFF786C72",
     "hardness": 1.4,
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
-    "type": "additionalItemsBlockType",
+    "type": "basicBlock",
     "name": "Pine Wood Leaves",
     "itemType": "Pine Wood Leaves",
     "model": {
@@ -306,12 +329,15 @@
     },
     "mapColor": "0xFF6A7C37",
     "hardness": 0.1,
-    "spawns": [
+    "drops": [
       {
-        "min": 1,
-        "max": 1,
-        "itemType": "Pine Wood Sapling",
-        "chance": 0.025
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.025
+        },
+        "amount": 1,
+        "itemType": "Pine Wood Sapling"
       }
     ],
     "groupNames": [
@@ -336,7 +362,9 @@
     "mapColor": "0x00F69A54",
     "lightColor": "0x00F69A54",
     "hardness": 0,
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "treeSapling",
@@ -352,7 +380,9 @@
     "hardness": 0.1,
     "woodType": "Oak Wood",
     "leavesType": "Oak Wood Leaves",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "treeSapling",
@@ -368,7 +398,9 @@
     "hardness": 0.1,
     "woodType": "Birch Wood",
     "leavesType": "Birch Wood Leaves",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "treeSapling",
@@ -384,7 +416,9 @@
     "hardness": 0.1,
     "woodType": "Beech Wood",
     "leavesType": "Beech Wood Leaves",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "treeSapling",
@@ -400,7 +434,9 @@
     "hardness": 0.1,
     "woodType": "Pine Wood",
     "leavesType": "Pine Wood Leaves",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "grass",
@@ -417,12 +453,15 @@
     "passable": true,
     "speedModifier": 0.5,
     "mapColor": "0x5076C011",
-    "spawns": [
+    "drops": [
       {
-        "min": 1,
-        "max": 1,
-        "itemType": "Wheat Seeds",
-        "chance": 0.1
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.1
+        },
+        "amount": 1,
+        "itemType": "Wheat Seeds"
       }
     ]
   },
@@ -443,7 +482,9 @@
     },
     "mapColor": "0xFF5E3819",
     "hardness": 0.1,
-    "groupNames": [ "Shovel" ]
+    "groupNames": [
+      "Shovel"
+    ]
   },
   {
     "type": "growingPlant",
@@ -504,7 +545,7 @@
     ]
   },
   {
-    "type": "additionalItemsBlockType",
+    "type": "basicBlock",
     "name": "Wheat",
     "itemType": null,
     "model": {
@@ -514,12 +555,42 @@
       ]
     },
     "mapColor": "0x90A8C011",
-    "spawns": [
+    "drops": [
+      {
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.6
+        },
+        "amount": 1,
+        "itemType": "Wheat"
+      },
+      {
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.6
+        },
+        "amount": 1,
+        "itemType": "Wheat"
+      },
       {
-        "min": 0,
-        "max": 4,
-        "itemType": "Wheat",
-        "chance": 1.0
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.6
+        },
+        "amount": 1,
+        "itemType": "Wheat"
+      },
+      {
+        "type": "specificItem",
+        "condition": {
+          "type": "chance",
+          "chance": 0.6
+        },
+        "amount": 1,
+        "itemType": "Wheat"
       }
     ]
   },
@@ -563,7 +634,9 @@
       ]
     },
     "mapColor": "0xFFC4A783",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   },
   {
     "type": "chest",
@@ -577,6 +650,8 @@
       ]
     },
     "mapColor": "0xFFE2C292",
-    "groupNames": [ "Wood" ]
+    "groupNames": [
+      "Wood"
+    ]
   }
 ]