add cottages mod, add rabbits, add building schematics from random_buildings mod, bug fixes
|
@ -1,4 +1,3 @@
|
|||
|
||||
minetest.register_privilege("immortal",
|
||||
{description = "Makes player semi-immortal, not subject to energy or hunger, etc...",give_to_singleplayer = false}
|
||||
)
|
|
@ -198,7 +198,8 @@ function dump_bones(pos)
|
|||
end
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
if minetest.setting_getbool("creative_mode") or minetest.check_player_privs(player:get_player_name(),{immortal=true}) then
|
||||
player:set_hp(20)
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
minetest.register_alias("random_buildings:roof", "cottages:roof_wood");
|
||||
minetest.register_alias("random_buildings:roof_connector", "cottages:roof_connector_wood");
|
||||
minetest.register_alias("random_buildings:roof_flat", "cottages:roof_flat_wood");
|
||||
minetest.register_alias("random_buildings:roof_wood", "cottages:roof_wood");
|
||||
minetest.register_alias("random_buildings:roof_connector_wood", "cottages:roof_connector_wood");
|
||||
minetest.register_alias("random_buildings:roof_flat_wood", "cottages:roof_flat_wood");
|
||||
minetest.register_alias("random_buildings:roof_straw", "cottages:roof_straw");
|
||||
minetest.register_alias("random_buildings:roof_connector_straw", "cottages:roof_connector_straw");
|
||||
minetest.register_alias("random_buildings:roof_flat_straw", "cottages:roof_flat_straw");
|
||||
minetest.register_alias("random_buildings:barrel", "cottages:barrel");
|
||||
minetest.register_alias("random_buildings:barrel_open", "cottages:barrel_open");
|
||||
minetest.register_alias("random_buildings:barrel_lying", "cottages:barrel_lying");
|
||||
minetest.register_alias("random_buildings:barrel_lying_open", "cottages:barrel_lying_open");
|
||||
minetest.register_alias("random_buildings:tub", "cottages:tub");
|
||||
minetest.register_alias("random_buildings:window_shutter_open", "cottages:window_shutter_open");
|
||||
minetest.register_alias("random_buildings:window_shutter_closed", "cottages:window_shutter_closed");
|
||||
minetest.register_alias("random_buildings:half_door", "cottages:half_door");
|
||||
minetest.register_alias("random_buildings:half_door_inverted", "cottages:half_door_inverted");
|
||||
minetest.register_alias("random_buildings:gate_closed", "cottages:gate_closed");
|
||||
minetest.register_alias("random_buildings:gate_open", "cottages:gate_open");
|
||||
minetest.register_alias("random_buildings:bed_foot", "cottages:bed_foot");
|
||||
minetest.register_alias("random_buildings:bed_head", "cottages:bed_head");
|
||||
minetest.register_alias("random_buildings:sleeping_mat", "cottages:sleeping_mat");
|
||||
minetest.register_alias("random_buildings:loam", "cottages:loam");
|
||||
minetest.register_alias("random_buildings:bench", "cottages:bench");
|
||||
minetest.register_alias("random_buildings:table", "cottages:table");
|
||||
minetest.register_alias("random_buildings:shelf", "cottages:shelf");
|
||||
minetest.register_alias("random_buildings:stovepipe", "cottages:stovepipe");
|
||||
minetest.register_alias("random_buildings:washing", "cottages:washing");
|
||||
minetest.register_alias("random_buildings:wagon_wheel", "cottages:wagon_wheel");
|
||||
minetest.register_alias("random_buildings:feldweg", "cottages:feldweg");
|
||||
minetest.register_alias("random_buildings:straw_ground", "cottages:straw_ground");
|
||||
minetest.register_alias("random_buildings:glass_pane", "cottages:glass_pane");
|
||||
minetest.register_alias("random_buildings:straw_mat", "cottages:straw_mat");
|
||||
minetest.register_alias("random_buildings:straw_bale", "cottages:straw_bale");
|
||||
minetest.register_alias("random_buildings:straw", "cottages:straw");
|
||||
minetest.register_alias("random_buildings:chest_private", "cottages:chest_private");
|
||||
minetest.register_alias("random_buildings:chest_work", "cottages:chest_work");
|
||||
minetest.register_alias("random_buildings:chest_storage", "cottages:chest_storage");
|
|
@ -0,0 +1,5 @@
|
|||
default
|
||||
farming
|
||||
stairs?
|
||||
homedecor?
|
||||
intllib?
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
-- Version: 2.0
|
||||
-- Autor: Sokomine
|
||||
-- License: GPLv3
|
||||
--
|
||||
-- Modified:
|
||||
-- 23.01.14 Added conversion receipes in case of installed castle-mod (has its own anvil)
|
||||
-- 23.01.14 Added hammer and anvil as decoration and for repairing tools.
|
||||
-- Added hatches (wood and steel).
|
||||
-- Changed the texture of the fence/handrail.
|
||||
-- 17.01.13 Added alternate receipe for fences in case of interference due to xfences
|
||||
-- 14.01.13 Added alternate receipes for roof parts in case homedecor is not installed.
|
||||
-- Added receipe for stove pipe, tub and barrel.
|
||||
-- Added stairs/slabs for dirt road, loam and clay
|
||||
-- Added fence_small, fence_corner and fence_end, which are useful as handrails and fences
|
||||
-- If two or more window shutters are placed above each other, they will now all close/open simultaneously.
|
||||
-- Added threshing floor.
|
||||
-- Added hand-driven mill.
|
||||
|
||||
cottages = {}
|
||||
|
||||
-- uncomment parts you do not want
|
||||
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_furniture.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_historic.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_straw.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_anvil.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_doorlike.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_fences.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_roof.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_barrel.lua");
|
||||
dofile(minetest.get_modpath("cottages").."/nodes_chests.lua");
|
||||
|
||||
-- this is only required and useful if you run versions of the random_buildings mod where the nodes where defined inside that mod
|
||||
dofile(minetest.get_modpath("cottages").."/alias.lua");
|
|
@ -0,0 +1,130 @@
|
|||
# Translation by Xanthin
|
||||
|
||||
### alias.lua ###
|
||||
|
||||
### init.lua ###
|
||||
|
||||
### nodes_anvil.lua ###
|
||||
Steel hammer for repairing tools on the anvil = Stahlhammer um Werkzeuge auf dem Amboss zu reparieren
|
||||
anvil = Amboss
|
||||
Anvil = Amboss
|
||||
The workpiece slot is for damaged tools only. = Das Werkstueckfeld gilt nur fuer beschaedigtes Werkzeug.
|
||||
Your tool has been repaired successfully. = Dein Werkzeug wurde erfolgreich repariert.
|
||||
Your workpiece improves. = Dein Werkstueck verbessert sich.
|
||||
Anvil (owned by %s) = Amboss (gehoert %s)
|
||||
Workpiece: = Werkstueck
|
||||
Optional = Moegliche
|
||||
storage for = Aufbewahrung fuer
|
||||
your hammer = deinen Hammer
|
||||
Owner: %s = Besitzer: %s
|
||||
Punch anvil with hammer to = Schlage mit dem Hammer auf den Amboss um
|
||||
repair tool in workpiece-slot. = das Werkzeug im Werkstueckfeld zu reparieren.
|
||||
|
||||
### nodes_barrel.lua ###
|
||||
Pour: = Eingiessen
|
||||
Fill: = Ausgiessen
|
||||
barrel (closed) = Fass (geschlossen)
|
||||
barrel (open) = Fass (offen)
|
||||
barrel (closed), lying somewhere = Liegendes Fass (geschlossen)
|
||||
barrel (opened), lying somewhere = Liegendes Fass (offen)
|
||||
tub = Bottich
|
||||
|
||||
### nodes_chests.lua ###
|
||||
private NPC chest = Private NSC-Truhe
|
||||
chest for work utils and kitchens = NSC-Truhe fuer Arbeitsutensilien und Kuechen
|
||||
storage chest = NSC-Lagertruhe
|
||||
|
||||
### nodes_doorlike.lua ###
|
||||
opened window shutters = Offene Fensterlaeden
|
||||
closed window shutters = Geschlossene Fensterlaeden
|
||||
half door = Kloentuer
|
||||
half door inverted = Umgekehrte Kloentuer
|
||||
closed fence gate = Geschlossenes Zauntor
|
||||
opened fence gate = Offenes Zauntor
|
||||
wooden hatch = Holzfalltuer
|
||||
metal hatch = Metallfalltuer
|
||||
|
||||
### nodes_fences.lua ###
|
||||
small fence = Kleiner Zaun
|
||||
small fence corner = Kleiner Zaun (Ecke)
|
||||
small fence end = Kleiner Zaun (Ende)
|
||||
|
||||
### nodes_furniture.lua ###
|
||||
Bed (foot region) = Bett (Fussende)
|
||||
Bed (head region) = Bett (Kopfende)
|
||||
sleeping mat = Schlafmatte
|
||||
simple wooden bench = Einfache Holzbank
|
||||
table = Tisch
|
||||
open storage shelf = Offenes Lagerregal
|
||||
open storage shelf (in use) = Offenes Lagerregal (in Gebrauch)
|
||||
open storage shelf (empty) = Offenes Lagerregal (leer)
|
||||
stovepipe = Ofenrohr
|
||||
washing place = Waschplatz
|
||||
Sorry. This washing place is out of water. Please place it above water! = Entschuldige, dieser Waschplatz hat kein Wasser mehr. Bitte platziere ihn ueber Wasser!
|
||||
You feel much cleaner after some washing. = Nach einer kleinen Waesche fuehlst du dich nun sauberer.
|
||||
|
||||
### nodes_historic.lua ###
|
||||
wagon wheel = Wagenrad
|
||||
dirt road = Feldweg
|
||||
loam = Lehm
|
||||
Dirt Road Stairs = Feldwegtreppe
|
||||
Dirt Road, half height = Feldwegstufe
|
||||
Loam Stairs = Lehmtreppe
|
||||
Loam Slab = Lehmstufe
|
||||
Clay Stairs = Tontreppe
|
||||
Clay Slab = Tonstufe
|
||||
straw ground for animals = Strohboden fuer Tiere
|
||||
simple glass pane = Einfache Fensterscheibe
|
||||
|
||||
### nodes_roof.lua ###
|
||||
Roof straw = Strohdach
|
||||
Roof wood = Holzdach
|
||||
Roof black = Schwarzes Dach
|
||||
Roof red = Rotes Dach
|
||||
Roof brown = Braunes Dach
|
||||
Roof reet = Reetdach
|
||||
Roof slate = Schieferdach
|
||||
Roof connector straw = Strohdachverbinder
|
||||
Roof connector wood = Holzdachverbinder
|
||||
Roof connector black = Schwarzer Dachverbinder
|
||||
Roof connector red = Roter Dachverbinder
|
||||
Roof connector brown = Brauner Dachverbinder
|
||||
Roof connector reet = Reet-Dachverbinder
|
||||
Roof connector slate = Schiefer-Dachverbinder
|
||||
Roof (flat) straw = Strohdach (flach)
|
||||
Roof (flat) wood = Holzdach (flach)
|
||||
Roof (flat) black = Schwarzes Dach (flach)
|
||||
Roof (flat) red = Rotes Dach (flach)
|
||||
Roof (flat) brown = Braunes Dach (flach)
|
||||
Roof (flat) reet = Reetdach (flach)
|
||||
Roof (flat) slate = Schieferdach (flach)
|
||||
Vertical Slate = Vertikaler Schiefer
|
||||
Reet for thatching = Reet
|
||||
|
||||
|
||||
### nodes_straw.lua ###
|
||||
layer of straw = Strohschicht
|
||||
straw bale = Strohballen
|
||||
straw = Stroh
|
||||
threshing floor = Dreschboden
|
||||
Threshing floor = Dreschboden
|
||||
Threshing floor (owned by %s) = Dreschboden (gehoert %s)
|
||||
Harvested wheat: = Geernteter Weizen
|
||||
Straw: = Stroh
|
||||
Seeds: = Koerner
|
||||
Owner: %s = Besitzer: %s
|
||||
Punch threshing floor with a stick = Schlage mit einem Stock auf den Dreschboden
|
||||
to get straw and seeds from wheat. = um Stroh und Koerner vom Weizen zu bekommen.
|
||||
You have threshed %s wheat (%s are left). = Du hast %s Weizenaehren gedroschen (%s bleiben uebrig).
|
||||
You have threshed the last %s wheat. = Du hast die letzten %s Weizenaehren gedroschen.
|
||||
mill, powered by punching = Muehle, durch Schlagen antreiben
|
||||
Mill, powered by punching = Muehle, durch Schlagen antreiben
|
||||
Mill, powered by punching (owned by %s) = Muehle, durch Schlagen antreiben (gehoert %s)
|
||||
Wheat seeds: = Weizenkoerner
|
||||
Flour: = Mehl
|
||||
Mill = Muehle
|
||||
Owner: %s = Besitzer: %s
|
||||
Punch this hand-driven mill = Schlage auf diese handbetriebene Muehle
|
||||
to convert wheat seeds into flour. = um Weizenkoerner in Mehl umzuwandeln.
|
||||
You have grinded %s wheat seeds (%s are left). = Du hast %s Weizenkoerner gemahlen (%s bleiben uebrig).
|
||||
You have grinded the last %s wheat seeds. = Du hast die letzten %s Weizenkoerner gemahlen.
|
|
@ -0,0 +1,129 @@
|
|||
# Template
|
||||
|
||||
### alias.lua ###
|
||||
|
||||
### init.lua ###
|
||||
|
||||
### nodes_anvil.lua ###
|
||||
Steel hammer for repairing tools on the anvil =
|
||||
anvil =
|
||||
Anvil =
|
||||
The workpiece slot is for damaged tools only. =
|
||||
Your tool has been repaired successfully. =
|
||||
Your workpiece improves. =
|
||||
Anvil (owned by %s) =
|
||||
Workpiece: =
|
||||
Optional =
|
||||
storage for =
|
||||
your hammer =
|
||||
Owner: %s =
|
||||
Punch anvil with hammer to =
|
||||
repair tool in workpiece-slot. =
|
||||
|
||||
### nodes_barrel.lua ###
|
||||
Pour: =
|
||||
Fill: =
|
||||
barrel (closed) =
|
||||
barrel (open) =
|
||||
barrel (closed), lying somewhere =
|
||||
barrel (opened), lying somewhere =
|
||||
tub =
|
||||
|
||||
### nodes_chests.lua ###
|
||||
private NPC chest =
|
||||
chest for work utils and kitchens =
|
||||
storage chest =
|
||||
|
||||
### nodes_doorlike.lua ###
|
||||
opened window shutters =
|
||||
closed window shutters =
|
||||
half door =
|
||||
half door inverted =
|
||||
closed fence gate =
|
||||
opened fence gate =
|
||||
wooden hatch =
|
||||
metal hatch =
|
||||
|
||||
### nodes_fences.lua ###
|
||||
small fence =
|
||||
small fence corner =
|
||||
small fence end =
|
||||
|
||||
### nodes_furniture.lua ###
|
||||
Bed (foot region) =
|
||||
Bed (head region) =
|
||||
sleeping mat =
|
||||
simple wooden bench =
|
||||
table =
|
||||
open storage shelf =
|
||||
open storage shelf (in use) =
|
||||
open storage shelf (empty) =
|
||||
stovepipe =
|
||||
washing place =
|
||||
Sorry. This washing place is out of water. Please place it above water! =
|
||||
You feel much cleaner after some washing. =
|
||||
|
||||
### nodes_historic.lua ###
|
||||
wagon wheel =
|
||||
dirt road =
|
||||
loam =
|
||||
Dirt Road Stairs =
|
||||
Dirt Road, half height =
|
||||
Loam Stairs =
|
||||
Loam Slab =
|
||||
Clay Stairs =
|
||||
Clay Slab =
|
||||
straw ground for animals =
|
||||
simple glass pane =
|
||||
|
||||
### nodes_roof.lua ###
|
||||
Roof straw =
|
||||
Roof wood =
|
||||
Roof black =
|
||||
Roof red =
|
||||
Roof brown =
|
||||
Roof reet =
|
||||
Roof slate =
|
||||
Roof connector straw =
|
||||
Roof connector wood =
|
||||
Roof connector black =
|
||||
Roof connector red =
|
||||
Roof connector brown =
|
||||
Roof connector reet =
|
||||
Roof connector slate =
|
||||
Roof (flat) straw =
|
||||
Roof (flat) wood =
|
||||
Roof (flat) black =
|
||||
Roof (flat) red =
|
||||
Roof (flat) brown =
|
||||
Roof (flat) reet =
|
||||
Roof (flat) slate =
|
||||
Vertical Slate =
|
||||
Reet for thatching =
|
||||
|
||||
### nodes_straw.lua ###
|
||||
layer of straw =
|
||||
straw bale =
|
||||
straw =
|
||||
threshing floor =
|
||||
Threshing floor =
|
||||
Threshing floor (owned by %s) =
|
||||
Harvested wheat: =
|
||||
Straw: =
|
||||
Seeds: =
|
||||
Owner: %s =
|
||||
Punch threshing floor with a stick =
|
||||
to get straw and seeds from wheat. =
|
||||
You have threshed %s wheat (%s are left). =
|
||||
You have threshed the last %s wheat. =
|
||||
mill, powered by punching =
|
||||
Mill, powered by punching =
|
||||
Mill, powered by punching (owned by %s) =
|
||||
Wheat seeds: =
|
||||
Flour: =
|
||||
Mill =
|
||||
Owner: %s =
|
||||
Punch this hand-driven mill =
|
||||
to convert wheat seeds into flour. =
|
||||
You have grinded %s wheat seeds (%s are left). =
|
||||
You have grinded the last %s wheat seeds. =
|
|
@ -0,0 +1,243 @@
|
|||
---------------------------------------------------------------------------------------
|
||||
-- simple anvil that can be used to repair tools
|
||||
---------------------------------------------------------------------------------------
|
||||
-- * can be used to repair tools
|
||||
-- * the hammer gets dammaged a bit at each repair step
|
||||
---------------------------------------------------------------------------------------
|
||||
-- License of the hammer picture: CC-by-SA; done by GloopMaster; source:
|
||||
-- https://github.com/GloopMaster/glooptest/blob/master/glooptest/textures/glooptest_tool_steelhammer.png
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- the hammer for the anvil
|
||||
minetest.register_tool("cottages:hammer", {
|
||||
description = S("Steel hammer for repairing tools on the anvil"),
|
||||
image = "glooptest_tool_steelhammer.png",
|
||||
inventory_image = "glooptest_tool_steelhammer.png",
|
||||
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.8,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
-- about equal to a stone pick (it's not intended as a tool)
|
||||
cracky={times={[2]=2.00, [3]=1.20}, uses=30, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=6},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("cottages:anvil", {
|
||||
drawtype = "nodebox",
|
||||
description = S("anvil"),
|
||||
tiles = {"default_stone.png"}, -- TODO default_steel_block.png, default_obsidian.png are also nice
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
-- the nodebox model comes from realtest
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5,-0.5,-0.3,0.5,-0.4,0.3},
|
||||
{-0.35,-0.4,-0.25,0.35,-0.3,0.25},
|
||||
{-0.3,-0.3,-0.15,0.3,-0.1,0.15},
|
||||
{-0.35,-0.1,-0.2,0.35,0.1,0.2},
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
meta:set_string("infotext", S("Anvil"));
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("input", 1);
|
||||
-- inv:set_size("material", 9);
|
||||
-- inv:set_size("sample", 1);
|
||||
inv:set_size("hammer", 1);
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
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("formspec",
|
||||
"size[8,8]"..
|
||||
"image[7,3;1,1;glooptest_tool_steelhammer.png]"..
|
||||
-- "list[current_name;sample;0,0.5;1,1;]"..
|
||||
"list[current_name;input;2.5,1.5;1,1;]"..
|
||||
-- "list[current_name;material;5,0;3,3;]"..
|
||||
"list[current_name;hammer;5,3;1,1;]"..
|
||||
-- "label[0.0,0.0;Sample:]"..
|
||||
-- "label[0.0,1.0;(Receipe)]"..
|
||||
"label[2.5,1.0;"..S("Workpiece:").."]"..
|
||||
-- "label[6.0,-0.5;Materials:]"..
|
||||
"label[6.0,2.7;"..S("Optional").."]"..
|
||||
"label[6.0,3.0;"..S("storage for").."]"..
|
||||
"label[6.0,3.3;"..S("your hammer").."]"..
|
||||
|
||||
"label[0,-0.5;"..S("Anvil").."]"..
|
||||
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"..
|
||||
"label[0,3.0;"..S("Punch anvil with hammer to").."]"..
|
||||
"label[0,3.3;"..S("repair tool in workpiece-slot.").."]"..
|
||||
"list[current_player;main;0,4;8,4;]");
|
||||
end,
|
||||
|
||||
can_dig = function(pos,player)
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
local owner = meta:get_string('owner');
|
||||
|
||||
if( not( inv:is_empty("input"))
|
||||
-- or not( inv:is_empty("material"))
|
||||
-- or not( inv:is_empty("sample"))
|
||||
or not( inv:is_empty("hammer"))
|
||||
or not( player )
|
||||
or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then
|
||||
|
||||
return false;
|
||||
end
|
||||
return true;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return count;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0;
|
||||
end
|
||||
if( listname=='hammer' and stack and stack:get_name() ~= 'cottages:hammer') then
|
||||
return 0;
|
||||
end
|
||||
if( listname=='input'
|
||||
and( stack:get_wear() == 0
|
||||
or stack:get_name() == "technic:water_can"
|
||||
or stack:get_name() == "technic:lava_can" )) then
|
||||
|
||||
minetest.chat_send_player( player:get_player_name(),
|
||||
S('The workpiece slot is for damaged tools only.'));
|
||||
return 0;
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
if( not( pos ) or not( node ) or not( puncher )) then
|
||||
return;
|
||||
end
|
||||
-- only punching with the hammer is supposed to work
|
||||
local wielded = puncher:get_wielded_item();
|
||||
if( not( wielded ) or not( wielded:get_name() ) or wielded:get_name() ~= 'cottages:hammer') then
|
||||
return;
|
||||
end
|
||||
local name = puncher:get_player_name();
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
|
||||
local input = inv:get_stack('input',1);
|
||||
|
||||
-- only tools can be repaired
|
||||
if( not( input )
|
||||
or input:is_empty()
|
||||
or input:get_name() == "technic:water_can"
|
||||
or input:get_name() == "technic:lava_can" ) then
|
||||
return;
|
||||
end
|
||||
|
||||
-- tell the player when the job is done
|
||||
if( input:get_wear() == 0 ) then
|
||||
minetest.chat_send_player( puncher:get_player_name(),
|
||||
S('Your tool has been repaired successfully.'));
|
||||
return;
|
||||
end
|
||||
|
||||
-- do the actual repair
|
||||
input:add_wear( -5000 ); -- equals to what technic toolshop does in 5 seconds
|
||||
inv:set_stack("input", 1, input)
|
||||
|
||||
-- damage the hammer slightly
|
||||
wielded:add_wear( 100 );
|
||||
puncher:set_wielded_item( wielded );
|
||||
|
||||
-- do not spam too much
|
||||
if( math.random( 1,5 )==1 ) then
|
||||
minetest.chat_send_player( puncher:get_player_name(),
|
||||
S('Your workpiece improves.'));
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- crafting receipes
|
||||
---------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
output = "cottages:anvil",
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
|
||||
{'', 'default:steel_ingot','' },
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot'} },
|
||||
})
|
||||
|
||||
|
||||
-- the castle-mod has an anvil as well - with the same receipe. convert the two into each other
|
||||
if ( minetest.get_modpath("castle") ~= nil ) then
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:anvil",
|
||||
recipe = {
|
||||
{'castle:anvil'},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "castle:anvil",
|
||||
recipe = {
|
||||
{'cottages:anvil'},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:hammer",
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
|
||||
{'', 'default:stick', '' } }
|
||||
})
|
||||
|
|
@ -0,0 +1,302 @@
|
|||
|
||||
---------------------------------------------------------------------
|
||||
-- a barrel and a tub - plus a function that makes 'round' objects
|
||||
---------------------------------------------------------------------
|
||||
-- IMPORTANT NOTE: The barrel requires a lot of nodeboxes. That may be
|
||||
-- too much for weak hardware!
|
||||
---------------------------------------------------------------------
|
||||
-- Functionality: right-click to open/close a barrel;
|
||||
-- punch a barrel to change between vertical/horizontal
|
||||
---------------------------------------------------------------------
|
||||
-- Changelog:
|
||||
-- 24.03.13 Can no longer be opended/closed on rightclick because that is now used for a formspec;
|
||||
-- instead, it can be filled with liquids.
|
||||
-- Filled barrels will always be closed, while empty barrels will always be open.
|
||||
|
||||
-- pipes: table with the following entries for each pipe-part:
|
||||
-- f: radius factor; if 1, it will have a radius of half a nodebox and fill the entire nodebox
|
||||
-- h1, h2: height at witch the nodebox shall start and end; usually -0.5 and 0.5 for a full nodebox
|
||||
-- b: make a horizontal part/shelf
|
||||
-- horizontal: if 1, then x and y coordinates will be swapped
|
||||
|
||||
-- TODO: option so that it works without nodeboxes
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
barrel = {};
|
||||
|
||||
barrel.make_pipe = function( pipes, horizontal )
|
||||
|
||||
local result = {};
|
||||
for i, v in pairs( pipes ) do
|
||||
|
||||
local f = v.f;
|
||||
local h1 = v.h1;
|
||||
local h2 = v.h2;
|
||||
if( not( v.b ) or v.b == 0 ) then
|
||||
|
||||
table.insert( result, {-0.37*f, h1,-0.37*f, -0.28*f, h2,-0.28*f});
|
||||
table.insert( result, {-0.37*f, h1, 0.28*f, -0.28*f, h2, 0.37*f});
|
||||
table.insert( result, { 0.37*f, h1,-0.28*f, 0.28*f, h2,-0.37*f});
|
||||
table.insert( result, { 0.37*f, h1, 0.37*f, 0.28*f, h2, 0.28*f});
|
||||
|
||||
|
||||
table.insert( result, {-0.30*f, h1,-0.42*f, -0.20*f, h2,-0.34*f});
|
||||
table.insert( result, {-0.30*f, h1, 0.34*f, -0.20*f, h2, 0.42*f});
|
||||
table.insert( result, { 0.20*f, h1,-0.42*f, 0.30*f, h2,-0.34*f});
|
||||
table.insert( result, { 0.20*f, h1, 0.34*f, 0.30*f, h2, 0.42*f});
|
||||
|
||||
table.insert( result, {-0.42*f, h1,-0.30*f, -0.34*f, h2,-0.20*f});
|
||||
table.insert( result, { 0.34*f, h1,-0.30*f, 0.42*f, h2,-0.20*f});
|
||||
table.insert( result, {-0.42*f, h1, 0.20*f, -0.34*f, h2, 0.30*f});
|
||||
table.insert( result, { 0.34*f, h1, 0.20*f, 0.42*f, h2, 0.30*f});
|
||||
|
||||
|
||||
table.insert( result, {-0.25*f, h1,-0.45*f, -0.10*f, h2,-0.40*f});
|
||||
table.insert( result, {-0.25*f, h1, 0.40*f, -0.10*f, h2, 0.45*f});
|
||||
table.insert( result, { 0.10*f, h1,-0.45*f, 0.25*f, h2,-0.40*f});
|
||||
table.insert( result, { 0.10*f, h1, 0.40*f, 0.25*f, h2, 0.45*f});
|
||||
|
||||
table.insert( result, {-0.45*f, h1,-0.25*f, -0.40*f, h2,-0.10*f});
|
||||
table.insert( result, { 0.40*f, h1,-0.25*f, 0.45*f, h2,-0.10*f});
|
||||
table.insert( result, {-0.45*f, h1, 0.10*f, -0.40*f, h2, 0.25*f});
|
||||
table.insert( result, { 0.40*f, h1, 0.10*f, 0.45*f, h2, 0.25*f});
|
||||
|
||||
table.insert( result, {-0.15*f, h1,-0.50*f, 0.15*f, h2,-0.45*f});
|
||||
table.insert( result, {-0.15*f, h1, 0.45*f, 0.15*f, h2, 0.50*f});
|
||||
|
||||
table.insert( result, {-0.50*f, h1,-0.15*f, -0.45*f, h2, 0.15*f});
|
||||
table.insert( result, { 0.45*f, h1,-0.15*f, 0.50*f, h2, 0.15*f});
|
||||
|
||||
-- filled horizontal part
|
||||
else
|
||||
table.insert( result, {-0.35*f, h1,-0.40*f, 0.35*f, h2,0.40*f});
|
||||
table.insert( result, {-0.40*f, h1,-0.35*f, 0.40*f, h2,0.35*f});
|
||||
table.insert( result, {-0.25*f, h1,-0.45*f, 0.25*f, h2,0.45*f});
|
||||
table.insert( result, {-0.45*f, h1,-0.25*f, 0.45*f, h2,0.25*f});
|
||||
table.insert( result, {-0.15*f, h1,-0.50*f, 0.15*f, h2,0.50*f});
|
||||
table.insert( result, {-0.50*f, h1,-0.15*f, 0.50*f, h2,0.15*f});
|
||||
end
|
||||
end
|
||||
|
||||
-- make the whole thing horizontal
|
||||
if( horizontal == 1 ) then
|
||||
for i,v in ipairs( result ) do
|
||||
result[ i ] = { v[2], v[1], v[3], v[5], v[4], v[6] };
|
||||
end
|
||||
end
|
||||
|
||||
return result;
|
||||
end
|
||||
|
||||
|
||||
-- prepare formspec
|
||||
barrel.on_construct = function( pos )
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local percent = math.random( 1, 100 ); -- TODO: show real filling
|
||||
|
||||
meta:set_string( 'formspec',
|
||||
"size[8,9]"..
|
||||
"image[2.6,2;2,3;default_sandstone.png^[lowpart:"..
|
||||
(100-percent)..":default_desert_stone.png]".. -- TODO: better images
|
||||
"label[2.2,0;"..S("Pour:").."]"..
|
||||
"list[current_name;input;3,0.5;1,1;]"..
|
||||
"label[5,3.3;"..S("Fill:").."]"..
|
||||
"list[current_name;output;5,3.8;1,1;]"..
|
||||
"list[current_player;main;0,5;8,4;]");
|
||||
|
||||
|
||||
meta:set_string( 'liquid_type', '' ); -- which liquid is in the barrel?
|
||||
meta:set_int( 'liquid_level', 0 ); -- how much of the liquid is in there?
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("input", 1); -- to fill in new liquid
|
||||
inv:set_size("output", 1); -- to extract liquid
|
||||
end
|
||||
|
||||
|
||||
-- can only be digged if there are no more vessels/buckets in any of the slots
|
||||
-- TODO: allow digging of a filled barrel? this would disallow stacking of them
|
||||
barrel.can_dig = function( pos, player )
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
return ( inv:is_empty('input')
|
||||
and inv:is_empty('output'));
|
||||
end
|
||||
|
||||
|
||||
-- the barrel received input; either a new liquid that is to be poured in or a vessel that is to be filled
|
||||
barrel.on_metadata_inventory_put = function( pos, listname, index, stack, player )
|
||||
end
|
||||
|
||||
|
||||
-- right-click to open/close barrel; punch to switch between horizontal/vertical position
|
||||
minetest.register_node("cottages:barrel", {
|
||||
description = S("barrel (closed)"),
|
||||
paramtype = "light",
|
||||
tiles = {"cottages_minimal_wood.png","cottages_minimal_wood.png","cottages_barrel.png"}, -- "default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = barrel.make_pipe( { {f=0.9,h1=-0.2,h2=0.2,b=0}, {f=0.75,h1=-0.50,h2=-0.35,b=0}, {f=0.75,h1=0.35,h2=0.5,b=0},
|
||||
{f=0.82,h1=-0.35,h2=-0.2,b=0}, {f=0.82,h1=0.2, h2=0.35,b=0},
|
||||
{f=0.75,h1= 0.37,h2= 0.42,b=1}, -- top closed
|
||||
{f=0.75,h1=-0.42,h2=-0.37,b=1}}, 0 ), -- bottom closed
|
||||
},
|
||||
groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2
|
||||
},
|
||||
drop = "cottages:barrel",
|
||||
-- on_rightclick = function(pos, node, puncher)
|
||||
-- minetest.env:add_node(pos, {name = "cottages:barrel_open", param2 = node.param2})
|
||||
-- end,
|
||||
-- TODO: on_rightclick is no longer available - maybe open if empty and closed if full?
|
||||
on_punch = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying", param2 = node.param2})
|
||||
end,
|
||||
|
||||
on_construct = function( pos )
|
||||
return barrel.on_construct( pos );
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
return barrel.can_dig( pos, player );
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
return barrel.on_metadata_inventory_put( pos, listname, index, stack, player );
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
-- this barrel is opened at the top
|
||||
minetest.register_node("cottages:barrel_open", {
|
||||
description = S("barrel (open)"),
|
||||
paramtype = "light",
|
||||
tiles = {"cottages_minimal_wood.png","cottages_minimal_wood.png","cottages_barrel.png"},--"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = barrel.make_pipe( { {f=0.9,h1=-0.2,h2=0.2,b=0}, {f=0.75,h1=-0.50,h2=-0.35,b=0}, {f=0.75,h1=0.35,h2=0.5,b=0},
|
||||
{f=0.82,h1=-0.35,h2=-0.2,b=0}, {f=0.82,h1=0.2, h2=0.35,b=0},
|
||||
-- {f=0.75,h1= 0.37,h2= 0.42,b=1}, -- top closed
|
||||
{f=0.75,h1=-0.42,h2=-0.37,b=1}}, 0 ), -- bottom closed
|
||||
},
|
||||
groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2
|
||||
},
|
||||
drop = "cottages:barrel",
|
||||
-- on_rightclick = function(pos, node, puncher)
|
||||
-- minetest.env:add_node(pos, {name = "cottages:barrel", param2 = node.param2})
|
||||
-- end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying_open", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
-- horizontal barrel
|
||||
minetest.register_node("cottages:barrel_lying", {
|
||||
description = S("barrel (closed), lying somewhere"),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"cottages_barrel_lying.png","cottages_barrel_lying.png","cottages_minimal_wood.png","cottages_minimal_wood.png","cottages_barrel_lying.png"},--"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = barrel.make_pipe( { {f=0.9,h1=-0.2,h2=0.2,b=0}, {f=0.75,h1=-0.50,h2=-0.35,b=0}, {f=0.75,h1=0.35,h2=0.5,b=0},
|
||||
{f=0.82,h1=-0.35,h2=-0.2,b=0}, {f=0.82,h1=0.2, h2=0.35,b=0},
|
||||
{f=0.75,h1= 0.37,h2= 0.42,b=1}, -- top closed
|
||||
{f=0.75,h1=-0.42,h2=-0.37,b=1}}, 1 ), -- bottom closed
|
||||
},
|
||||
groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2
|
||||
},
|
||||
drop = "cottages:barrel",
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying_open", param2 = node.param2})
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
if( node.param2 < 4 ) then
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying", param2 = (node.param2+1)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel", param2 = 0})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- horizontal barrel, open
|
||||
minetest.register_node("cottages:barrel_lying_open", {
|
||||
description = S("barrel (opened), lying somewhere"),
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {"cottages_barrel_lying.png","cottages_barrel_lying.png","cottages_minimal_wood.png","cottages_minimal_wood.png","cottages_barrel_lying.png"},--"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = barrel.make_pipe( { {f=0.9,h1=-0.2,h2=0.2,b=0}, {f=0.75,h1=-0.50,h2=-0.35,b=0}, {f=0.75,h1=0.35,h2=0.5,b=0},
|
||||
{f=0.82,h1=-0.35,h2=-0.2,b=0}, {f=0.82,h1=0.2, h2=0.35,b=0},
|
||||
-- {f=0.75,h1= 0.37,h2= 0.42,b=1}, -- top closed
|
||||
{f=0.75,h1=-0.42,h2=-0.37,b=1}}, 1 ), -- bottom closed
|
||||
},
|
||||
groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2
|
||||
},
|
||||
drop = "cottages:barrel",
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying", param2 = node.param2})
|
||||
end,
|
||||
on_punch = function(pos, node, puncher)
|
||||
if( node.param2 < 4 ) then
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_lying_open", param2 = (node.param2+1)})
|
||||
else
|
||||
minetest.env:add_node(pos, {name = "cottages:barrel_open", param2 = 0})
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
-- let's hope "tub" is the correct english word for "bottich"
|
||||
minetest.register_node("cottages:tub", {
|
||||
description = S("tub"),
|
||||
paramtype = "light",
|
||||
tiles = {"cottages_minimal_wood.png","cottages_minimal_wood.png","cottages_barrel.png"},--"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = true,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = barrel.make_pipe( { {f=1.0,h1=-0.5,h2=0.0,b=0}, {f=1.0,h1=-0.46,h2=-0.41,b=1}}, 0 ),
|
||||
},
|
||||
groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:barrel",
|
||||
recipe = {
|
||||
{"default:wood", "", "default:wood" },
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:wood", "default:wood", "default:wood" },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:tub 2",
|
||||
recipe = {
|
||||
{"cottages:barrel"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:barrel",
|
||||
recipe = {
|
||||
{"cottages:tub"},
|
||||
{"cottages:tub"},
|
||||
},
|
||||
})
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
-- TODO: make these chests as chests and indicate that they are owned by npc
|
||||
-- TODO: add bags (not for carrying around but for decoration)
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
cottages_chests = {}
|
||||
-- uses default.chest_formspec for now
|
||||
cottages_chests.on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",default.chest_formspec)
|
||||
-- meta:set_string("infotext", "Chest")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
end
|
||||
|
||||
cottages_chests.can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end
|
||||
|
||||
-- the chests do not need receipes since they are only placeholders and not intended to be built by players
|
||||
-- (they are later on supposed to be filled with diffrent items by fill_chest.lua)
|
||||
minetest.register_node("cottages:chest_private", {
|
||||
description = S("private NPC chest"),
|
||||
infotext = "chest containing the possesions of one of the inhabitants",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
legacy_facedir_simple = true,
|
||||
on_construct = cottages_chests.on_construct,
|
||||
can_dig = cottages_chests.can_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("cottages:chest_work", {
|
||||
description = S("chest for work utils and kitchens"),
|
||||
infotext = "everything the inhabitant needs for his work",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
legacy_facedir_simple = true,
|
||||
on_construct = cottages_chests.on_construct,
|
||||
can_dig = cottages_chests.can_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("cottages:chest_storage", {
|
||||
description = S("storage chest"),
|
||||
infotext = "stored food reserves",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
legacy_facedir_simple = true,
|
||||
on_construct = cottages_chests.on_construct,
|
||||
can_dig = cottages_chests.can_dig,
|
||||
})
|
||||
|
|
@ -0,0 +1,440 @@
|
|||
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- These nodes are all like doors in a way:
|
||||
-- * window shutters (they open on right-click and when it turns day; they close at night)
|
||||
-- * a half-door where the top part can be opened seperately from the bottom part
|
||||
-- * a gate that drops to the floor when opened
|
||||
--
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- IMPORTANT NOTICE: If you have a very slow computer, it might be wise to increase the rate at which the
|
||||
-- abm that opens/closes the window shutters is called. Anything less than 10 minutes
|
||||
-- (600 seconds) ought to be ok.
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- small window shutters for single-node-windows; they open at day and close at night if the abm is working
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- propagate shutting/closing of window shutters to window shutters below/above this one
|
||||
cottages_window_sutter_operate = function( pos, old_node_state_name, new_node_state_name )
|
||||
|
||||
local offsets = {-1,1,-2,2,-3,3};
|
||||
local stop_up = 0;
|
||||
local stop_down = 0;
|
||||
|
||||
for i,v in ipairs(offsets) do
|
||||
|
||||
local node = minetest.env:get_node_or_nil( {x=pos.x, y=(pos.y+v), z=pos.z } );
|
||||
if( node and node.name and node.name==old_node_state_name
|
||||
and ( (v > 0 and stop_up == 0 )
|
||||
or (v < 0 and stop_down == 0 ))) then
|
||||
|
||||
minetest.env:add_node({x=pos.x, y=(pos.y+v), z=pos.z }, {name = new_node_state_name, param2 = node.param2})
|
||||
|
||||
-- found a diffrent node - no need to search further up
|
||||
elseif( v > 0 and stop_up == 0 ) then
|
||||
stop_up = 1;
|
||||
|
||||
elseif( v < 0 and stop_down == 0 ) then
|
||||
stop_down = 1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- window shutters - they cover half a node to each side
|
||||
minetest.register_node("cottages:window_shutter_open", {
|
||||
description = S("opened window shutters"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
-- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.90, -0.5, 0.4, -0.45, 0.5, 0.5},
|
||||
{ 0.45, -0.5, 0.4, 0.9, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.9, -0.5, 0.4, 0.9, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
drop = "cottages:window_shutter_closed",
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:window_shutter_closed", param2 = node.param2})
|
||||
cottages_window_sutter_operate( pos, "cottages:window_shutter_open", "cottages:window_shutter_closed" );
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("cottages:window_shutter_closed", {
|
||||
description = S("closed window shutters"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.4, -0.05, 0.5, 0.5},
|
||||
{ 0.05, -0.5, 0.4, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:window_shutter_open", param2 = node.param2})
|
||||
cottages_window_sutter_operate( pos, "cottages:window_shutter_closed", "cottages:window_shutter_open" );
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- open shutters in the morning
|
||||
minetest.register_abm({
|
||||
nodenames = {"cottages:window_shutter_closed"},
|
||||
interval = 20, -- change this to 600 if your machine is too slow
|
||||
chance = 3, -- not all people wake up at the same time!
|
||||
action = function(pos)
|
||||
|
||||
-- at this time, sleeping in a bed is not possible
|
||||
if( not(minetest.env:get_timeofday() < 0.2 or minetest.env:get_timeofday() > 0.805)) then
|
||||
local old_node = minetest.env:get_node( pos );
|
||||
minetest.env:add_node(pos, {name = "cottages:window_shutter_open", param2 = old_node.param2})
|
||||
cottages_window_sutter_operate( pos, "cottages:window_shutter_closed", "cottages:window_shutter_open" );
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- close them at night
|
||||
minetest.register_abm({
|
||||
nodenames = {"cottages:window_shutter_open"},
|
||||
interval = 20, -- change this to 600 if your machine is too slow
|
||||
chance = 2,
|
||||
action = function(pos)
|
||||
|
||||
-- same time at which sleeping is allowed in beds
|
||||
if( minetest.env:get_timeofday() < 0.2 or minetest.env:get_timeofday() > 0.805) then
|
||||
local old_node = minetest.env:get_node( pos );
|
||||
minetest.env:add_node(pos, {name = "cottages:window_shutter_closed", param2 = old_node.param2})
|
||||
cottages_window_sutter_operate( pos, "cottages:window_shutter_open", "cottages:window_shutter_closed" );
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
-- a half door; can be combined to a full door where the upper part can be operated seperately; usually found in barns/stables
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
minetest.register_node("cottages:half_door", {
|
||||
description = S("half door"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.4, 0.48, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0.4, 0.48, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
local node2 = minetest.env:get_node( {x=pos.x,y=(pos.y+1),z=pos.z});
|
||||
|
||||
local param2 = node.param2;
|
||||
if( param2 == 1) then param2 = 2;
|
||||
elseif( param2 == 2) then param2 = 1;
|
||||
elseif( param2 == 3) then param2 = 0;
|
||||
elseif( param2 == 0) then param2 = 3;
|
||||
end;
|
||||
minetest.env:add_node(pos, {name = "cottages:half_door", param2 = param2})
|
||||
-- if the node above consists of a door of the same type, open it as well
|
||||
-- Note: doors beneath this one are not opened! It is a special feature of these doors that they can be opend partly
|
||||
if( node2 ~= nil and node2.name == node.name and node2.param2==node.param2) then
|
||||
minetest.env:add_node( {x=pos.x,y=(pos.y+1),z=pos.z}, {name = "cottages:half_door", param2 = param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("cottages:half_door_inverted", {
|
||||
description = S("half door inverted"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.48, 0.5, -0.4},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.48, 0.5, -0.4},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
local node2 = minetest.env:get_node( {x=pos.x,y=(pos.y+1),z=pos.z});
|
||||
|
||||
local param2 = node.param2;
|
||||
if( param2 == 1) then param2 = 0;
|
||||
elseif( param2 == 0) then param2 = 1;
|
||||
elseif( param2 == 2) then param2 = 3;
|
||||
elseif( param2 == 3) then param2 = 2;
|
||||
end;
|
||||
minetest.env:add_node(pos, {name = "cottages:half_door_inverted", param2 = param2})
|
||||
-- open upper parts of this door (if there are any)
|
||||
if( node2 ~= nil and node2.name == node.name and node2.param2==node.param2) then
|
||||
minetest.env:add_node( {x=pos.x,y=(pos.y+1),z=pos.z}, {name = "cottages:half_door_inverted", param2 = param2})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
-- this gate for fences solves the "where to store the opened gate" problem by dropping it to the floor in optened state
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
minetest.register_node("cottages:gate_closed", {
|
||||
description = S("closed fence gate"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.85, -0.25, -0.02, 0.85, -0.05, 0.02},
|
||||
{ -0.85, 0.15, -0.02, 0.85, 0.35, 0.02},
|
||||
|
||||
{ -0.80, -0.05, -0.02, -0.60, 0.15, 0.02},
|
||||
{ 0.60, -0.05, -0.02, 0.80, 0.15, 0.02},
|
||||
{ -0.15, -0.05, -0.02, 0.15, 0.15, 0.02},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.85, -0.25, -0.1, 0.85, 0.35, 0.1},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:gate_open", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("cottages:gate_open", {
|
||||
description = S("opened fence gate"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"default_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
drop = "cottages:gate_closed",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.85, -0.5, -0.25, 0.85, -0.46, -0.05},
|
||||
{ -0.85, -0.5, 0.15, 0.85, -0.46, 0.35},
|
||||
|
||||
{ -0.80, -0.5, -0.05, -0.60, -0.46, 0.15},
|
||||
{ 0.60, -0.5, -0.05, 0.80, -0.46, 0.15},
|
||||
{ -0.15, -0.5, -0.05, 0.15, -0.46, 0.15},
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.85, -0.5, -0.25, 0.85, -0.3, 0.35},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "cottages:gate_closed", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- a hatch; nodebox definition taken from realtest
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- hatches rotate around their axis
|
||||
-- old facedir: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
|
||||
new_facedirs = { 10,19, 4,13, 2,18,22,14,20,16, 0,12,11, 3, 7,21, 9,23, 5, 1, 8,15, 6,17};
|
||||
|
||||
|
||||
cottages.register_hatch = function( nodename, description, texture, receipe_item )
|
||||
|
||||
minetest.register_node( nodename, {
|
||||
description = S(description), -- not that there are any other...
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = { texture },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.49, -0.55, -0.49, -0.3, -0.45, 0.45},
|
||||
-- {-0.5, -0.55, 0.3, 0.3, -0.45, 0.5},
|
||||
{0.3, -0.55, -0.3, 0.49, -0.45, 0.45},
|
||||
{0.49, -0.55, -0.49, -0.3, -0.45, -0.3},
|
||||
{-0.075, -0.55, -0.3, 0.075, -0.45, 0.3},
|
||||
{-0.3, -0.55, -0.075, -0.075, -0.45, 0.075},
|
||||
{0.075, -0.55, -0.075, 0.3, -0.45, 0.075},
|
||||
|
||||
{-0.3, -0.55, 0.3, 0.3, -0.45, 0.45},
|
||||
|
||||
-- hinges
|
||||
{-0.45,-0.530, 0.45, -0.15,-0.470, 0.525},
|
||||
{ 0.15,-0.530, 0.45, 0.45,-0.470, 0.525},
|
||||
|
||||
-- handle
|
||||
{-0.05,-0.60,-0.35, 0.05,-0.40,-0.45},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.55, -0.5, 0.5, -0.45, 0.5},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
|
||||
minetest.env:add_node(pos, {name = node.name, param2 = new_facedirs[ node.param2+1 ]})
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = nodename,
|
||||
recipe = {
|
||||
{ '', '', receipe_item },
|
||||
{ receipe_item, 'default:stick', '' },
|
||||
{ '', '', '' },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- further alternate hatch materials: wood, tree, copper_block
|
||||
cottages.register_hatch( 'cottages:hatch_wood', 'wooden hatch', 'cottages_minimal_wood.png', 'stairs:slab_wood' );
|
||||
cottages.register_hatch( 'cottages:hatch_steel', 'metal hatch', 'default_steel_block.png', 'default:steel_ingot' );
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
-- and now the crafting receipes:
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- transform opend and closed shutters into each other for convenience
|
||||
minetest.register_craft({
|
||||
output = "cottages:window_shutter_open",
|
||||
recipe = {
|
||||
{"cottages:window_shutter_closed" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:window_shutter_closed",
|
||||
recipe = {
|
||||
{"cottages:window_shutter_open" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:window_shutter_open",
|
||||
recipe = {
|
||||
{"default:wood", "", "default:wood" },
|
||||
}
|
||||
})
|
||||
|
||||
-- transform one half door into another
|
||||
minetest.register_craft({
|
||||
output = "cottages:half_door",
|
||||
recipe = {
|
||||
{"cottages:half_door_inverted" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:half_door_inverted",
|
||||
recipe = {
|
||||
{"cottages:half_door" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:half_door 2",
|
||||
recipe = {
|
||||
{"", "default:wood", "" },
|
||||
{"", "doors:door_wood", "" },
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-- transform open and closed versions into into another for convenience
|
||||
minetest.register_craft({
|
||||
output = "cottages:gate_closed",
|
||||
recipe = {
|
||||
{"cottages:gate_open" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:gate_open",
|
||||
recipe = {
|
||||
{"cottages:gate_closed"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:gate_closed",
|
||||
recipe = {
|
||||
{"default:stick", "default:stick", "default:wood" },
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
-- 22.01.13 Changed texture to that of the wood from the minimal development game
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
minetest.register_node("cottages:fence_small", {
|
||||
description = S("small fence"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.45, -0.35, 0.46, 0.45, -0.20, 0.50},
|
||||
{ -0.45, 0.00, 0.46, 0.45, 0.15, 0.50},
|
||||
{ -0.45, 0.35, 0.46, 0.45, 0.50, 0.50},
|
||||
|
||||
{ -0.50, -0.50, 0.46, -0.45, 0.50, 0.50},
|
||||
{ 0.45, -0.50, 0.46, 0.50, 0.50, 0.50},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.50, -0.50, 0.4, 0.50, 0.50, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("cottages:fence_corner", {
|
||||
description = S("small fence corner"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.45, -0.35, 0.46, 0.45, -0.20, 0.50},
|
||||
{ -0.45, 0.00, 0.46, 0.45, 0.15, 0.50},
|
||||
{ -0.45, 0.35, 0.46, 0.45, 0.50, 0.50},
|
||||
|
||||
{ -0.50, -0.50, 0.46, -0.45, 0.50, 0.50},
|
||||
{ 0.45, -0.50, 0.46, 0.50, 0.50, 0.50},
|
||||
|
||||
{ 0.46, -0.35, -0.45, 0.50, -0.20, 0.45},
|
||||
{ 0.46, 0.00, -0.45, 0.50, 0.15, 0.45},
|
||||
{ 0.46, 0.35, -0.45, 0.50, 0.50, 0.45},
|
||||
|
||||
{ 0.46, -0.50, -0.50, 0.50, 0.50, -0.45},
|
||||
{ 0.46, -0.50, 0.45, 0.50, 0.50, 0.50},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.50, -0.50,-0.5, 0.50, 0.50, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("cottages:fence_end", {
|
||||
description = S("small fence end"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.45, -0.35, 0.46, 0.45, -0.20, 0.50},
|
||||
{ -0.45, 0.00, 0.46, 0.45, 0.15, 0.50},
|
||||
{ -0.45, 0.35, 0.46, 0.45, 0.50, 0.50},
|
||||
|
||||
{ -0.50, -0.50, 0.46, -0.45, 0.50, 0.50},
|
||||
{ 0.45, -0.50, 0.46, 0.50, 0.50, 0.50},
|
||||
|
||||
{ 0.46, -0.35, -0.45, 0.50, -0.20, 0.45},
|
||||
{ 0.46, 0.00, -0.45, 0.50, 0.15, 0.45},
|
||||
{ 0.46, 0.35, -0.45, 0.50, 0.50, 0.45},
|
||||
|
||||
{ 0.46, -0.50, -0.50, 0.50, 0.50, -0.45},
|
||||
{ 0.46, -0.50, 0.45, 0.50, 0.50, 0.50},
|
||||
|
||||
{ -0.50, -0.35, -0.45, -0.46, -0.20, 0.45},
|
||||
{ -0.50, 0.00, -0.45, -0.46, 0.15, 0.45},
|
||||
{ -0.50, 0.35, -0.45, -0.46, 0.50, 0.45},
|
||||
|
||||
{ -0.50, -0.50, -0.50, -0.46, 0.50, -0.45},
|
||||
{ -0.50, -0.50, 0.45, -0.46, 0.50, 0.50},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.50, -0.50,-0.5, 0.50, 0.50, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_small 3",
|
||||
recipe = {
|
||||
{"default:fence_wood","default:fence_wood" },
|
||||
}
|
||||
})
|
||||
|
||||
-- xfences can be configured to replace normal fences - which makes them uncraftable
|
||||
if ( minetest.get_modpath("xfences") ~= nil ) then
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_small 3",
|
||||
recipe = {
|
||||
{"xfences:fence","xfences:fence" },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_corner",
|
||||
recipe = {
|
||||
{"cottages:fence_small","cottages:fence_small" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_small 2",
|
||||
recipe = {
|
||||
{"cottages:fence_corner" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_end",
|
||||
recipe = {
|
||||
{"cottages:fence_small","cottages:fence_small", "cottages:fence_small" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:fence_small 3",
|
||||
recipe = {
|
||||
{"cottages:fence_end" },
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,375 @@
|
|||
---------------------------------------------------------------------------------------
|
||||
-- furniture
|
||||
---------------------------------------------------------------------------------------
|
||||
-- contains:
|
||||
-- * a bed seperated into foot and head reagion so that it can be placed manually; it has
|
||||
-- no other functionality than decoration!
|
||||
-- * a sleeping mat - mostly for NPC that cannot afford a bet yet
|
||||
-- * bench - if you don't have 3dforniture:chair, then this is the next best thing
|
||||
-- * table - very simple one
|
||||
-- * shelf - for stroring things; this one is 3d
|
||||
-- * stovepipe - so that the smoke from the furnace can get away
|
||||
-- * washing place - put it over a water source and you can 'wash' yourshelf
|
||||
---------------------------------------------------------------------------------------
|
||||
-- TODO: change the textures of the bed (make the clothing white, foot path not entirely covered with cloth)
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- a bed without functionality - just decoration
|
||||
minetest.register_node("cottages:bed_foot", {
|
||||
description = S("Bed (foot region)"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {"cottages_beds_bed_top_bottom.png", "default_wood.png", "cottages_beds_bed_side.png", "cottages_beds_bed_side.png", "cottages_beds_bed_side.png", "cottages_beds_bed_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- bed
|
||||
{-0.5, 0.0, -0.5, 0.5, 0.3, 0.5},
|
||||
|
||||
-- stützen
|
||||
{-0.5, -0.5, -0.5, -0.4, 0.5, -0.4},
|
||||
{ 0.4,-0.5, -0.5, 0.5, 0.5, -0.4},
|
||||
|
||||
-- Querstrebe
|
||||
{-0.4, 0.3, -0.5, 0.4, 0.5, -0.4}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.3, 0.5},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
-- the bed is split up in two parts to avoid destruction of blocks on placement
|
||||
minetest.register_node("cottages:bed_head", {
|
||||
description = S("Bed (head region)"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {"cottages_beds_bed_top_top.png", "default_wood.png", "cottages_beds_bed_side_top_r.png", "cottages_beds_bed_side_top_l.png", "default_wood.png", "cottages_beds_bed_side.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- bed
|
||||
{-0.5, 0.0, -0.5, 0.5, 0.3, 0.5},
|
||||
|
||||
-- stützen
|
||||
{-0.5,-0.5, 0.4, -0.4, 0.5, 0.5},
|
||||
{ 0.4,-0.5, 0.4, 0.5, 0.5, 0.5},
|
||||
|
||||
-- Querstrebe
|
||||
{-0.4, 0.3, 0.4, 0.4, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.3, 0.5},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- the basic version of a bed - a sleeping mat
|
||||
-- to facilitate upgrade path straw mat -> sleeping mat -> bed, this uses a nodebox
|
||||
minetest.register_node("cottages:sleeping_mat", {
|
||||
description = S("sleeping mat"),
|
||||
drawtype = 'nodebox',
|
||||
tiles = { 'cottages_sleepingmat.png' }, -- done by VanessaE
|
||||
wield_image = 'cottages_sleepingmat.png',
|
||||
inventory_image = 'cottages_sleepingmat.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5,-0.48, 0.48, -0.45, 0.48},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5,-0.48, 0.48, -0.25, 0.48},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- furniture; possible replacement: 3dforniture:chair
|
||||
minetest.register_node("cottages:bench", {
|
||||
drawtype = "nodebox",
|
||||
description = S("simple wooden bench"),
|
||||
tiles = {"cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png", "cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- sitting area
|
||||
{-0.5, -0.15, 0.1, 0.5, -0.05, 0.5},
|
||||
|
||||
-- stützen
|
||||
{-0.4, -0.5, 0.2, -0.3, -0.15, 0.4},
|
||||
{ 0.3, -0.5, 0.2, 0.4, -0.15, 0.4},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0, 0.5, 0, 0.5},
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- a simple table; possible replacement: 3dforniture:table
|
||||
minetest.register_node("cottages:table", {
|
||||
description = S("table"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.1, -0.5, -0.1, 0.1, 0.3, 0.1},
|
||||
{ -0.5, 0.3, -0.5, 0.5, 0.4, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, 0.4, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- looks better than two slabs impersonating a shelf; also more 3d than a bookshelf
|
||||
-- the infotext shows if it's empty or not
|
||||
minetest.register_node("cottages:shelf", {
|
||||
description = S("open storage shelf"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_minimal_wood.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
{ -0.5, -0.5, -0.3, -0.4, 0.5, 0.5},
|
||||
{ 0.4, -0.5, -0.3, 0.5, 0.5, 0.5},
|
||||
|
||||
{ -0.5, -0.2, -0.3, 0.5, -0.1, 0.5},
|
||||
{ -0.5, 0.3, -0.3, 0.5, 0.4, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
|
||||
on_construct = function(pos)
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
|
||||
meta:set_string("formspec",
|
||||
"size[8,8]"..
|
||||
"list[current_name;main;0,0;8,3;]"..
|
||||
"list[current_player;main;0,4;8,4;]")
|
||||
meta:set_string("infotext", S("open storage shelf"))
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("main", 24);
|
||||
end,
|
||||
|
||||
can_dig = function( pos,player )
|
||||
local meta = minetest.env:get_meta( pos );
|
||||
local inv = meta:get_inventory();
|
||||
return inv:is_empty("main");
|
||||
end,
|
||||
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta( pos );
|
||||
meta:set_string('infotext', S('open storage shelf (in use)'));
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.env:get_meta( pos );
|
||||
local inv = meta:get_inventory();
|
||||
if( inv:is_empty("main")) then
|
||||
meta:set_string('infotext', S('open storage shelf (empty)'));
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
})
|
||||
|
||||
-- so that the smoke from a furnace can get out of a building
|
||||
minetest.register_node("cottages:stovepipe", {
|
||||
description = S("stovepipe"),
|
||||
drawtype = "nodebox",
|
||||
tiles = {"default_steel_block.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 0.20, -0.5, 0.20, 0.45, 0.5, 0.45},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ 0.20, -0.5, 0.20, 0.45, 0.5, 0.45},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- this washing place can be put over a water source (it is open at the bottom)
|
||||
minetest.register_node("cottages:washing", {
|
||||
description = S("washing place"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"default_clay.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, -0.2, -0.2},
|
||||
|
||||
{ -0.5, -0.5, -0.2, -0.4, 0.2, 0.5},
|
||||
{ 0.4, -0.5, -0.2, 0.5, 0.2, 0.5},
|
||||
|
||||
{ -0.4, -0.5, 0.4, 0.4, 0.2, 0.5},
|
||||
{ -0.4, -0.5, -0.2, 0.4, 0.2, -0.1},
|
||||
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.5, 0.5, 0.2, 0.5},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, player)
|
||||
-- works only with water beneath
|
||||
local node_under = minetest.env:get_node( {x=pos.x, y=(pos.y-1), z=pos.z} );
|
||||
if( not( node_under ) or node_under.name == "ignore" or (node_under.name ~= 'default:water_source' and node_under.name ~= 'default:water_flowing')) then
|
||||
minetest.chat_send_player( player:get_player_name(), S("Sorry. This washing place is out of water. Please place it above water!"));
|
||||
else
|
||||
minetest.chat_send_player( player:get_player_name(), S("You feel much cleaner after some washing."));
|
||||
end
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- crafting receipes
|
||||
---------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
output = "cottages:bed_foot",
|
||||
recipe = {
|
||||
{"wool:white", "", "", },
|
||||
{"default:wood", "", "", },
|
||||
{"default:stick", "", "", }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:bed_head",
|
||||
recipe = {
|
||||
{"", "", "wool:white", },
|
||||
{"", "default:stick", "default:wood", },
|
||||
{"", "", "default:stick", }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:sleeping_mat",
|
||||
recipe = {
|
||||
{"wool:white", "cottages:straw_mat","cottages:straw_mat" }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:table",
|
||||
recipe = {
|
||||
{"", "stairs:slab_wood", "", },
|
||||
{"", "default:stick", "" }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:bench",
|
||||
recipe = {
|
||||
{"", "default:wood", "", },
|
||||
{"default:stick", "", "default:stick", }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:shelf",
|
||||
recipe = {
|
||||
{"default:stick", "default:wood", "default:stick", },
|
||||
{"default:stick", "default:wood", "default:stick", },
|
||||
{"default:stick", "", "default:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:washing 2",
|
||||
recipe = {
|
||||
{"default:stick", },
|
||||
{"default:clay", },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:stovepipe 2",
|
||||
recipe = {
|
||||
{'default:steel_ingot', '', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
---------------------------------------------------------------------------------------
|
||||
-- decoration and building material
|
||||
---------------------------------------------------------------------------------------
|
||||
-- * includes a wagon wheel that can be used as decoration on walls or to build (stationary) wagons
|
||||
-- * dirt road - those are more natural in small old villages than cobble roads
|
||||
-- * loam - no, old buildings are usually not built out of clay; loam was used
|
||||
-- * straw - useful material for roofs
|
||||
-- * glass pane - an improvement compared to fence posts as windows :-)
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- can be used to buid real stationary wagons or attached to walls as decoration
|
||||
minetest.register_node("cottages:wagon_wheel", {
|
||||
description = S("wagon wheel"),
|
||||
drawtype = "signlike",
|
||||
tiles = {"cottages_wagonwheel.png"}, -- done by VanessaE!
|
||||
inventory_image = "cottages_wagonwheel.png",
|
||||
wield_image = "cottages_wagonwheel.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=2,attached_node=1},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
})
|
||||
|
||||
|
||||
-- a nice dirt road for small villages or paths to fields
|
||||
minetest.register_node("cottages:feldweg", {
|
||||
description = S("dirt road"),
|
||||
tiles = {"cottages_feldweg.png","default_dirt.png", "default_dirt.png^default_grass_side.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults,
|
||||
})
|
||||
|
||||
|
||||
-- people didn't use clay for houses; they did build with loam
|
||||
minetest.register_node("cottages:loam", {
|
||||
description = S("loam"),
|
||||
tiles = {"cottages_loam.png"},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults,
|
||||
})
|
||||
|
||||
-- create stairs if possible
|
||||
if( stairs and stairs.register_stair_and_slab) then
|
||||
stairs.register_stair_and_slab("feldweg", "cottages:feldweg",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
{"cottages_feldweg.png","default_dirt.png", "default_grass.png","default_grass.png","cottages_feldweg.png","cottages_feldweg.png"},
|
||||
S("Dirt Road Stairs"),
|
||||
S("Dirt Road, half height"),
|
||||
default.node_sound_dirt_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("loam", "cottages:loam",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
{"cottages_loam.png"},
|
||||
S("Loam Stairs"),
|
||||
S("Loam Slab"),
|
||||
default.node_sound_dirt_defaults())
|
||||
|
||||
stairs.register_stair_and_slab("clay", "default:clay",
|
||||
{crumbly=3},
|
||||
{"default_clay.png"},
|
||||
S("Clay Stairs"),
|
||||
S("Clay Slab"),
|
||||
default.node_sound_dirt_defaults())
|
||||
end
|
||||
|
||||
|
||||
-- straw is a common material for places where animals are kept indoors
|
||||
-- right now, this block mostly serves as a placeholder
|
||||
minetest.register_node("cottages:straw_ground", {
|
||||
description = S("straw ground for animals"),
|
||||
tiles = {"cottages_darkage_straw.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png","cottages_loam.png"},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults,
|
||||
})
|
||||
|
||||
|
||||
-- note: these houses look good with a single fence pile as window! the glass pane is the version for 'richer' inhabitants
|
||||
minetest.register_node("cottages:glass_pane", {
|
||||
description = S("simple glass pane"),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
tiles = {"cottages_glass_pane.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.05, 0.5, 0.5, 0.05},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -0.5, -0.5, -0.05, 0.5, 0.5, 0.05},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- crafting receipes
|
||||
---------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
output = "cottages:wagon_wheel 3",
|
||||
recipe = {
|
||||
{"default:iron_lump", "default:stick", "default:iron_lump" },
|
||||
{"default:stick", "default:steel_ingot", "default:stick" },
|
||||
{"default:iron_lump", "default:stick", "default:iron_lump" }
|
||||
}
|
||||
})
|
||||
|
||||
-- run a wagon wheel over dirt :-)
|
||||
minetest.register_craft({
|
||||
output = "cottages:feldweg 4",
|
||||
recipe = {
|
||||
{"", "cottages:wagon_wheel", "" },
|
||||
{"default:dirt","default:dirt","default:dirt" }
|
||||
},
|
||||
replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, }
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:loam 4",
|
||||
recipe = {
|
||||
{"default:sand" },
|
||||
{"default:clay"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_ground 2",
|
||||
recipe = {
|
||||
{"cottages:straw_mat" },
|
||||
{"cottages:loam"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:glass_pane 4",
|
||||
recipe = {
|
||||
{"default:stick", "default:stick", "default:stick" },
|
||||
{"default:stick", "default:glass", "default:stick" },
|
||||
{"default:stick", "default:stick", "default:stick" }
|
||||
}
|
||||
})
|
|
@ -0,0 +1,214 @@
|
|||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- roof parts
|
||||
---------------------------------------------------------------------------------------
|
||||
-- a better roof than the normal stairs; can be replaced by stairs:stair_wood
|
||||
|
||||
|
||||
-- create the three basic roof parts plus receipes for them;
|
||||
cottages.register_roof = function( name, tiles, basic_material, homedecor_alternative )
|
||||
|
||||
minetest.register_node("cottages:roof_"..name, {
|
||||
description = S("Roof "..name),
|
||||
drawtype = "nodebox",
|
||||
--tiles = {"default_tree.png","default_wood.png","default_wood.png","default_wood.png","default_wood.png","default_tree.png"},
|
||||
tiles = tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- a better roof than the normal stairs; this one is for usage directly on top of walls (it has the form of a stair)
|
||||
minetest.register_node("cottages:roof_connector_"..name, {
|
||||
description = S("Roof connector "..name),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
--tiles = {"default_tree.png","default_wood.png","default_tree.png","default_tree.png","default_wood.png","default_tree.png"},
|
||||
--tiles = {"darkage_straw.png","default_wood.png","darkage_straw.png","darkage_straw.png","darkage_straw.png","darkage_straw.png"},
|
||||
tiles = tiles,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- this one is the slab version of the above roof
|
||||
minetest.register_node("cottages:roof_flat_"..name, {
|
||||
description = S("Roof (flat) "..name),
|
||||
drawtype = "nodebox",
|
||||
-- top, bottom, side1, side2, inner, outer
|
||||
--tiles = {"default_tree.png","default_wood.png","default_tree.png","default_tree.png","default_wood.png","default_tree.png"},
|
||||
-- this one is from all sides - except from the underside - of the given material
|
||||
tiles = { tiles[1], tiles[2], tiles[1], tiles[1], tiles[1], tiles[1] };
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
if( not( homedecor_alternative )
|
||||
or ( minetest.get_modpath("homedecor") ~= nil )) then
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:roof_"..name.." 6",
|
||||
recipe = {
|
||||
{'', '', basic_material },
|
||||
{'', basic_material, '' },
|
||||
{basic_material, '', '' }
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- make those roof parts that use homedecor craftable without that mod
|
||||
if( homedecor_alternative ) then
|
||||
basic_material = 'cottages:roof_wood';
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:roof_"..name.." 3",
|
||||
recipe = {
|
||||
{homedecor_alternative, '', basic_material },
|
||||
{'', basic_material, '' },
|
||||
{basic_material, '', '' }
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:roof_connector_"..name,
|
||||
recipe = {
|
||||
{'cottages:roof_'..name },
|
||||
{'default:wood' },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:roof_flat_"..name..' 2',
|
||||
recipe = {
|
||||
{'cottages:roof_'..name, 'cottages:roof_'..name },
|
||||
}
|
||||
})
|
||||
|
||||
-- convert flat roofs back to normal roofs
|
||||
minetest.register_craft({
|
||||
output = "cottages:roof_"..name,
|
||||
recipe = {
|
||||
{"cottages:roof_flat_"..name, "cottages:roof_flat_"..name }
|
||||
}
|
||||
})
|
||||
|
||||
end -- of cottages.register_roof( name, tiles, basic_material )
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- add the diffrent roof types
|
||||
---------------------------------------------------------------------------------------
|
||||
cottages.register_roof( 'straw',
|
||||
{"cottages_darkage_straw.png","cottages_darkage_straw.png","cottages_darkage_straw.png","cottages_darkage_straw.png","cottages_darkage_straw.png","cottages_darkage_straw.png"},
|
||||
'cottages:straw_mat', nil );
|
||||
cottages.register_roof( 'reet',
|
||||
{"cottages_reet.png","cottages_reet.png","cottages_reet.png","cottages_reet.png","cottages_reet.png","cottages_reet.png"},
|
||||
'default:papyrus', nil );
|
||||
cottages.register_roof( 'wood',
|
||||
{"default_tree.png","default_wood.png","default_wood.png","default_wood.png","default_wood.png","default_tree.png"},
|
||||
'default:wood', nil);
|
||||
cottages.register_roof( 'black',
|
||||
{"cottages_homedecor_shingles_asphalt.png","default_wood.png","default_wood.png","default_wood.png","default_wood.png","cottages_homedecor_shingles_asphalt.png"},
|
||||
'homedecor:shingles_asphalt', 'default:coal_lump');
|
||||
cottages.register_roof( 'red',
|
||||
{"cottages_homedecor_shingles_terracotta.png","default_wood.png","default_wood.png","default_wood.png","default_wood.png","cottages_homedecor_shingles_terracotta.png"},
|
||||
'homedecor:shingles_terracotta', 'default:clay_brick');
|
||||
cottages.register_roof( 'brown',
|
||||
{"cottages_homedecor_shingles_wood.png","default_wood.png","default_wood.png","default_wood.png","default_wood.png","cottages_homedecor_shingles_wood.png"},
|
||||
'homedecor:shingles_wood', 'default:dirt');
|
||||
cottages.register_roof( 'slate',
|
||||
{"cottages_slate.png","default_wood.png","cottages_slate.png","cottages_slate.png","default_wood.png","cottages_slate.png"},
|
||||
'default:stone', nil);
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- slate roofs are sometimes on vertical fronts of houses
|
||||
---------------------------------------------------------------------------------------
|
||||
minetest.register_node("cottages:slate_vertical", {
|
||||
description = S("Vertical Slate"),
|
||||
tiles = {"cottages_slate.png","default_wood.png","cottages_slate.png","cottages_slate.png","default_wood.png","cottages_slate.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, stone=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:slate_vertical",
|
||||
recipe = { {'default:stone', 'default:wood', '' }
|
||||
}
|
||||
});
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- Reed might also be needed as a full block
|
||||
---------------------------------------------------------------------------------------
|
||||
minetest.register_node("cottages:reet", {
|
||||
description = S("Reet for thatching"),
|
||||
tiles = {"cottages_reet.png"},
|
||||
groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:reet",
|
||||
recipe = { {'default:papyrus','default:papyrus'},
|
||||
{'default:papyrus','default:papyrus'},
|
||||
},
|
||||
})
|
|
@ -0,0 +1,477 @@
|
|||
---------------------------------------------------------------------------------------
|
||||
-- straw - a very basic material
|
||||
---------------------------------------------------------------------------------------
|
||||
-- * straw mat - for animals and very poor NPC; also basis for other straw things
|
||||
-- * straw bale - well, just a good source for building and decoration
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- an even simpler from of bed - usually for animals
|
||||
-- it is a nodebox and not wallmounted because that makes it easier to replace beds with straw mats
|
||||
minetest.register_node("cottages:straw_mat", {
|
||||
description = S("layer of straw"),
|
||||
drawtype = 'nodebox',
|
||||
tiles = { 'cottages_darkage_straw.png' }, -- done by VanessaE
|
||||
wield_image = 'cottages_darkage_straw.png',
|
||||
inventory_image = 'cottages_darkage_straw.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5,-0.48, 0.48, -0.45, 0.48},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.48, -0.5,-0.48, 0.48, -0.25, 0.48},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- straw bales are a must for farming environments; if you for some reason do not have the darkage mod installed, this here gets you a straw bale
|
||||
minetest.register_node("cottages:straw_bale", {
|
||||
drawtype = "nodebox",
|
||||
description = S("straw bale"),
|
||||
tiles = {"cottages_darkage_straw_bale.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
-- the bale is slightly smaller than a full node
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.45, -0.5,-0.45, 0.45, 0.45, 0.45},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.45, -0.5,-0.45, 0.45, 0.45, 0.45},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- just straw
|
||||
minetest.register_node("cottages:straw", {
|
||||
drawtype = "normal",
|
||||
description = S("straw"),
|
||||
tiles = {"cottages_darkage_straw.png"},
|
||||
groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
-- the bale is slightly smaller than a full node
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("cottages:threshing_floor", {
|
||||
drawtype = "nodebox",
|
||||
description = S("threshing floor"),
|
||||
-- TODO: stone also looks pretty well for this
|
||||
tiles = {"default_junglewood.png^farming_wheat.png","default_junglewood.png","default_junglewood.png^default_stick.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.50, -0.5,-0.50, 0.50, -0.40, 0.50},
|
||||
|
||||
{-0.50, -0.4,-0.50,-0.45, -0.20, 0.50},
|
||||
{ 0.45, -0.4,-0.50, 0.50, -0.20, 0.50},
|
||||
|
||||
{-0.45, -0.4,-0.50, 0.45, -0.20,-0.45},
|
||||
{-0.45, -0.4, 0.45, 0.45, -0.20, 0.50},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.50, -0.5,-0.50, 0.50, -0.20, 0.50},
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
meta:set_string("infotext", S("Threshing floor"));
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("harvest", 2);
|
||||
inv:set_size("straw", 4);
|
||||
inv:set_size("seeds", 4);
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("owner", placer:get_player_name() or "");
|
||||
meta:set_string("infotext", S("Threshing floor (owned by %s)"):format(meta:get_string("owner") or ""));
|
||||
meta:set_string("formspec",
|
||||
"size[8,8]"..
|
||||
"image[1.5,0;1,1;default_stick.png]"..
|
||||
"image[0,1;1,1;farming_wheat.png]"..
|
||||
"list[current_name;harvest;1,1;2,1;]"..
|
||||
"list[current_name;straw;5,0;2,2;]"..
|
||||
"list[current_name;seeds;5,2;2,2;]"..
|
||||
"label[1,0.5;"..S("Harvested wheat:").."]"..
|
||||
"label[4,0.0;"..S("Straw:").."]"..
|
||||
"label[4,2.0;"..S("Seeds:").."]"..
|
||||
"label[0,-0.5;"..S("Threshing floor").."]"..
|
||||
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string("owner") or "").."]"..
|
||||
"label[0,2.5;"..S("Punch threshing floor with a stick").."]"..
|
||||
"label[0,3.0;"..S("to get straw and seeds from wheat.").."]"..
|
||||
"list[current_player;main;0,4;8,4;]");
|
||||
end,
|
||||
|
||||
can_dig = function(pos,player)
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
local owner = meta:get_string('owner');
|
||||
|
||||
if( not( inv:is_empty("harvest"))
|
||||
or not( inv:is_empty("straw"))
|
||||
or not( inv:is_empty("seeds"))
|
||||
or not( player )
|
||||
or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then
|
||||
|
||||
return false;
|
||||
end
|
||||
return true;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return count;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- only accept input the threshing floor can use/process
|
||||
if( listname=='straw'
|
||||
or listname=='seeds'
|
||||
or (listname=='harvest' and stack and stack:get_name() ~= 'farming:wheat' )) then
|
||||
return 0;
|
||||
end
|
||||
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
if( not( pos ) or not( node ) or not( puncher )) then
|
||||
return;
|
||||
end
|
||||
-- only punching with a normal stick is supposed to work
|
||||
local wielded = puncher:get_wielded_item();
|
||||
if( not( wielded ) or not( wielded:get_name() ) or wielded:get_name() ~= 'default:stick') then
|
||||
return;
|
||||
end
|
||||
local name = puncher:get_player_name();
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
|
||||
local input = inv:get_list('harvest');
|
||||
-- we have two input slots
|
||||
local stack1 = inv:get_stack( 'harvest', 1);
|
||||
local stack2 = inv:get_stack( 'harvest', 2);
|
||||
|
||||
if( ( stack1:is_empty() and stack2:is_empty())
|
||||
or( not( stack1:is_empty()) and stack1:get_name() ~= 'farming:wheat')
|
||||
or( not( stack2:is_empty()) and stack2:get_name() ~= 'farming:wheat')) then
|
||||
|
||||
-- minetest.chat_send_player( name, 'One of the input slots contains something else than wheat, or there is no wheat at all.');
|
||||
return;
|
||||
end
|
||||
|
||||
-- on average, process 25 wheat at each punch (10..40 are possible)
|
||||
local anz_wheat = 10 + math.random( 0, 30 );
|
||||
-- we already made sure there is only wheat inside
|
||||
local found_wheat = stack1:get_count() + stack2:get_count();
|
||||
|
||||
-- do not process more wheat than present in the input slots
|
||||
if( found_wheat < anz_wheat ) then
|
||||
anz_wheat = found_wheat;
|
||||
end
|
||||
|
||||
-- this can be enlarged by a multiplicator if desired
|
||||
local anz_straw = anz_wheat;
|
||||
local anz_seeds = anz_wheat;
|
||||
|
||||
if( inv:room_for_item('straw','cottages:straw_mat '..tostring( anz_straw ))
|
||||
and inv:room_for_item('seeds','farming:seed_wheat '..tostring( anz_seeds ))) then
|
||||
|
||||
-- the player gets two kind of output
|
||||
inv:add_item("straw",'cottages:straw_mat '..tostring( anz_straw ));
|
||||
inv:add_item("seeds",'farming:seed_wheat '..tostring( anz_seeds ));
|
||||
-- consume the wheat
|
||||
inv:remove_item("harvest", 'farming:wheat '..tostring( anz_wheat ));
|
||||
|
||||
local anz_left = found_wheat - anz_wheat;
|
||||
if( anz_left > 0 ) then
|
||||
minetest.chat_send_player( name, S('You have threshed %s wheat (%s are left).'):format(anz_wheat,anz_left));
|
||||
else
|
||||
minetest.chat_send_player( name, S('You have threshed the last %s wheat.'):format(anz_wheat));
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_node("cottages:handmill", {
|
||||
drawtype = "nodebox",
|
||||
description = S("mill, powered by punching"),
|
||||
tiles = {"default_stone.png"},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
|
||||
-- taken from 3dfornitures tree redefinition
|
||||
{-0.35,-0.50,-0.4, 0.35,-0.32,0.4},
|
||||
{-0.4, -0.50,-0.35, 0.4, -0.32,0.35},
|
||||
{-0.25,-0.50,-0.45, 0.25,-0.32,0.45},
|
||||
{-0.45,-0.50,-0.25, 0.45,-0.32,0.25},
|
||||
{-0.15,-0.50,-0.5, 0.15,-0.32,0.5},
|
||||
{-0.5, -0.50,-0.15, 0.5, -0.32,0.15},
|
||||
|
||||
-- upper mill wheel
|
||||
{-0.35,-0.27,-0.4, 0.35,-0.05,0.4},
|
||||
{-0.4, -0.27,-0.35, 0.4, -0.05,0.35},
|
||||
{-0.25,-0.27,-0.45, 0.25,-0.05,0.45},
|
||||
{-0.45,-0.27,-0.25, 0.45,-0.05,0.25},
|
||||
{-0.15,-0.27,-0.5, 0.15,-0.05,0.5},
|
||||
{-0.5, -0.27,-0.15, 0.5, -0.05,0.15},
|
||||
|
||||
-- middle axis
|
||||
{-0.05,-0.50,-0.05, 0.05, 0.15,0.05},
|
||||
-- handle
|
||||
{-0.35,-0.05,-0.35,-0.25, 0.25,-0.25},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.50, -0.5,-0.50, 0.50, 0.25, 0.50},
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
meta:set_string("infotext", S("Mill, powered by punching"));
|
||||
local inv = meta:get_inventory();
|
||||
inv:set_size("seeds", 1);
|
||||
inv:set_size("flour", 4);
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("owner", placer:get_player_name() or "");
|
||||
meta:set_string("infotext", S("Mill, powered by punching (owned by %s)"):format(meta:get_string("owner") or ""));
|
||||
meta:set_string("formspec",
|
||||
"size[8,8]"..
|
||||
"image[0,1;1,1;farming_wheat_seed.png]"..
|
||||
"list[current_name;seeds;1,1;1,1;]"..
|
||||
"list[current_name;flour;5,1;2,2;]"..
|
||||
"label[0,0.5;"..S("Wheat seeds:").."]"..
|
||||
"label[4,0.5;"..S("Flour:").."]"..
|
||||
"label[0,-0.5;"..S("Mill").."]"..
|
||||
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]"..
|
||||
"label[0,2.5;"..S("Punch this hand-driven mill").."]"..
|
||||
"label[0,3.0;"..S("to convert wheat seeds into flour.").."]"..
|
||||
"list[current_player;main;0,4;8,4;]");
|
||||
end,
|
||||
|
||||
can_dig = function(pos,player)
|
||||
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
local owner = meta:get_string('owner');
|
||||
|
||||
if( not( inv:is_empty("flour"))
|
||||
or not( inv:is_empty("seeds"))
|
||||
or not( player )
|
||||
or ( owner and owner ~= '' and player:get_player_name() ~= owner )) then
|
||||
|
||||
return false;
|
||||
end
|
||||
return true;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return count;
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
-- only accept input the threshing floor can use/process
|
||||
if( listname=='flour'
|
||||
or (listname=='seeds' and stack and stack:get_name() ~= 'farming:seed_wheat' )) then
|
||||
return 0;
|
||||
end
|
||||
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if( player and player:get_player_name() ~= meta:get_string('owner' )) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
|
||||
-- this code is very similar to the threshing floor; except that it has only one input- and output-slot
|
||||
-- and does not require the usage of a stick
|
||||
on_punch = function(pos, node, puncher)
|
||||
if( not( pos ) or not( node ) or not( puncher )) then
|
||||
return;
|
||||
end
|
||||
local name = puncher:get_player_name();
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local inv = meta:get_inventory();
|
||||
|
||||
local input = inv:get_list('seeds');
|
||||
local stack1 = inv:get_stack( 'seeds', 1);
|
||||
|
||||
if( ( stack1:is_empty())
|
||||
or( not( stack1:is_empty()) and stack1:get_name() ~= 'farming:seed_wheat')) then
|
||||
|
||||
return;
|
||||
end
|
||||
|
||||
-- turning the mill is a slow process; 1-21 flour are generated per turn
|
||||
local anz = 1 + math.random( 0, 20 );
|
||||
-- we already made sure there is only wheat inside
|
||||
local found = stack1:get_count();
|
||||
|
||||
-- do not process more wheat than present in the input slots
|
||||
if( found < anz ) then
|
||||
anz = found;
|
||||
end
|
||||
|
||||
|
||||
if( inv:room_for_item('flour','farming:flour '..tostring( anz ))) then
|
||||
|
||||
inv:add_item("flour",'farming:flour '..tostring( anz ));
|
||||
inv:remove_item("seeds", 'farming:seed_wheat '..tostring( anz ));
|
||||
|
||||
local anz_left = found - anz;
|
||||
if( anz_left > 0 ) then
|
||||
minetest.chat_send_player( name, S('You have grinded %s wheat seeds (%s are left).'):format(anz,anz_left));
|
||||
else
|
||||
minetest.chat_send_player( name, S('You have grinded the last %s wheat seeds.'):format(anz));
|
||||
end
|
||||
|
||||
-- if the version of MT is recent enough, rotate the mill a bit
|
||||
if( minetest.swap_node ) then
|
||||
node.param2 = node.param2 + 1;
|
||||
if( node.param2 > 3 ) then
|
||||
node.param2 = 0;
|
||||
end
|
||||
minetest.swap_node( pos, node );
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- crafting receipes
|
||||
---------------------------------------------------------------------------------------
|
||||
-- this returns corn as well
|
||||
-- the replacements work only if the replaced slot gets empty...
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_mat 6",
|
||||
recipe = {
|
||||
{'default:cobble','',''},
|
||||
{"farming:wheat_harvested", "farming:wheat_harvested", "farming:wheat_harvested", },
|
||||
},
|
||||
replacements = {{ 'default:cobble', "farming:seed_wheat 3" }},
|
||||
})
|
||||
|
||||
-- this is a better way to get straw mats
|
||||
minetest.register_craft({
|
||||
output = "cottages:threshing_floor",
|
||||
recipe = {
|
||||
{"default:junglewood", "default:chest_locked", "default:junglewood", },
|
||||
{"default:junglewood", "default:stone", "default:junglewood", },
|
||||
},
|
||||
})
|
||||
|
||||
-- and a way to turn wheat seeds into flour
|
||||
minetest.register_craft({
|
||||
output = "cottages:handmill",
|
||||
recipe = {
|
||||
{"default:stick", "default:stone", "", },
|
||||
{"", "default:steel_ingot", "", },
|
||||
{"", "default:stone", "", },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_bale",
|
||||
recipe = {
|
||||
{"cottages:straw_mat"},
|
||||
{"cottages:straw_mat"},
|
||||
{"cottages:straw_mat"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw",
|
||||
recipe = {
|
||||
{"cottages:straw_bale"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_bale",
|
||||
recipe = {
|
||||
{"cottages:straw"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "cottages:straw_mat 3",
|
||||
recipe = {
|
||||
{"cottages:straw_bale"},
|
||||
},
|
||||
})
|
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 536 B |
After Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 502 B |
After Width: | Height: | Size: 633 B |
After Width: | Height: | Size: 605 B |
After Width: | Height: | Size: 852 B |
After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 750 B |
After Width: | Height: | Size: 975 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 567 B |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 791 B |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 135 B |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 184 B |
|
@ -1520,6 +1520,7 @@ minetest.register_node("default:snow", {
|
|||
leveled = 7,
|
||||
drawtype = "nodebox",
|
||||
freezemelt = "default:water_flowing",
|
||||
walkable=false,
|
||||
node_box = {
|
||||
type = "leveled",
|
||||
fixed = {
|
||||
|
@ -1531,12 +1532,6 @@ minetest.register_node("default:snow", {
|
|||
footstep = {name="default_snow_footstep", gain=0.25},
|
||||
dug = {name="default_snow_footstep", gain=0.75},
|
||||
}),
|
||||
on_construct = function(pos)
|
||||
pos.y = pos.y - 1
|
||||
if minetest.get_node(pos).name == "default:dirt_with_grass" then
|
||||
minetest.set_node(pos, {name="default:dirt_with_snow"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_alias("snow", "default:snow")
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@ else
|
|||
end
|
||||
end
|
||||
|
||||
local function hide_builtin(player)
|
||||
player:hud_set_flags({crosshair = true, hotbar = true, healthbar = false, wielditem = true, breathbar = false})
|
||||
end
|
||||
|
||||
|
||||
local function custom_hud(player)
|
||||
local name = player:get_player_name()
|
||||
|
@ -188,6 +184,10 @@ local function custom_hud(player)
|
|||
|
||||
end
|
||||
|
||||
local function hide_builtin(player)
|
||||
player:hud_set_flags({crosshair = true, hotbar = true, healthbar = false, wielditem = true, breathbar = false})
|
||||
end
|
||||
|
||||
--needs to be defined for older version of 3darmor
|
||||
function hud.set_armor()
|
||||
end
|
||||
|
|
|
@ -7,12 +7,18 @@ buildings = {
|
|||
{sizex= 7, sizez= 7, yoff= 0, ysize=11, scm="fountain", weight=1/4, pervillage=3},
|
||||
{sizex= 5, sizez= 5, yoff= 0, ysize= 6, scm="small_house", orients={3}},
|
||||
{sizex= 6, sizez=12, yoff= 0, ysize= 7, scm="house_with_garden", orients={1}},
|
||||
{sizex=16, sizez=17, yoff= 0, ysize=12, scm="church", orients={3}, pervillage=1},
|
||||
{sizex= 5, sizez= 5, yoff= 0, ysize=16, scm="tower", orients={0}, weight=1/7},
|
||||
{sizex=16, sizez=19, yoff=-1, ysize=14, scm="church", orients={3}, pervillage=1},
|
||||
{sizex= 8, sizez= 9, yoff= 0, ysize= 6, scm="forge", orients={0}, pervillage=2},
|
||||
{sizex=11, sizez=12, yoff= 0, ysize= 6, scm="library", orients={1}, pervillage=2},
|
||||
{sizex=12, sizez=13, yoff= 0, ysize= 6, scm="library", orients={1}, pervillage=2},
|
||||
{sizex=15, sizez= 7, yoff= 0, ysize=12, scm="inn", orients={1}, pervillage=4, weight=1/2},
|
||||
{sizex=22, sizez=17, yoff= 0, ysize= 7, scm="pub", orients={3}, pervillage=2, weight=1/3},
|
||||
{sizex=22, sizez=17, yoff= 0, ysize= 7, scm="pub", orients={3}, pervillage=1, weight=1/3},
|
||||
{sizex=11, sizez=13, yoff= 1, ysize=12, scm="pub2", orients={3}, pervillage=1, weight=1/3},
|
||||
{sizex=12, sizez=10, yoff= 1, ysize= 9, scm="house1",orients={4}},
|
||||
{sizex=13, sizez=10, yoff= 1, ysize= 9, scm="house2",orients={4}},
|
||||
{sizex=13, sizez=11, yoff= 1, ysize= 8, scm="house3",orients={4}},
|
||||
{sizex=14, sizez=12, yoff= 1, ysize= 8, scm="farmtiny1",orients={4}},
|
||||
{sizex=12, sizez=26, yoff= 1, ysize=19, scm="largechurch", orients={1},pervillage=1},
|
||||
|
||||
}
|
||||
|
||||
local gravel = minetest.get_content_id("default:gravel")
|
||||
|
|
|
@ -622,6 +622,8 @@ local function mg_generate(minp, maxp, emin, emax, vm)
|
|||
|
||||
local meta
|
||||
for _, n in pairs(to_add) do
|
||||
--print(tostring(n.node.name))
|
||||
if n.node.name ~= "air" then
|
||||
minetest.set_node(n.pos, n.node)
|
||||
if n.meta ~= nil then
|
||||
meta = minetest.get_meta(n.pos)
|
||||
|
@ -654,6 +656,14 @@ local function mg_generate(minp, maxp, emin, emax, vm)
|
|||
end
|
||||
end
|
||||
end
|
||||
if n.node.name == "mobs:spawner" then
|
||||
meta = minetest.get_meta(n.pos)
|
||||
meta:set_string("entity",n.mob)
|
||||
meta:set_int("active_objects",2)
|
||||
meta:set_int("active_objects_wider",12)
|
||||
meta:set_string("infotext",n.mob)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,475 @@
|
|||
2 1 3 stairs:slab_wood 157 0
|
||||
2 1 4 stairs:slab_wood 173 0
|
||||
2 1 5 stairs:slab_wood 157 0
|
||||
2 1 6 stairs:slab_wood 173 0
|
||||
2 1 7 stairs:slab_wood 157 0
|
||||
3 1 2 stairs:slab_wood 125 0
|
||||
3 1 3 default:cobble 0 0
|
||||
3 1 4 cottages:loam 0 0
|
||||
3 1 5 cottages:loam 0 0
|
||||
3 1 6 cottages:loam 0 0
|
||||
3 1 7 default:cobble 0 0
|
||||
3 1 8 stairs:slab_cobble 157 0
|
||||
3 1 9 stairs:slab_cobble 157 0
|
||||
3 1 10 stairs:slab_cobble 173 0
|
||||
3 1 11 default:cobble 0 0
|
||||
3 2 3 default:tree 0 0
|
||||
3 2 4 default:fence_wood 205 0
|
||||
3 2 6 default:fence_wood 205 0
|
||||
3 2 7 default:tree 0 0
|
||||
3 2 11 default:tree 0 0
|
||||
3 3 3 default:tree 0 0
|
||||
3 3 4 default:torch 0 1
|
||||
3 3 6 default:torch 0 1
|
||||
3 3 7 default:tree 0 0
|
||||
3 3 11 default:torch 15 1
|
||||
3 4 2 cottages:roof_flat_straw 173 1
|
||||
3 4 3 cottages:roof_flat_straw 189 1
|
||||
3 4 4 cottages:roof_flat_straw 205 1
|
||||
3 4 5 cottages:roof_flat_straw 189 1
|
||||
3 4 6 cottages:roof_flat_straw 205 1
|
||||
3 4 7 cottages:roof_flat_straw 189 1
|
||||
3 4 8 cottages:roof_flat_straw 173 1
|
||||
4 1 2 stairs:slab_wood 141 0
|
||||
4 1 3 cottages:loam 0 0
|
||||
4 1 4 cottages:loam 0 0
|
||||
4 1 5 cottages:loam 0 0
|
||||
4 1 6 cottages:loam 0 0
|
||||
4 1 7 default:cobble 0 0
|
||||
4 1 8 default:cobble 0 0
|
||||
4 1 9 default:cobble 0 0
|
||||
4 1 10 default:cobble 0 0
|
||||
4 1 11 default:cobble 0 0
|
||||
4 1 12 stairs:slab_cobble 157 0
|
||||
4 4 2 cottages:roof_flat_straw 157 3
|
||||
4 4 3 cottages:roof_flat_straw 173 3
|
||||
4 4 4 cottages:roof_flat_straw 189 3
|
||||
4 4 5 cottages:roof_flat_straw 173 3
|
||||
4 4 6 cottages:roof_flat_straw 189 3
|
||||
4 4 7 cottages:roof_flat_straw 173 3
|
||||
4 4 8 cottages:roof_flat_straw 189 3
|
||||
5 1 2 stairs:slab_wood 124 0
|
||||
5 1 3 cottages:loam 0 0
|
||||
5 1 4 cottages:loam 0 0
|
||||
5 1 5 cottages:loam 0 0
|
||||
5 1 6 cottages:loam 0 0
|
||||
5 1 7 default:cobble 0 0
|
||||
5 1 8 default:cobble 0 0
|
||||
5 1 9 default:cobble 0 0
|
||||
5 1 10 default:cobble 0 0
|
||||
5 1 11 default:cobble 0 0
|
||||
5 1 12 stairs:slab_cobble 140 0
|
||||
5 2 7 cottages:bench 188 1
|
||||
5 2 8 cottages:bench 205 1
|
||||
5 2 10 cottages:bench 173 1
|
||||
5 2 11 cottages:bench 173 1
|
||||
5 3 1 cottages:roof_straw 141 1
|
||||
5 3 8 default:torch 0 2
|
||||
5 3 10 cottages:roof_straw 189 1
|
||||
5 3 11 cottages:roof_straw 189 1
|
||||
5 3 12 cottages:roof_straw 173 1
|
||||
5 3 13 cottages:roof_straw 157 1
|
||||
5 4 2 cottages:roof_flat_straw 141 1
|
||||
5 4 3 cottages:roof_flat_straw 157 1
|
||||
5 4 4 cottages:roof_flat_straw 173 1
|
||||
5 4 5 cottages:roof_flat_straw 157 1
|
||||
5 4 6 cottages:roof_flat_straw 173 1
|
||||
5 4 7 cottages:roof_flat_straw 189 1
|
||||
5 4 8 cottages:roof_flat_straw 205 1
|
||||
6 1 2 stairs:slab_wood 108 0
|
||||
6 1 3 default:cobble 0 0
|
||||
6 1 4 cottages:loam 0 0
|
||||
6 1 5 cottages:loam 0 0
|
||||
6 1 6 cottages:loam 0 0
|
||||
6 1 7 default:cobble 0 0
|
||||
6 1 8 default:cobble 0 0
|
||||
6 1 9 default:cobble 0 0
|
||||
6 1 10 default:cobble 0 0
|
||||
6 1 11 default:cobble 0 0
|
||||
6 1 12 stairs:slab_cobble 124 0
|
||||
6 2 3 default:tree 0 0
|
||||
6 2 4 default:fence_wood 155 0
|
||||
6 2 6 default:fence_wood 171 0
|
||||
6 2 7 default:tree 0 0
|
||||
6 2 8 default:wood 0 0
|
||||
6 2 9 doors:door_wood_b_1 173 1
|
||||
6 2 10 default:wood 0 0
|
||||
6 2 11 default:tree 0 0
|
||||
6 3 3 default:tree 0 0
|
||||
6 3 4 default:fence_wood 172 0
|
||||
6 3 6 default:fence_wood 188 0
|
||||
6 3 7 default:tree 0 0
|
||||
6 3 8 default:wood 0 0
|
||||
6 3 9 doors:door_wood_t_1 189 1
|
||||
6 3 10 default:wood 0 0
|
||||
6 3 11 default:tree 0 0
|
||||
6 4 1 cottages:roof_straw 109 1
|
||||
6 4 2 cottages:roof_connector_straw 125 1
|
||||
6 4 3 cottages:roof_straw 141 1
|
||||
6 4 4 cottages:roof_straw 157 1
|
||||
6 4 5 cottages:roof_straw 157 1
|
||||
6 4 6 cottages:roof_straw 173 1
|
||||
6 4 7 cottages:roof_straw 189 1
|
||||
6 4 8 cottages:roof_connector_straw 189 1
|
||||
6 4 9 cottages:roof_straw 173 1
|
||||
6 4 10 cottages:roof_straw 157 1
|
||||
6 4 11 cottages:roof_straw 157 1
|
||||
6 4 12 cottages:roof_connector_straw 141 1
|
||||
6 4 13 cottages:roof_straw 125 1
|
||||
7 1 2 default:cobble 0 0
|
||||
7 1 3 cottages:loam 0 0
|
||||
7 1 4 cottages:loam 0 0
|
||||
7 1 5 cottages:loam 0 0
|
||||
7 1 6 cottages:loam 0 0
|
||||
7 1 7 cottages:loam 0 0
|
||||
7 1 8 default:cobble 0 0
|
||||
7 1 9 default:cobble 0 0
|
||||
7 1 10 default:cobble 0 0
|
||||
7 1 11 default:cobble 0 0
|
||||
7 1 12 default:cobble 0 0
|
||||
7 2 2 default:wood 0 0
|
||||
7 2 7 default:chest 0 0
|
||||
7 2 8 default:wood 0 0
|
||||
7 2 10 cottages:bench 187 3
|
||||
7 2 11 cottages:bench 204 3
|
||||
7 2 12 default:wood 0 0
|
||||
7 3 2 default:wood 0 0
|
||||
7 3 7 default:torch 0 4
|
||||
7 3 8 default:wood 0 0
|
||||
7 3 11 default:torch 0 4
|
||||
7 3 12 default:wood 0 0
|
||||
7 4 2 default:wood 0 0
|
||||
7 4 8 default:wood 0 0
|
||||
7 4 9 default:wood 0 0
|
||||
7 4 10 default:wood 0 0
|
||||
7 4 11 default:wood 0 0
|
||||
7 4 12 default:wood 0 0
|
||||
7 5 1 cottages:roof_straw 93 1
|
||||
7 5 2 cottages:roof_connector_straw 109 1
|
||||
7 5 3 cottages:roof_straw 125 1
|
||||
7 5 4 cottages:roof_straw 141 1
|
||||
7 5 5 cottages:roof_straw 157 1
|
||||
7 5 6 cottages:roof_straw 173 1
|
||||
7 5 7 cottages:roof_straw 189 1
|
||||
7 5 8 cottages:roof_connector_straw 173 1
|
||||
7 5 9 cottages:roof_straw 157 1
|
||||
7 5 10 cottages:roof_straw 141 1
|
||||
7 5 11 cottages:roof_straw 125 1
|
||||
7 5 12 cottages:roof_connector_straw 109 1
|
||||
7 5 13 cottages:roof_straw 125 1
|
||||
8 1 2 default:cobble 0 0
|
||||
8 1 3 cottages:loam 0 0
|
||||
8 1 4 cottages:loam 0 0
|
||||
8 1 5 cottages:loam 0 0
|
||||
8 1 6 cottages:loam 0 0
|
||||
8 1 7 cottages:loam 0 0
|
||||
8 1 8 default:cobble 0 0
|
||||
8 1 9 default:cobble 0 0
|
||||
8 1 10 default:cobble 0 0
|
||||
8 1 11 default:cobble 0 0
|
||||
8 1 12 default:cobble 0 0
|
||||
8 2 2 default:wood 0 0
|
||||
8 2 5 default:ladder 153 2
|
||||
8 2 8 doors:door_wood_b_1 170 0
|
||||
8 2 11 default:furnace 0 0
|
||||
8 2 12 default:wood 0 0
|
||||
8 3 2 default:fence_wood 124 0
|
||||
8 3 5 default:ladder 170 2
|
||||
8 3 8 doors:door_wood_t_1 187 0
|
||||
8 3 12 default:glass 188 0
|
||||
8 4 2 default:wood 0 0
|
||||
8 4 8 default:wood 0 0
|
||||
8 4 9 default:wood 0 0
|
||||
8 4 10 default:wood 0 0
|
||||
8 4 11 default:wood 0 0
|
||||
8 4 12 default:wood 0 0
|
||||
8 5 2 default:wood 0 0
|
||||
8 5 3 default:fence_wood 108 0
|
||||
8 5 4 default:fence_wood 124 0
|
||||
8 5 6 default:fence_wood 156 0
|
||||
8 5 7 default:fence_wood 172 0
|
||||
8 5 8 default:wood 0 0
|
||||
8 5 9 default:chest 0 2
|
||||
8 5 11 cottages:bed_head 140 3
|
||||
8 5 12 default:wood 0 0
|
||||
8 6 1 cottages:roof_straw 61 1
|
||||
8 6 2 cottages:roof_connector_straw 77 1
|
||||
8 6 3 cottages:roof_straw 93 1
|
||||
8 6 4 cottages:roof_straw 109 1
|
||||
8 6 5 cottages:roof_straw 125 1
|
||||
8 6 6 cottages:roof_straw 141 1
|
||||
8 6 7 cottages:roof_straw 157 1
|
||||
8 6 8 cottages:roof_straw 173 1
|
||||
8 6 9 cottages:roof_straw 189 1
|
||||
8 6 10 cottages:roof_straw 173 1
|
||||
8 6 11 cottages:roof_straw 157 1
|
||||
8 6 12 cottages:roof_connector_straw 141 1
|
||||
8 6 13 cottages:roof_straw 125 1
|
||||
9 1 2 default:cobble 0 0
|
||||
9 1 3 cottages:loam 0 0
|
||||
9 1 4 cottages:loam 0 0
|
||||
9 1 5 cottages:loam 0 0
|
||||
9 1 6 cottages:loam 0 0
|
||||
9 1 7 cottages:loam 0 0
|
||||
9 1 8 default:cobble 0 0
|
||||
9 1 9 default:cobble 0 0
|
||||
9 1 10 default:cobble 0 0
|
||||
9 1 11 default:cobble 0 0
|
||||
9 1 12 default:cobble 0 0
|
||||
9 2 2 default:wood 0 0
|
||||
9 2 3 default:fence_wood 105 0
|
||||
9 2 4 default:fence_wood 120 0
|
||||
9 2 5 default:fence_wood 136 0
|
||||
9 2 6 default:fence_wood 153 0
|
||||
9 2 7 default:fence_wood 170 0
|
||||
9 2 8 default:wood 0 0
|
||||
9 2 9 default:ladder 170 5
|
||||
9 2 10 cottages:bench 187 1
|
||||
9 2 11 cottages:bench 204 1
|
||||
9 2 12 default:wood 0 0
|
||||
9 3 2 default:wood 0 0
|
||||
9 3 3 default:fence_wood 122 0
|
||||
9 3 5 default:fence_wood 153 0
|
||||
9 3 7 default:fence_wood 187 0
|
||||
9 3 8 default:wood 0 0
|
||||
9 3 9 default:ladder 187 5
|
||||
9 3 11 default:torch 0 4
|
||||
9 3 12 default:wood 0 0
|
||||
9 4 2 default:wood 0 0
|
||||
9 4 3 stairs:slab_wood 106 0
|
||||
9 4 4 stairs:slab_wood 122 0
|
||||
9 4 6 stairs:slab_wood 154 0
|
||||
9 4 7 stairs:slab_wood 170 0
|
||||
9 4 8 default:wood 0 0
|
||||
9 4 9 default:ladder 170 5
|
||||
9 4 10 default:wood 0 0
|
||||
9 4 11 default:wood 0 0
|
||||
9 4 12 default:wood 0 0
|
||||
9 5 2 default:wood 0 0
|
||||
9 5 8 default:wood 0 0
|
||||
9 5 9 default:ladder 187 5
|
||||
9 5 11 cottages:bed_foot 155 3
|
||||
9 5 12 default:wood 0 0
|
||||
9 6 2 default:wood 0 0
|
||||
9 6 8 default:wood 0 0
|
||||
9 6 9 default:ladder 204 5
|
||||
9 6 12 default:wood 0 0
|
||||
9 7 1 cottages:roof_straw 61 1
|
||||
9 7 2 cottages:roof_connector_straw 77 1
|
||||
9 7 3 cottages:roof_straw 93 1
|
||||
9 7 4 cottages:roof_straw 109 1
|
||||
9 7 5 cottages:roof_straw 125 1
|
||||
9 7 6 cottages:roof_straw 141 1
|
||||
9 7 7 cottages:roof_straw 157 1
|
||||
9 7 8 cottages:roof_straw 173 1
|
||||
9 7 9 cottages:roof_straw 189 1
|
||||
9 7 10 cottages:roof_straw 173 1
|
||||
9 7 11 cottages:roof_straw 157 1
|
||||
9 7 12 cottages:roof_connector_straw 141 1
|
||||
9 7 13 cottages:roof_straw 125 1
|
||||
10 1 2 default:cobble 0 0
|
||||
10 1 3 cottages:loam 0 0
|
||||
10 1 4 cottages:loam 0 0
|
||||
10 1 5 cottages:loam 0 0
|
||||
10 1 6 cottages:loam 0 0
|
||||
10 1 7 cottages:loam 0 0
|
||||
10 1 8 default:cobble 0 0
|
||||
10 1 9 default:cobble 0 0
|
||||
10 1 10 default:cobble 0 0
|
||||
10 1 11 default:cobble 0 0
|
||||
10 1 12 default:cobble 0 0
|
||||
10 2 2 default:wood 0 0
|
||||
10 2 5 default:fence_wood 120 0
|
||||
10 2 8 default:wood 0 0
|
||||
10 2 9 doors:door_wood_b_1 170 1
|
||||
10 2 10 default:wood 0 0
|
||||
10 2 11 default:wood 0 0
|
||||
10 2 12 default:wood 0 0
|
||||
10 3 2 default:wood 0 0
|
||||
10 3 5 default:fence_wood 137 0
|
||||
10 3 8 default:wood 0 0
|
||||
10 3 9 doors:door_wood_t_1 187 1
|
||||
10 3 10 default:wood 0 0
|
||||
10 3 11 default:wood 0 0
|
||||
10 3 12 default:wood 0 0
|
||||
10 4 2 default:wood 0 0
|
||||
10 4 3 stairs:slab_wood 90 0
|
||||
10 4 4 stairs:slab_wood 106 0
|
||||
10 4 5 stairs:slab_wood 122 0
|
||||
10 4 6 stairs:slab_wood 138 0
|
||||
10 4 7 stairs:slab_wood 154 0
|
||||
10 4 8 default:wood 0 0
|
||||
10 4 9 default:wood 0 0
|
||||
10 4 10 default:wood 0 0
|
||||
10 4 11 default:wood 0 0
|
||||
10 4 12 default:wood 0 0
|
||||
10 5 2 default:fence_wood 60 0
|
||||
10 5 8 default:wood 0 0
|
||||
10 5 12 default:wood 0 0
|
||||
10 6 2 default:wood 0 0
|
||||
10 6 8 default:wood 0 0
|
||||
10 6 9 default:torch 0 5
|
||||
10 6 12 default:fence_wood 172 0
|
||||
10 7 1 cottages:roof_straw 77 3
|
||||
10 7 2 cottages:roof_connector_straw 93 3
|
||||
10 7 3 cottages:roof_straw 109 3
|
||||
10 7 4 cottages:roof_straw 125 3
|
||||
10 7 5 cottages:roof_straw 141 3
|
||||
10 7 6 cottages:roof_straw 157 3
|
||||
10 7 7 cottages:roof_straw 173 3
|
||||
10 7 8 cottages:roof_straw 189 3
|
||||
10 7 9 cottages:roof_straw 205 3
|
||||
10 7 10 cottages:roof_straw 189 3
|
||||
10 7 11 cottages:roof_straw 173 3
|
||||
10 7 12 cottages:roof_connector_straw 157 3
|
||||
10 7 13 cottages:roof_straw 141 3
|
||||
11 1 2 default:cobble 0 0
|
||||
11 1 3 cottages:loam 0 0
|
||||
11 1 4 cottages:loam 0 0
|
||||
11 1 5 cottages:loam 0 0
|
||||
11 1 6 cottages:loam 0 0
|
||||
11 1 7 cottages:loam 0 0
|
||||
11 1 8 default:cobble 0 0
|
||||
11 1 9 default:cobble 0 0
|
||||
11 1 10 default:cobble 0 0
|
||||
11 1 11 default:cobble 0 0
|
||||
11 1 12 default:cobble 0 0
|
||||
11 2 2 default:wood 0 0
|
||||
11 2 5 default:fence_wood 105 0
|
||||
11 2 8 default:wood 0 0
|
||||
11 2 12 default:wood 0 0
|
||||
11 3 2 default:fence_wood 76 0
|
||||
11 3 5 default:fence_wood 122 0
|
||||
11 3 8 default:wood 0 0
|
||||
11 3 12 default:glass 156 0
|
||||
11 4 2 default:wood 0 0
|
||||
11 4 3 stairs:slab_wood 75 0
|
||||
11 4 4 stairs:slab_wood 91 0
|
||||
11 4 5 stairs:slab_wood 107 0
|
||||
11 4 6 stairs:slab_wood 123 0
|
||||
11 4 7 stairs:slab_wood 139 0
|
||||
11 4 8 default:wood 0 0
|
||||
11 4 9 default:wood 0 0
|
||||
11 4 10 default:wood 0 0
|
||||
11 4 11 default:wood 0 0
|
||||
11 4 12 default:wood 0 0
|
||||
11 5 2 default:wood 0 0
|
||||
11 5 8 default:wood 0 0
|
||||
11 5 9 default:chest 0 1
|
||||
11 5 10 cottages:bed_foot 172 0
|
||||
11 5 11 cottages:bed_head 156 0
|
||||
11 5 12 default:wood 0 0
|
||||
11 6 1 cottages:roof_straw 77 3
|
||||
11 6 2 cottages:roof_connector_straw 93 3
|
||||
11 6 3 cottages:roof_straw 109 3
|
||||
11 6 4 cottages:roof_straw 125 3
|
||||
11 6 5 cottages:roof_straw 141 3
|
||||
11 6 6 cottages:roof_straw 157 3
|
||||
11 6 7 cottages:roof_straw 173 3
|
||||
11 6 8 cottages:roof_straw 189 3
|
||||
11 6 9 cottages:roof_straw 205 3
|
||||
11 6 10 cottages:roof_straw 189 3
|
||||
11 6 11 cottages:roof_straw 173 3
|
||||
11 6 12 cottages:roof_connector_straw 157 3
|
||||
11 6 13 cottages:roof_straw 141 3
|
||||
12 1 2 default:cobble 0 0
|
||||
12 1 3 cottages:loam 0 0
|
||||
12 1 4 cottages:loam 0 0
|
||||
12 1 5 cottages:loam 0 0
|
||||
12 1 6 cottages:loam 0 0
|
||||
12 1 7 cottages:loam 0 0
|
||||
12 1 8 default:cobble 0 0
|
||||
12 1 9 default:cobble 0 0
|
||||
12 1 10 default:cobble 0 0
|
||||
12 1 11 default:cobble 0 0
|
||||
12 1 12 default:cobble 0 0
|
||||
12 2 2 default:wood 0 0
|
||||
12 2 5 default:fence_wood 90 0
|
||||
12 2 8 default:wood 0 0
|
||||
12 2 9 default:furnace 0 1
|
||||
12 2 10 default:cobble 0 0
|
||||
12 2 11 stairs:slab_wood 170 0
|
||||
12 2 12 default:wood 0 0
|
||||
12 3 2 default:wood 0 0
|
||||
12 3 5 default:fence_wood 107 0
|
||||
12 3 8 default:wood 0 0
|
||||
12 3 9 default:torch 0 2
|
||||
12 3 11 stairs:slab_wood 187 0
|
||||
12 3 12 default:wood 0 0
|
||||
12 4 2 default:wood 0 0
|
||||
12 4 3 stairs:slab_wood 60 0
|
||||
12 4 4 stairs:slab_wood 76 0
|
||||
12 4 5 stairs:slab_wood 92 0
|
||||
12 4 6 stairs:slab_wood 108 0
|
||||
12 4 7 stairs:slab_wood 124 0
|
||||
12 4 8 default:wood 0 0
|
||||
12 4 9 default:wood 0 0
|
||||
12 4 10 default:wood 0 0
|
||||
12 4 11 default:wood 0 0
|
||||
12 4 12 default:wood 0 0
|
||||
12 5 1 cottages:roof_straw 45 3
|
||||
12 5 2 cottages:roof_connector_straw 61 3
|
||||
12 5 3 cottages:roof_straw 77 3
|
||||
12 5 4 cottages:roof_straw 93 3
|
||||
12 5 5 cottages:roof_straw 109 3
|
||||
12 5 6 cottages:roof_straw 125 3
|
||||
12 5 7 cottages:roof_straw 141 3
|
||||
12 5 8 cottages:roof_connector_straw 157 3
|
||||
12 5 9 cottages:roof_straw 173 3
|
||||
12 5 10 cottages:roof_straw 157 3
|
||||
12 5 11 cottages:roof_straw 141 3
|
||||
12 5 12 cottages:roof_connector_straw 125 3
|
||||
12 5 13 cottages:roof_straw 109 3
|
||||
13 1 3 default:cobble 0 0
|
||||
13 1 4 default:cobble 0 0
|
||||
13 1 5 default:cobble 0 0
|
||||
13 1 6 default:cobble 0 0
|
||||
13 1 7 default:cobble 0 0
|
||||
13 1 8 default:cobble 0 0
|
||||
13 1 9 default:cobble 0 0
|
||||
13 1 10 default:cobble 0 0
|
||||
13 1 11 default:cobble 0 0
|
||||
13 2 3 default:tree 0 0
|
||||
13 2 4 default:wood 0 0
|
||||
13 2 5 default:wood 0 0
|
||||
13 2 6 default:wood 0 0
|
||||
13 2 7 default:tree 0 0
|
||||
13 2 8 default:wood 0 0
|
||||
13 2 9 default:wood 0 0
|
||||
13 2 10 default:wood 0 0
|
||||
13 2 11 default:tree 0 0
|
||||
13 3 3 default:tree 0 0
|
||||
13 3 4 default:wood 0 0
|
||||
13 3 5 default:wood 0 0
|
||||
13 3 6 default:wood 0 0
|
||||
13 3 7 default:tree 0 0
|
||||
13 3 8 default:wood 0 0
|
||||
13 3 9 default:wood 0 0
|
||||
13 3 10 default:wood 0 0
|
||||
13 3 11 default:tree 0 0
|
||||
13 4 1 cottages:roof_straw 13 3
|
||||
13 4 2 cottages:roof_connector_straw 29 3
|
||||
13 4 3 cottages:roof_straw 45 3
|
||||
13 4 4 cottages:roof_straw 61 3
|
||||
13 4 5 cottages:roof_straw 77 3
|
||||
13 4 6 cottages:roof_straw 93 3
|
||||
13 4 7 cottages:roof_straw 109 3
|
||||
13 4 8 cottages:roof_connector_straw 125 3
|
||||
13 4 9 cottages:roof_straw 141 3
|
||||
13 4 10 cottages:roof_straw 125 3
|
||||
13 4 11 cottages:roof_straw 109 3
|
||||
13 4 12 cottages:roof_connector_straw 93 3
|
||||
13 4 13 cottages:roof_straw 93 3
|
||||
14 3 1 cottages:roof_straw 13 3
|
||||
14 3 2 cottages:roof_straw 13 3
|
||||
14 3 3 cottages:roof_straw 13 3
|
||||
14 3 4 cottages:roof_straw 29 3
|
||||
14 3 5 cottages:roof_straw 45 3
|
||||
14 3 6 cottages:roof_straw 61 3
|
||||
14 3 7 cottages:roof_straw 77 3
|
||||
14 3 8 cottages:roof_straw 93 3
|
||||
14 3 9 cottages:roof_straw 109 3
|
||||
14 3 10 cottages:roof_straw 93 3
|
||||
14 3 11 cottages:roof_straw 77 3
|
||||
14 3 12 cottages:roof_straw 77 3
|
||||
14 3 13 cottages:roof_straw 93 3
|
|
@ -395,32 +395,40 @@ local function generate_building(pos, minp, maxp, data, a, pr, extranodes, barba
|
|||
for z = 0, pos.bsizez-1 do
|
||||
ax, ay, az = pos.x+x, pos.y+y+binfo.yoff, pos.z+z
|
||||
if (ax >= minp.x and ax <= maxp.x) and (ay >= minp.y and ay <= maxp.y) and (az >= minp.z and az <= maxp.z) then
|
||||
if scm[y+1] ~= nil then
|
||||
if scm[y+1][x+1] ~= nil then
|
||||
if scm[y+1][x+1][z+1] ~= nil then
|
||||
t = scm[y+1][x+1][z+1]
|
||||
if type(t) == "table" then
|
||||
table.insert(extranodes, {node=t.node, meta=t.meta, pos={x=ax, y=ay, z=az},})
|
||||
newBuilding = true
|
||||
elseif t ~= c_ignore then
|
||||
elseif t ~= c_ignore and t ~= c_air then
|
||||
data[a:index(ax, ay, az)] = t
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if newBuilding == true then
|
||||
|
||||
--print("New building around "..minetest.pos_to_string(pos))
|
||||
local numNPCs = math.random(0,1)
|
||||
--print("Spawning "..tostring(numNPCs).." NPCs")
|
||||
if numNPCs > 0 then
|
||||
for i=0,numNPCs,1 do
|
||||
npos = pos
|
||||
local npos = pos
|
||||
npos.x = npos.x + math.random(-8,8)
|
||||
npos.y = npos.y + 2
|
||||
npos.z = npos.z + math.random(-8,8)
|
||||
|
||||
local spawnerpos = {x=npos.x, y=npos.y, z=npos.z}
|
||||
spawnerpos.y = spawnerpos.y - 5
|
||||
|
||||
if barbarian_village == true then
|
||||
local bidx = math.random(0,#mobs.barbarians)
|
||||
local barbarian = mobs.barbarians[bidx]
|
||||
local barbarian = mobs:get_random('barbarian')
|
||||
minetest.log("action","Spawning "..barbarian.." at "..minetest.pos_to_string(npos))
|
||||
local mob = minetest.add_entity(pos, barbarian)
|
||||
if mob then
|
||||
|
@ -428,16 +436,20 @@ local function generate_building(pos, minp, maxp, data, a, pr, extranodes, barba
|
|||
mob = mob:get_luaentity()
|
||||
local newHP = mob.hp_min + math.floor( mob.hp_max * distance_rating )
|
||||
mob.object:set_hp( newHP )
|
||||
local metatable = { fields = { entity = barbarian, active_objects = 6 } }
|
||||
table.insert(extranodes, {node={name="mobs:spawner",param1=0, param2=0}, pos=spawnerpos,mob="barbarian"})
|
||||
end
|
||||
else
|
||||
local npcidx = math.random(0,#mobs.npcs)
|
||||
local npc = mobs.npcs[npcidx]
|
||||
|
||||
local npc = mobs:get_random('npc')
|
||||
minetest.log("action","Spawning "..npc.." at "..minetest.pos_to_string(npos))
|
||||
local mob = minetest.add_entity(pos, npc)
|
||||
if mob then
|
||||
mob = mob:get_luaentity()
|
||||
local p = mob.object:getpos()
|
||||
math.randomseed( ( p.x * p.y * p.z ) )
|
||||
local metatable = { fields = { entity = npc, active_objects = 6 } }
|
||||
table.insert(extranodes, {node={name="mobs:spawner",param1=0, param2=0}, pos=spawnerpos, mob="npc"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ local function numk(tbl)
|
|||
for a, b in pairs(tbl) do
|
||||
i = i + 1
|
||||
end
|
||||
return o
|
||||
return i
|
||||
end
|
||||
|
||||
function import_scm(scm)
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
mobs:register_mob("mobs:rabbit", {
|
||||
type = "animal",
|
||||
hp_min = 8,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.3, 0.2},
|
||||
textures = {"mobs_rabbit.png"},
|
||||
visual = "mesh",
|
||||
mesh = "rabbit.x",
|
||||
visual_size = {x=0.5,y=0.5},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mobs:meat_raw",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
sounds = {
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 30,
|
||||
walk_start = 40,
|
||||
walk_end = 60,
|
||||
},
|
||||
view_range = 5,
|
||||
jump = true,
|
||||
step=1,
|
||||
passive = true,
|
||||
blood_amount = 5,
|
||||
blood_offset = 0,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:rabbit_brown", {
|
||||
type = "animal",
|
||||
hp_min = 8,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.3, 0.2},
|
||||
textures = {"mobs_rabbit_brown.png"},
|
||||
visual = "mesh",
|
||||
mesh = "rabbit.x",
|
||||
visual_size = {x=0.5,y=0.5},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mobs:meat_raw",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
sounds = {
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 30,
|
||||
walk_start = 40,
|
||||
walk_end = 60,
|
||||
},
|
||||
view_range = 5,
|
||||
jump = true,
|
||||
step=1,
|
||||
passive = true,
|
||||
blood_amount = 5,
|
||||
blood_offset = 0,
|
||||
})
|
||||
|
||||
mobs:register_mob("mobs:rabbit_grey", {
|
||||
type = "animal",
|
||||
hp_min = 8,
|
||||
hp_max = 10,
|
||||
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.3, 0.2},
|
||||
textures = {"mobs_rabbit_grey.png"},
|
||||
visual = "mesh",
|
||||
mesh = "rabbit.x",
|
||||
visual_size = {x=0.5,y=0.5},
|
||||
makes_footstep_sound = false,
|
||||
walk_velocity = 2,
|
||||
armor = 200,
|
||||
drops = {
|
||||
{name = "mobs:meat_raw",
|
||||
chance = 1,
|
||||
min = 0,
|
||||
max = 1,},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 1,
|
||||
lava_damage = 5,
|
||||
light_damage = 0,
|
||||
sounds = {
|
||||
},
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 30,
|
||||
walk_start = 40,
|
||||
walk_end = 60,
|
||||
},
|
||||
view_range = 5,
|
||||
jump = true,
|
||||
step=1,
|
||||
passive = true,
|
||||
blood_amount = 5,
|
||||
blood_offset = 0,
|
||||
})
|
||||
|
||||
|
||||
mobs:register_spawn("mobs:rabbit", {"default:dirt_with_grass"}, 20, 8, 9000, 3, 31000)
|
||||
mobs:register_spawn("mobs:rabbit_brown", {"default:dirt_with_grass"}, 20, 8, 9000, 3, 31000)
|
||||
mobs:register_spawn("mobs:rabbit_grey", {"default:dirt_with_grass"}, 20, 8, 9000, 3, 31000)
|
|
@ -1,5 +1,7 @@
|
|||
mobs = {}
|
||||
mobs.mob_list = { npc={}, barbarian={}, monster={}, animal={}}
|
||||
function mobs:register_mob(name, def)
|
||||
table.insert(mobs.mob_list[def.type],name)
|
||||
minetest.register_entity(name, {
|
||||
name = name,
|
||||
hp_min = def.hp_min,
|
||||
|
@ -765,15 +767,6 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
|
|||
return
|
||||
end
|
||||
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name].walkable == true or minetest.registered_nodes[minetest.get_node(pos).name].walkable == nil then
|
||||
return
|
||||
end
|
||||
|
||||
pos.y = pos.y+1
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name].walkable == true or minetest.registered_nodes[minetest.get_node(pos).name].walkable == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if min_dist == nil then
|
||||
min_dist = {x=-1,z=-1}
|
||||
end
|
||||
|
@ -796,20 +789,50 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
|
|||
if minetest.setting_getbool("display_mob_spawn") then
|
||||
minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))
|
||||
end
|
||||
local mob = minetest.add_entity(pos, name)
|
||||
|
||||
-- setup the hp, armor, drops, etc... for this specific mob
|
||||
local distance_rating = ( ( get_distance({x=0,y=0,z=0},pos) ) / 15000 )
|
||||
if mob then
|
||||
mob = mob:get_luaentity()
|
||||
local newHP = mob.hp_min + math.floor( mob.hp_max * distance_rating )
|
||||
mob.object:set_hp( newHP )
|
||||
end
|
||||
|
||||
mobs:spawn_mob(pos,name)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
function mobs:spawn_mob(pos,name)
|
||||
-- make sure the nodes above are walkable
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name] ~= nil then
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name].walkable == true or minetest.registered_nodes[minetest.get_node(pos).name].walkable == nil then
|
||||
return -1
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
if minetest.registered_nodes[minetest.get_node(pos).name].walkable == true or minetest.registered_nodes[minetest.get_node(pos).name].walkable == nil then
|
||||
return -1
|
||||
end
|
||||
pos.y = pos.y - 1
|
||||
end
|
||||
|
||||
local mob = minetest.add_entity(pos, name)
|
||||
-- setup the hp, armor, drops, etc... for this specific mob
|
||||
local distance_rating = ( ( get_distance({x=0,y=0,z=0},pos) ) / 15000 )
|
||||
if mob ~= nil then
|
||||
mob = mob:get_luaentity()
|
||||
if mob ~= nil then
|
||||
local newHP = mob.hp_min + math.floor( mob.hp_max * distance_rating )
|
||||
mob.object:set_hp( newHP )
|
||||
mob.state = "walk" -- make them walk when they spawn so they walk away from their original spawn position
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mobs:get_random(type)
|
||||
if mobs.mob_list[type] ~= nil then
|
||||
local seed = os.clock() + os.time()
|
||||
math.randomseed(seed)
|
||||
local idx = math.random(1,#mobs.mob_list[type])
|
||||
if mobs.mob_list[type][idx] ~= nil then
|
||||
return mobs.mob_list[type][idx]
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function mobs:register_arrow(name, def)
|
||||
minetest.register_entity(name, {
|
||||
physical = false,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
dofile(minetest.get_modpath("mobs").."/api.lua")
|
||||
|
||||
dofile(minetest.get_modpath("mobs").."/spawner.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/npcs/explorer.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/npcs/men.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/npcs/women.lua")
|
||||
|
@ -16,9 +16,12 @@ dofile(minetest.get_modpath("mobs").."/monsters/yeti.lua")
|
|||
|
||||
dofile(minetest.get_modpath("mobs").."/animals/rat.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/animals/sheep.lua")
|
||||
dofile(minetest.get_modpath("mobs").."/animals/rabbits.lua")
|
||||
|
||||
-- NPCs and Barbarians to be randomly spawned in villages
|
||||
|
||||
--[[NPCs and Barbarians to be randomly spawned in villages
|
||||
mobs.npcs = {
|
||||
|
||||
[0] = "mobs:female1_npc",
|
||||
[1] = "mobs:female2_npc",
|
||||
[2] = "mobs:female3_npc",
|
||||
|
@ -27,11 +30,13 @@ mobs.npcs = {
|
|||
[5] = "mobs:male3_npc",
|
||||
[6] = "mobs:explorer"
|
||||
}
|
||||
|
||||
|
||||
mobs.barbarians = {
|
||||
[0] = "mobs:barbarian1",
|
||||
[1] = "mobs:barbarian2"
|
||||
}
|
||||
|
||||
]]
|
||||
if minetest.setting_get("log_mods") then
|
||||
minetest.log("action", "mobs loaded")
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
mobs:register_mob("mobs:barbarian1", {
|
||||
type = "monster",
|
||||
type = "barbarian",
|
||||
hp_min = 20,
|
||||
hp_max = 65,
|
||||
exp_min = 10,
|
||||
|
@ -9,7 +9,7 @@ mobs:register_mob("mobs:barbarian1", {
|
|||
mesh = "3d_armor_character.x",
|
||||
textures = {"mobs_barbarian1.png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png",
|
||||
minetest.registered_items["default:sword_steel"].inventory_image,
|
||||
},
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
|
@ -41,7 +41,7 @@ mobs:register_mob("mobs:barbarian1", {
|
|||
sounds = {
|
||||
war_cry = "mobs_barbarian_yell2",
|
||||
death = "mobs_barbarian_death",
|
||||
attack = "default_punch2",
|
||||
attack = "default_sword_steel2",
|
||||
},
|
||||
step=0.5,
|
||||
blood_amount = 35,
|
||||
|
@ -49,7 +49,7 @@ mobs:register_mob("mobs:barbarian1", {
|
|||
})
|
||||
|
||||
mobs:register_mob("mobs:barbarian2", {
|
||||
type = "monster",
|
||||
type = "barbarian",
|
||||
hp_min = 20,
|
||||
hp_max = 65,
|
||||
exp_min = 10,
|
||||
|
@ -59,7 +59,7 @@ mobs:register_mob("mobs:barbarian2", {
|
|||
mesh = "3d_armor_character.x",
|
||||
textures = {"mobs_barbarian2.png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png",
|
||||
minetest.registered_items["default:axe_steel"].inventory_image,
|
||||
},
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
|
@ -91,7 +91,7 @@ mobs:register_mob("mobs:barbarian2", {
|
|||
sounds = {
|
||||
war_cry = "mobs_barbarian_yell1",
|
||||
death = "mobs_barbarian_death",
|
||||
attack = "default_punch2",
|
||||
attack = "default_sword_steel",
|
||||
},
|
||||
step=0.5,
|
||||
blood_amount = 35,
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
-- mob spawner
|
||||
|
||||
minetest.register_node("mobs:spawner",{
|
||||
description = "Mob Spawner",
|
||||
groups = { oddly_breakable_by_hand=3 },
|
||||
tiles = { "mobs_spawner.png" },
|
||||
sunlight_propagates = true,
|
||||
drop = "default:dirt",
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local name = sender:get_player_name()
|
||||
if minetest.check_player_privs(name,{ immortal=true }) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("entity",fields.entity)
|
||||
meta:set_string("infotext",fields.entity)
|
||||
if fields.active_objects ~= nil then
|
||||
meta:set_int("active_objects",fields.active_objects)
|
||||
end
|
||||
if fields.active_objects_wider ~= nil then
|
||||
meta:set_int("active_objects_wider",fields.active_objects_wider)
|
||||
end
|
||||
meta:set_string("formspec",getformspec(pos))
|
||||
else
|
||||
minetest.chat_send_player(name,"You do not have permission to change mob spawner settings")
|
||||
end
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",getformspec(pos))
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
return minetest.check_player_privs(player:get_player_name(),{ immortal=true })
|
||||
end,
|
||||
on_punch = function (pos, node, puncher, pointed_thing)
|
||||
print("punched")
|
||||
if minetest.check_player_privs(puncher:get_player_name(),{ immortal=true }) then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local entity = meta:get_string("entity")
|
||||
if entity ~= "" then
|
||||
if minetest.registered_entities[entity] == nil then
|
||||
if mobs.mob_list[entity] ~= nil then
|
||||
entity = mobs:get_random(entity)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
local spawnpos = pos
|
||||
spawnpos.y = spawnpos.y + 4
|
||||
minetest.log("action","Spawn block spawning "..tostring(entity).." at "..minetest.pos_to_string(spawnpos))
|
||||
mobs:spawn_mob(spawnpos,entity)
|
||||
else
|
||||
minetest.log("action","No entity set in spawner block at "..minetest.pos_to_string(pos))
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"mobs:spawner"},
|
||||
interval = 20,
|
||||
chance = 3,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local entity = meta:get_string("entity")
|
||||
local active_objects = meta:get_int("active_objects")
|
||||
local active_objects_wider = meta:get_int("active_objects_wider")
|
||||
if entity ~= "" then
|
||||
if minetest.registered_entities[entity] == nil then
|
||||
if mobs.mob_list[entity] ~= nil then
|
||||
entity = mobs:get_random(entity)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
if active_objects_wider > 0 then
|
||||
if active_object_count_wider > active_objects_wider then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if active_objects > 0 then
|
||||
if active_object_count > active_objects then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local spawnpos = { x=pos.x, y=pos.y, z=pos.z }
|
||||
spawnpos.y = spawnpos.y + 6
|
||||
minetest.log("action","Spawn block spawning "..tostring(entity).." at "..minetest.pos_to_string(spawnpos))
|
||||
local r = mobs:spawn_mob(spawnpos,entity)
|
||||
if r == -1 then
|
||||
-- they are spawning in a block, remove this spawner
|
||||
local fails = meta:get_int("spawning_fails")
|
||||
fails = fails + 1
|
||||
meta:set_int("spawning_fails",fails)
|
||||
if fails > 5 then
|
||||
minetest.log("action","Too many spawning fails, removing spawning block at "..minetest.pos_to_string(pos))
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end
|
||||
else
|
||||
minetest.log("action","No entity set in spawner block at "..minetest.pos_to_string(pos))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function getformspec(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local spawnerformspec = "size[6,6,false]"
|
||||
spawnerformspec = spawnerformspec .. "field[.5,0.5;5,1;entity;Mob;"..meta:get_string("entity").."]"
|
||||
spawnerformspec = spawnerformspec .. "field[.5,2;3,1;active_objects;Active Objects;"..meta:get_string("active_objects").."]"
|
||||
spawnerformspec = spawnerformspec .. "field[.5,3.5;3,1;active_objects_wider;Active Objects Wider;"..meta:get_string("active_objects_wider").."]"
|
||||
spawnerformspec = spawnerformspec .. "button_exit[.5,5;3,1;send;Save]"
|
||||
return spawnerformspec
|
||||
end
|
||||
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 251 B |
|
@ -124,6 +124,9 @@ minetest.register_chatcommand("sethome", {
|
|||
|
||||
minetest.register_on_respawnplayer( function (player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.check_player_privs(name,{immortal = true}) then
|
||||
return true
|
||||
end
|
||||
if homepos[name] ~= nil then
|
||||
player:moveto(homepos[name])
|
||||
return true
|
||||
|
|
|
@ -21,6 +21,7 @@ local food_poisoning = {
|
|||
minetest.log("action",name.." pukes")
|
||||
puke_physics(player)
|
||||
minetest.sound_play("sickness_puke",{object=player})
|
||||
if hud.hunger[name] ~= nil then
|
||||
if hud.hunger[name] > 4 then
|
||||
hud.hunger[name] = 4
|
||||
hud.set_hunger(player)
|
||||
|
@ -30,6 +31,7 @@ local food_poisoning = {
|
|||
end
|
||||
minetest.after(5,puke_reset,player)
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -39,6 +41,7 @@ local food_poisoning = {
|
|||
minetest.log("action",name.." pukes")
|
||||
puke_physics(player)
|
||||
minetest.sound_play("sickness_puke",{object=player})
|
||||
if hud.hunger[name] ~= nil then
|
||||
if hud.hunger[name] > 4 then
|
||||
hud.hunger[name] = 4
|
||||
hud.set_hunger(player)
|
||||
|
@ -48,6 +51,7 @@ local food_poisoning = {
|
|||
end
|
||||
minetest.after(5,puke_reset,player)
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -57,6 +61,7 @@ local food_poisoning = {
|
|||
minetest.log("action",name.." pukes")
|
||||
puke_physics(player)
|
||||
minetest.sound_play("sickness_puke",{object=player})
|
||||
if hud.hunger[name] ~= nil then
|
||||
if hud.hunger[name] > 4 then
|
||||
hud.hunger[name] = 4
|
||||
hud.set_hunger(player)
|
||||
|
@ -66,6 +71,7 @@ local food_poisoning = {
|
|||
end
|
||||
minetest.after(5,puke_reset,player)
|
||||
end
|
||||
end
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
|
@ -167,4 +167,12 @@ minetest.register_chatcommand("skills", {
|
|||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local level = skills.get_player_level(name)
|
||||
local decrease = level.exp * -0.1
|
||||
print(tostring(decrease))
|
||||
skills.add_exp(name,decrease)
|
||||
end)
|
||||
|
||||
minetest.after(1, skills.initialize)
|