Compare commits

...

18 Commits

Author SHA1 Message Date
tchncs 876ff2de08 Merge https://github.com/Sokomine/cottages into HEAD 2021-09-10 19:54:17 +02:00
Sokomine 2b10e6f679 fixed tree well 2021-06-16 19:09:11 +02:00
Sokomine 1afe904303 added cottages.forbid_repair to allow forbidding some tools from beeing repaired 2021-02-24 02:28:59 +01:00
Sokomine 3dec7bf200 fixed bug with hud removal 2021-02-23 23:26:53 +01:00
Sokomine 8cfaaed308 added listring to shelf 2020-10-02 01:46:32 +02:00
Milan 30b8ef7e96 Merge branch 'master' of https://git.tchncs.de/Illuna-Minetest/cottages into HEAD 2020-02-29 16:25:13 +01:00
Milan a9d2b71c6a damn you wsl 2020-02-29 16:25:05 +01:00
Milan 4eb2a3bee3 merge upstream 2020-02-28 17:40:14 +01:00
Milan 226480f1d2 what 2020-02-28 17:37:21 +01:00
Milan* 58876b5f57 anvil: fix can_dig function 2017-10-25 16:25:02 +02:00
Milan* cab2825e4c remove ownership from anvil 2017-10-25 15:59:49 +02:00
tchncs e40a4ee838 add negative falldamage to strawnodes 2016-06-23 19:04:49 +02:00
tchncs 1ba43a7a07 add alternate recipe for cottages:hatch_wood (fixes #1) 2016-05-15 22:20:23 +02:00
tchncs 9d304979fd re-add glass panes and change the recipe 2016-01-14 13:29:39 +01:00
tchncs a3b9d01cf8 solved xdecor conflict the unclean way 2016-01-14 12:54:26 +01:00
tchncs 027d4296fa change scale of items in anvil 2015-12-15 17:19:50 +01:00
coeseta e49b72e138 anvil now has its own texture :) 2015-12-15 15:36:24 +01:00
tchncs 582b86f050 change anvil progressbar colors 2015-12-15 12:47:27 +01:00
49 changed files with 98 additions and 53 deletions

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
adaptions.lua Normal file → Executable file
View File

0
alias.lua Normal file → Executable file
View File

0
depends.txt Normal file → Executable file
View File

0
init.lua Normal file → Executable file
View File

0
locale/de.txt Normal file → Executable file
View File

0
locale/template.txt Normal file → Executable file
View File

0
models/cottages_barrel.obj Normal file → Executable file
View File

0
models/cottages_barrel_closed.obj Normal file → Executable file
View File

0
models/cottages_barrel_closed_lying.obj Normal file → Executable file
View File

0
models/cottages_barrel_lying.obj Normal file → Executable file
View File

0
models/cottages_handmill.obj Normal file → Executable file
View File

0
models/cottages_tub.obj Normal file → Executable file
View File

82
nodes_anvil.lua Normal file → Executable file
View File

