Skip to content

Commit

Permalink
make the craftsman do different recipe shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
jichi authored and jichi committed Dec 3, 2023
1 parent f66e5f1 commit 918833b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions working_villagers/jobs/baker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local furnaces = {
local bakables = {
fuel_names = {
["default:coalblock"] = 99,
["default:coal_lump"] = 99,
["bucket:bucket_lava"] = 99,
["default:lava_source"] = 99,
--["default:jungletree"] = 99,
Expand Down
16 changes: 14 additions & 2 deletions working_villagers/jobs/craftsman.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ local recipes = {
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal",},
{"default:mese_crystal", "default:mese_crystal", "default:mese_crystal",},
},
[2] = {
{"default:stone", "default:stone",},
{"default:stone", "default:stone",},
},
}

function recipe_requires(recipe, item_name, target_x, target_y)
Expand Down Expand Up @@ -309,9 +313,17 @@ function working_villages.villager:handle_craft_table(craft_table_pos, take_func
elseif CRAFT_TABLE_TYPE == "crafting_bench" then
list_name = "rec"
else assert(false) end
for x=1,3,1 do -- 3 x 3 = 9
for y=1,3,1 do
local recipe = recipes[iteration]
local nx = #recipe
--local xy = 0
--for x=1,3,1 do -- 3 x 3 = 9
for x=1,nx,1 do -- 3 x 3 = 9
local row = recipe[x]
local ny = #row
--for y=1,3,1 do
for y=1,ny,1 do
local xy = 3*(x-1)+y
--xy = xy + 1
index = index + 1
my_data.operations[index] = {
list = list_name,
Expand Down
1 change: 1 addition & 0 deletions working_villagers/jobs/guard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ working_villages.register_job("working_villages:job_guard", {
--TODO: walk randomly
self:count_timer("guard:change_dir")
if self:timer_exceeded("guard:change_dir",50) then
self:handle_obstacles(true)
self:change_direction_randomly()
end
end
Expand Down
2 changes: 2 additions & 0 deletions working_villagers/pathfinder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ local function get_neighbor_ground_level(pos, jump_height, fall_height)
end
end

-- TODO need to check for impassable entities

local function get_neighbors(current_pos, entity_height, entity_jump_height, entity_fear_height)
local neighbors = {}
local neighbors_index = 1
Expand Down

0 comments on commit 918833b

Please sign in to comment.