Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lmaddox committed Dec 12, 2023
1 parent 55a7604 commit 3de93b6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 12 deletions.
3 changes: 3 additions & 0 deletions TODO.MD
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ some appliances don't set a facedir, requiring specific facings for the huts

appliance-handling bots' find_node() methods should find all nodes and distinguish between active/inactive nodes
so e.g., composter, wafflemaker, etc., can juggle multiple appliances


deduplicate strings -- job tasks have cross-cutting features and the associated strings should be in one place
31 changes: 26 additions & 5 deletions working_villagers/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

local log = working_villages.require("log")
local cmnp = modutil.require("check_prefix","venus")
local colors = working_villages.require("jobs/dyemixer_recipes").colors
assert(#colors > 0)

working_villages.animation_frames = {
STAND = { x= 0, y= 79, },
Expand Down Expand Up @@ -1016,6 +1018,25 @@ function working_villages.register_villager(product_name, def)
working_villages.manufacturing_data[name] = working_villages.manufacturing_data[name] + 1
create_inventory(self)

-- birthday
self.dob = minetest.get_day_count()
self.tod = minetest.get_timeofday()
self.day_count = minetest.get_day_count()

-- favorite color
self.fave_color = colors[math.random(#colors)]
assert(self.fave_color ~= nil)

-- randomized name
if minetest.get_modpath("getname") then
-- TODO get gender
--getname.masculineName()
--getname.feminineName()
self.nametag = getname.genderlessName()
-- TODO family names
-- TODO now that we've got a "username," we can register with HB-type mods
end

-- attach dummy item to new villager.
minetest.add_entity(self.object:get_pos(), "working_villages:dummy_item")
else
Expand All @@ -1030,11 +1051,11 @@ function working_villages.register_villager(product_name, def)
self.job_data = data["job_data"]
self.state_info = data["state_info"]
self.pos_data = data["pos_data"]
self.dob = minetest.get_day_count()
self.tod = minetest.get_timeofday()
self.day_count = minetest.get_day_count()
-- TODO favorite color
-- TODO
-- personality
self.dob = data["dob"]
self.tod = data["tod"]
self.day_count = data["day_count"]
self.fave_color = data["fave_color"]

local inventory = create_inventory(self)
for list_name, list in pairs(data["inventory"]) do
Expand Down
6 changes: 0 additions & 6 deletions working_villagers/jobs/dyemixer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ local function take_target(villager,stack)--,data,iteration)
return (inv:room_for_item("main", stack))
end

local colors = {
"red", "blue", "cyan", "grey", "pink", "black",
"brown", "green", "white", "orange", "violet", "yellow",
"magenta", "dark_grey", "dark_green",
}


working_villages.register_job("working_villages:job_dyemixer", {
description = "dyemixer (working_villages)",
Expand Down
8 changes: 8 additions & 0 deletions working_villagers/jobs/dyemixer_recipes.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
local dyemixer_recipes = {}
local S = minetest.get_translator("working_villages")

local colors = {
"red", "blue", "cyan", "grey", "pink", "black",
"brown", "green", "white", "orange", "violet", "yellow",
"magenta", "dark_grey", "dark_green",
}
dyemixer_recipes.colors = colors


-- TODO write a dependency management system
function dyemixer_recipes.update_color_plan(self, target_color)
assert(self ~= nil)
Expand Down
2 changes: 1 addition & 1 deletion working_villagers/mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = working_villages
description = A mod adding villager NPCs that are doing predefined work. Big features are planned.
depends = default
optional_depends = areas,doors,beds,modutil, mcg_lockworkshop,fakery,mcg_dyemixer,crafting_bench,decraft,iadiscordia, basic_materials,biofuel,claycrafter,composting,decraft,sleeping_mat, wine,farming,snowcone,waffles,church_candles
optional_depends = areas,doors,beds,modutil, mcg_lockworkshop,fakery,mcg_dyemixer,crafting_bench,decraft,iadiscordia, basic_materials,biofuel,claycrafter,composting,decraft,sleeping_mat, wine,farming,snowcone,waffles,church_candles, getname
13 changes: 13 additions & 0 deletions working_villagers/talking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ end)
forms.put_link("working_villages:talking_menu", "working_villages:current_time",
"What time is it?")

forms.register_text_page("working_villages:fave_color",
function(villager)
assert(villager ~= nil)
local color = villager.fave_color
if color == nil then
return "I don't have a preference."
end
return "My favorite color is "..color
end)

forms.put_link("working_villages:talking_menu", "working_villages:fave_color",
"What's your favorite color?")

-- TODO where do you live/work -- how to get there
-- TODO Who's your daddy and what does he do
-- TODO what do you need to do your job -- ie in general & rn specifically
Expand Down

0 comments on commit 3de93b6

Please sign in to comment.