@ -9,6 +9,12 @@
local S = cottages.S local S = cottages.S
-- disable repair with anvil by setting a message for the item in question
cottages.forbid_repair = {}
-- example for hammer no longer beeing able to repair the hammer
--cottages.forbid_repair["cottages:hammer"] = 'The hammer is too complex for repairing.'
-- the hammer for the anvil -- the hammer for the anvil
minetest.register_tool("cottages:hammer", { minetest.register_tool("cottages:hammer", {
description = S("Steel hammer for repairing tools on the anvil"), description = S("Steel hammer for repairing tools on the anvil"),
@ -51,7 +57,7 @@ local cottages_anvil_formspec =
minetest.register_node("cottages:anvil", { minetest.register_node("cottages:anvil", {
drawtype = "nodebox", drawtype = "nodebox",
description = S("anvil"), description = S("anvil"),
tiles = {"cottages_stone.png"}, -- TODO default_steel_block.png, default_obsidian.png are also nice tiles = {"cottages_anvil.png"}, -- TODO default_steel_block.png, default_obsidian.png are also nice
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=2}, groups = {cracky=2},
@ -86,46 +92,48 @@ minetest.register_node("cottages:anvil", {
meta:set_string("formspec", cottages_anvil_formspec ); meta:set_string("formspec", cottages_anvil_formspec );
end, end,
after_place_node = function(pos, placer) --after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos); --local meta = minetest.get_meta(pos);
meta:set_string("owner", placer:get_player_name() or ""); --meta:set_string("owner", placer:get_player_name() or "");
meta:set_string("infotext", S("Anvil (owned by %s)"):format((meta:get_string("owner") or ""))); --meta:set_string("infotext", S("Anvil (owned by %s)"):format((meta:get_string("owner") or "")));
meta:set_string("formspec", -- meta:set_string("formspec",
cottages_anvil_formspec, -- cottages_anvil_formspec,
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"); -- "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]");
end, --end,
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory(); local inv = meta:get_inventory();
local owner = meta:get_string('owner'); -- local owner = meta:get_string('owner');
if( not( inv:is_empty("input")) if( not( inv:is_empty("input"))
-- or not( inv:is_empty("material")) -- or not( inv:is_empty("material"))
-- or not( inv:is_empty("sample")) -- or not( inv:is_empty("sample"))
or not( inv:is_empty("hammer")) or not( inv:is_empty("hammer")))
or not( player ) -- or not( player )
or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then -- or ( owner and owner ~= '' and player:get_player_name() ~= owner ))]] then
then
return false; return false;
end end
return true; return true
end, end,
-- return true;
-- end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if( player and player:get_player_name() ~= meta:get_string('owner' ) and from_list~="input") then --if( player and player:get_player_name() ~= meta:get_string('owner' ) and from_list~="input") then
return 0 -- return 0
end --end
return count; return count;
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then --[[if( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then
return 0; return 0;
end end]]
if( listname=='hammer' and stack and stack:get_name() ~= 'cottages:hammer') then if( listname=='hammer' and stack and stack:get_name() ~= 'cottages:hammer') then
return 0; return 0;
end end
@ -138,14 +146,20 @@ minetest.register_node("cottages:anvil", {
S('The workpiece slot is for damaged tools only.')); S('The workpiece slot is for damaged tools only.'));
return 0; return 0;
end end
if( listname=='input'
and cottages.forbid_repair[ stack:get_name() ]) then
minetest.chat_send_player( player:get_player_name(),
S(cottages.forbid_repair[ stack:get_name() ]));
return 0;
end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then --[[if( player and player:get_player_name() ~= meta:get_string('owner' ) and listname~="input") then
return 0 return 0
end end]]
return stack:get_count() return stack:get_count()
end, end,
@ -172,15 +186,23 @@ minetest.register_node("cottages:anvil", {
or input:get_name() == "technic:water_can" or input:get_name() == "technic:water_can"
or input:get_name() == "technic:lava_can" ) then or input:get_name() == "technic:lava_can" ) then
meta:set_string("formspec", --[[meta:set_string("formspec",
cottages_anvil_formspec, cottages_anvil_formspec,
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"); "label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]");
return; return;]]
end end
-- 65535 is max damage -- 65535 is max damage
local damage_state = 40-math.floor(input:get_wear()/1638); local damage_state = 40-math.floor(input:get_wear()/1638);
-- just to make sure that it really can't get repaired if it should not
-- (if the check of placing the item in the input slot failed somehow)
if( puncher and name and cottages.forbid_repair[ input:get_name() ]) then
minetest.chat_send_player( name,
S(cottages.forbid_repair[ input:get_name() ]));
return;
end
local tool_name = input:get_name(); local tool_name = input:get_name();
local hud_image = ""; local hud_image = "";
if( tool_name if( tool_name
@ -198,7 +220,7 @@ minetest.register_node("cottages:anvil", {
local hud1 = puncher:hud_add({ local hud1 = puncher:hud_add({
hud_elem_type = "image", hud_elem_type = "image",
scale = {x = 15, y = 15}, scale = {x = 8, y = 8},
text = hud_image, text = hud_image,
position = {x = 0.5, y = 0.5}, position = {x = 0.5, y = 0.5},
alignment = {x = 0, y = 0} alignment = {x = 0, y = 0}
@ -208,7 +230,7 @@ minetest.register_node("cottages:anvil", {
if( input:get_wear()>0 ) then if( input:get_wear()>0 ) then
hud2 = puncher:hud_add({ hud2 = puncher:hud_add({
hud_elem_type = "statbar", hud_elem_type = "statbar",
text = "default_cloud.png^[colorize:#ff0000:256", text = "default_cloud.png^[colorize:#4A4A4A:256",
number = 40, number = 40,
direction = 0, -- left to right direction = 0, -- left to right
position = {x=0.5, y=0.65}, position = {x=0.5, y=0.65},
@ -218,7 +240,7 @@ minetest.register_node("cottages:anvil", {
}) })
hud3 = puncher:hud_add({ hud3 = puncher:hud_add({
hud_elem_type = "statbar", hud_elem_type = "statbar",
text = "default_cloud.png^[colorize:#00ff00:256", text = "default_cloud.png^[colorize:#6499FF:256",
number = damage_state, number = damage_state,
direction = 0, -- left to right direction = 0, -- left to right
position = {x=0.5, y=0.65}, position = {x=0.5, y=0.65},
@ -229,9 +251,9 @@ minetest.register_node("cottages:anvil", {
end end
minetest.after(2, function() minetest.after(2, function()
if( puncher ) then if( puncher ) then
puncher:hud_remove(hud1); if(hud1) then puncher:hud_remove(hud1); end
puncher:hud_remove(hud2); if(hud2) then puncher:hud_remove(hud2); end
puncher:hud_remove(hud3); if(hud3) then puncher:hud_remove(hud3); end
end end
end) end)

0
nodes_barrel.lua Normal file → Executable file
View File

0
nodes_chests.lua Normal file → Executable file
View File

8
nodes_doorlike.lua Normal file → Executable file
View File

@ -435,3 +435,11 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "cottages:hatch_wood",
recipe = {
{"","","stairs:slab_wood"},
{"stairs:slab_wood","default:stick",""},
{"","",""},
}
})

0
nodes_fences.lua Normal file → Executable file
View File

5
nodes_furniture.lua Normal file → Executable file
View File

@ -264,10 +264,13 @@ minetest.register_node("cottages:shelf", {
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
meta:set_string("formspec", meta:set_string("formspec",
"size[8,8]".. "size[8,8]"..
"list[current_name;main;0,0;8,3;]".. "list[current_name;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]") "list[current_player;main;0,4;8,4;]"..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]")
meta:set_string("infotext", S("open storage shelf")) meta:set_string("infotext", S("open storage shelf"))
local inv = meta:get_inventory(); local inv = meta:get_inventory();
inv:set_size("main", 24); inv:set_size("main", 24);

8
nodes_historic.lua Normal file → Executable file
View File

@ -229,11 +229,11 @@ minetest.register_craft({
}) })
minetest.register_craft({ minetest.register_craft({
output = "cottages:glass_pane 4", output = "cottages:glass_pane 12",
recipe = { recipe = {
{cottages.craftitem_stick, cottages.craftitem_stick, cottages.craftitem_stick }, {"default:glass","default:glass","default:glass" },
{cottages.craftitem_stick, cottages.craftitem_glass, cottages.craftitem_stick }, {"default:glass","default:glass","default:glass" },
{cottages.craftitem_stick, cottages.craftitem_stick, cottages.craftitem_stick } {"default:glass","default:glass","default:glass" }
} }
}) })

0
nodes_roof.lua Normal file → Executable file
View File

14
nodes_straw.lua Normal file → Executable file
View File

@ -333,13 +333,13 @@ minetest.register_node("cottages:threshing_floor", {
minetest.after(2, function() minetest.after(2, function()
if( puncher ) then if( puncher ) then
puncher:hud_remove(hud1); if(hud1) then puncher:hud_remove(hud1); end
puncher:hud_remove(hud2); if(hud2) then puncher:hud_remove(hud2); end
puncher:hud_remove(hud3); if(hud3) then puncher:hud_remove(hud3); end
puncher:hud_remove(hud4); if(hud4) then puncher:hud_remove(hud4); end
puncher:hud_remove(hud5); if(hud5) then puncher:hud_remove(hud5); end
puncher:hud_remove(hud6); if(hud6) then puncher:hud_remove(hud6); end
puncher:hud_remove(hud0); if(hud0) then puncher:hud_remove(hud0); end
end end
end) end)
end, end,

View File

@ -117,7 +117,7 @@ minetest.register_node("cottages:water_gen", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, groups = {tree = 1, choppy = 2, cracky = 1, flammable = 2},
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -178,8 +178,14 @@ minetest.register_node("cottages:water_gen", {
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") and local bucket = meta:get_string("bucket")
default.can_interact_with_node(player, pos) local start = meta:get_string("fillstarttime")
return inv:is_empty("main")
and default.can_interact_with_node(player, pos)
and (not(bucket) or bucket == "")
and ((not(start) or start == "" or
(minetest.get_us_time()/1000000) - tonumber(start)
>= cottages.water_fill_time -2))
end, end,
-- no inventory move allowed -- no inventory move allowed
allow_metadata_inventory_move = function(pos, from_list, from_index, allow_metadata_inventory_move = function(pos, from_list, from_index,
@ -213,7 +219,7 @@ minetest.register_node("cottages:water_gen", {
cottages.switch_public(pos, formname, fields, sender, 'tree trunk well') cottages.switch_public(pos, formname, fields, sender, 'tree trunk well')
end, end,
-- punch to place and retrieve bucket -- punch to place and retrieve bucket
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher, pointed_thing)
if( not( pos ) or not( node ) or not( puncher )) then if( not( pos ) or not( node ) or not( puncher )) then
return return
end end
@ -223,7 +229,8 @@ minetest.register_node("cottages:water_gen", {
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local public = meta:get_string("public") local public = meta:get_string("public")
if( name ~= owner and public~="public") then if( name ~= owner and public~="public") then
minetest.chat_send_player( name, S("This tree trunk well is owned by %s. You can't use it."):format(name)) minetest.chat_send_player( name,
S("This tree trunk well is owned by %s. You can't use it."):format(owner))
return return
end end
@ -233,13 +240,18 @@ minetest.register_node("cottages:water_gen", {
-- is the well working on something? (either empty or full bucket) -- is the well working on something? (either empty or full bucket)
local bucket = meta:get_string("bucket") local bucket = meta:get_string("bucket")
-- there is a bucket loaded - either empty or full -- there is a bucket loaded - either empty or full
if( bucket and bucket~="") then if( bucket and bucket~="" and bucket ~= "bucket:bucket_empty") then
if( not(pinv:room_for_item("main", bucket))) then if( not(pinv:room_for_item("main", bucket))) then
minetest.chat_send_player( puncher:get_player_name(), minetest.chat_send_player( puncher:get_player_name(),
S("Sorry. You have no room for the bucket. Please free some ".. S("Sorry. You have no room for the bucket. Please free some "..
"space in your inventory first!")) "space in your inventory first!"))
return return
end end
elseif( bucket and bucket == "bucket:bucket_empty") then
minetest.chat_send_player( puncher:get_player_name(),
S("Please wait until your bucket has been filled."))
-- do not give the empty bucket back immediately
return
end end
-- remove the old entity (either a bucket will be placed now or a bucket taken) -- remove the old entity (either a bucket will be placed now or a bucket taken)
@ -267,8 +279,6 @@ minetest.register_node("cottages:water_gen", {
if( wielded if( wielded
and wielded:get_name() and wielded:get_name()
and wielded:get_name() == "bucket:bucket_empty") then and wielded:get_name() == "bucket:bucket_empty") then
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
-- remember that we got a bucket loaded -- remember that we got a bucket loaded
meta:set_string("bucket", "bucket:bucket_empty") meta:set_string("bucket", "bucket:bucket_empty")
-- create the entity -- create the entity
@ -280,6 +290,8 @@ minetest.register_node("cottages:water_gen", {
minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos) minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos)
-- the bucket will only be filled if the water ran long enough -- the bucket will only be filled if the water ran long enough
meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000)) meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000))
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
return; return;
end end
-- buckets can also be emptied here -- buckets can also be emptied here

0
textures/cottages_barrel.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
textures/cottages_beds_bed_side.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 536 B

After

Width:  |  Height:  |  Size: 536 B

0
textures/cottages_beds_bed_side_top_l.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 500 B

0
textures/cottages_beds_bed_side_top_r.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

0
textures/cottages_beds_bed_top_bottom.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 633 B

0
textures/cottages_beds_bed_top_top.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 605 B

0
textures/cottages_clay.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 272 B

0
textures/cottages_darkage_straw.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 852 B

0
textures/cottages_darkage_straw_bale.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

0
textures/cottages_feldweg.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 750 B

0
textures/cottages_glass_pane.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 975 B

After

Width:  |  Height:  |  Size: 975 B

0
textures/cottages_homedecor_shingles_asphalt.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 671 B

0
textures/cottages_homedecor_shingles_terracotta.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

0
textures/cottages_homedecor_shingles_wood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 567 B

0
textures/cottages_junglewood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

0
textures/cottages_loam.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

0
textures/cottages_minimal_wood.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
textures/cottages_reet.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 791 B

0
textures/cottages_slate.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

0
textures/cottages_sleepingmat.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

0
textures/cottages_steel_block.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

0
textures/cottages_stone.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

0
textures/cottages_wagonwheel.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

0
textures/cottages_wool.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

0
textures/glooptest_tool_steelhammer.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 184 B