From 798c483052a1704ae5366adb2c18a598f20efc12 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Thu, 25 May 2017 21:44:53 -0400 Subject: [PATCH 1/5] Added Building Editor world with All crafters max level --- README.md | 7 +- .../building_editor_world.json | 136 ++++++++++++++++++ manifest.json | 1 + worlds/building_editor_world.lua | 46 ++++++ 4 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 data/data_driven_world/building_editor_world.json create mode 100644 worlds/building_editor_world.lua diff --git a/README.md b/README.md index 0069ff4..b9c5587 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ creates two workers, a stockpile, and some harvestable entities. For more information about Stonehearth, please visit http://stonehearth.net -  + Installing ---------- @@ -74,6 +74,9 @@ run the harvest\_test game world every time you run Stonehearth: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -  +Running Building Editor Mod +=========================== +Stonehearth.exe" --game.main_mod=microworld --mods.microworld.world=building_editor +   diff --git a/data/data_driven_world/building_editor_world.json b/data/data_driven_world/building_editor_world.json new file mode 100644 index 0000000..31c4c99 --- /dev/null +++ b/data/data_driven_world/building_editor_world.json @@ -0,0 +1,136 @@ +{ + "world" : { + "size" : 64, + "town_position" : { "x": 0, "z": 0 } + }, + + "entities" : [ + { + "alias" : "stonehearth:decoration:firepit", + + "position" : { + "x" : 0, + "z" : 11 + }, + + "requires_owner": true, + "full_size" : true + }, + + { + "alias" : "stonehearth:plants:berry_bush", + + "position" : { + "x" : 4, + "z" : 2 + }, + + "repeat" : { + "x" : 4, + "z" : 2 + }, + + "offset" : { + "x" : 4, + "z" : 4 + } + }, + + { + "alias" : "stonehearth:trees:oak:large", + + "position" : { + "x": -12, + "z" : -12 + } + }, + + { + "alias" : "stonehearth:trees:oak:medium", + + "position" : { + "x" : 14, + "z" : -1 + } + }, + + { + "alias" : "stonehearth:trees:oak:medium", + + "position" : { + "x" : 11, + "z" : 16 + } + }, + + { + "alias" : "stonehearth:trees:oak:small", + + "position" : { + "x" : -10, + "z" : 15 + } + }, + + { + "alias" : "stonehearth:red_fox", + + "position" : { + "x" : 2, + "z" : 2 + } + } + ], + + "citizens": [ + { + "position" : { + "x" : -2, + "z" : -2 + } + }, + + { + "position" : { + "x" : -2, + "z" : 1 + }, + + "carrying" : "stonehearth:resources:fiber:silkweed_bundle" + }, + + { + "position" : { + "x" : 1, + "z" : -2 + }, + + "carrying" : "stonehearth:trapper:talisman" + }, + + { + "position" : { + "x" : 1, + "z" : 1 + }, + + "carrying" : "stonehearth:carpenter:talisman" + }, + + { + "position" : { + "x" : 4, + "z" : -2 + } + }, + + { + "position" : { + "x" : 4, + "z" : 1 + }, + + "carrying" : "stonehearth:resources:wood:oak_log" + } + ] +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index aaa3385..8b9fe2c 100644 --- a/manifest.json +++ b/manifest.json @@ -8,6 +8,7 @@ "aliases" : { "data_driven:world:mini_game" : "file(data/data_driven_world/mini_game_world.json)", + "data_driven:world:building_editor" : "file(data/data_driven_world/building_editor_world.json)", "data_driven:world:harvest_test" : "file(data/data_driven_world/harvest_test_world.json)", "data_driven:world:profession_test" : "file(data/data_driven_world/profession_test_world.json)", "data_driven:world:equipment_test" : "file(data/data_driven_world/equipment_test_world.json)", diff --git a/worlds/building_editor_world.lua b/worlds/building_editor_world.lua new file mode 100644 index 0000000..0f23fa3 --- /dev/null +++ b/worlds/building_editor_world.lua @@ -0,0 +1,46 @@ +local MicroWorld = require 'micro_world' +local Point3 = _radiant.csg.Point3 + +local BuildingEditor = class(MicroWorld) + +function BuildingEditor:__init() + -- create a tiny world + self[MicroWorld]:__init(128) + self:create_world() + + local player_id = self:get_session().player_id + local pop = stonehearth.population:get_population(player_id) + + -- create a settlement with a banner and firepit + -- and 6 workers around the point(0,0) + local workers = self:create_settlement({ + carpenter = { + num = 1, + level = 6 + }, + potter = { + num = 1, + level = 6 + }, + mason = { + num = 1, + level = 6 + }, + blacksmith = { + num = 1, + level = 6 + }, + weaver = { + num = 1, + level = 6 + }, + engineer = { + num = 1, + level = 6 + } + }, 0, 0) + +end + +return BuildingEditor + From 19b38e44c7dc24cf1bc8dfd54033025512f15cc1 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Thu, 25 May 2017 21:46:35 -0400 Subject: [PATCH 2/5] typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9c5587..e7f32d2 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ run the harvest\_test game world every time you run Stonehearth: Running Building Editor Mod =========================== -Stonehearth.exe" --game.main_mod=microworld --mods.microworld.world=building_editor +Stonehearth.exe --game.main_mod=microworld --mods.microworld.world=building_editor   From 19647595e2855723643d547125f07955d2ffe0cf Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Thu, 25 May 2017 21:52:05 -0400 Subject: [PATCH 3/5] tabs to space --- README.md | 1 - manifest.json | 2 +- worlds/building_editor_world.lua | 46 ++++++++++++++++---------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e7f32d2..d69f8be 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ creates two workers, a stockpile, and some harvestable entities. For more information about Stonehearth, please visit http://stonehearth.net - Installing ---------- diff --git a/manifest.json b/manifest.json index 8b9fe2c..c65d777 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "aliases" : { "data_driven:world:mini_game" : "file(data/data_driven_world/mini_game_world.json)", - "data_driven:world:building_editor" : "file(data/data_driven_world/building_editor_world.json)", + "data_driven:world:building_editor" : "file(data/data_driven_world/building_editor_world.json)", "data_driven:world:harvest_test" : "file(data/data_driven_world/harvest_test_world.json)", "data_driven:world:profession_test" : "file(data/data_driven_world/profession_test_world.json)", "data_driven:world:equipment_test" : "file(data/data_driven_world/equipment_test_world.json)", diff --git a/worlds/building_editor_world.lua b/worlds/building_editor_world.lua index 0f23fa3..a9c6638 100644 --- a/worlds/building_editor_world.lua +++ b/worlds/building_editor_world.lua @@ -15,29 +15,29 @@ function BuildingEditor:__init() -- and 6 workers around the point(0,0) local workers = self:create_settlement({ carpenter = { - num = 1, - level = 6 - }, - potter = { - num = 1, - level = 6 - }, - mason = { - num = 1, - level = 6 - }, - blacksmith = { - num = 1, - level = 6 - }, - weaver = { - num = 1, - level = 6 - }, - engineer = { - num = 1, - level = 6 - } + num = 1, + level = 6 + }, + potter = { + num = 1, + level = 6 + }, + mason = { + num = 1, + level = 6 + }, + blacksmith = { + num = 1, + level = 6 + }, + weaver = { + num = 1, + level = 6 + }, + engineer = { + num = 1, + level = 6 + } }, 0, 0) end From 839add60871e0246ad043f45be3d0a79cbd8e483 Mon Sep 17 00:00:00 2001 From: nxor Date: Mon, 29 May 2017 21:37:43 -0400 Subject: [PATCH 4/5] add all furnitures --- micro_world.lua | 30 ++++++++++++++++++++++-------- worlds/building_editor_world.lua | 3 +++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/micro_world.lua b/micro_world.lua index f2129e5..0ef56eb 100644 --- a/micro_world.lua +++ b/micro_world.lua @@ -447,14 +447,12 @@ function MicroWorld:place_all_entities_passing_filter(player_id, x, z, filter_fn for uri in pairs(all_entities) do if filter_fn(uri) then - for i = 1, 4 do - -- place the entity into the world - self:place_item(uri, x, z, player_id) - x = (x + 1) % 8 - if x == 0 then - z = z + 1 - end - end + -- place the entity into the world + self:place_item(uri, x, z, player_id) + x = (x + 1) % 12 + if x == 0 then + z = z + 1 + end end end end @@ -471,6 +469,22 @@ local alias_is_equipment = function(uri) return false end +local alias_is_furniture = function(uri) + local json = radiant.resources.load_json(uri) + + if json['components'] ~= nil and + json['components']['stonehearth:entity_forms'] ~= nil then + return true + end + + return false +end + +--Place all furnitures in all the relevant mods in the test world +function MicroWorld:place_all_furnitures(player_id, x, z) + self:place_all_entities_passing_filter(player_id, x, z, alias_is_furniture) +end + --Place all the equipment in all the relevant mods in the test world function MicroWorld:place_all_combat_equipment(player_id, x, z) self:place_all_entities_passing_filter(player_id, x, z, alias_is_equipment) diff --git a/worlds/building_editor_world.lua b/worlds/building_editor_world.lua index a9c6638..44f6233 100644 --- a/worlds/building_editor_world.lua +++ b/worlds/building_editor_world.lua @@ -39,6 +39,9 @@ function BuildingEditor:__init() level = 6 } }, 0, 0) + + + self:place_all_furnitures(player_id, -30, 10) end From 51d5d12e9be9ef86bd7e9554e5d481341909dff9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Date: Thu, 25 Jan 2018 19:39:46 -0500 Subject: [PATCH 5/5] fix for A23 --- data/data_driven_world/building_editor_world.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/data_driven_world/building_editor_world.json b/data/data_driven_world/building_editor_world.json index 31c4c99..e1e92ce 100644 --- a/data/data_driven_world/building_editor_world.json +++ b/data/data_driven_world/building_editor_world.json @@ -1,7 +1,7 @@ { "world" : { - "size" : 64, - "town_position" : { "x": 0, "z": 0 } + "size" : 128, + "town_position" : { "x": 100, "z": 10 } }, "entities" : [