Update and clean up all the things

master
GreenXenith 2020-09-22 20:16:36 -07:00
parent d25339bf97
commit 5f4dea6947
114 changed files with 1661 additions and 958 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.blend1

View File

@ -1,19 +1,18 @@
MIT Copyright 2017 GreenDimond
MIT Copyright 2020 GreenXenith
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

159
README.md
View File

@ -1,135 +1,38 @@
____ _ _ _ _ ____
/ ___| | | |_ __(_)___| |_ _ __ ___ __ _ ___ | _ \ ___ ___ ___ _ __
| | | |_| | '__| / __| __| '_ ` _ \ / _` / __| | | | |/ _ \/ __/ _ \| '__|
| |___| _ | | | \__ \ |_| | | | | | (_| \__ \ | |_| | __/ (_| (_) | |
\____|_| |_|_| |_|___/\__|_| |_| |_|\__,_|___/ |____/ \___|\___\___/|_| ~By GreenDimond
'Tis the season!
This mod adds some Christmas decorations :D
# Christmas Decor
_'Tis the season!_
Depends on 3d_armor, homedecor, farming_redo, stairs_redo, mobs_redo, mobs_animal,
dye, wool, bucket, vessels, xpanes, farming, and default.
Optional depends on 3d_armor, basic_materials, bucket, default, dye, farming, homedecor_exterior, mobs, mobs_animal stairs, vessels, wool, and xpanes.
This mod contains the following:
* Stocking*
## Contents
* Stocking
* Christmas Lights (and craftitems)
* White
* Multicolor
* Icicle (white)
* Bulb (multicolor)
* Pane version of above
* Garland
* Garland with lights
* White
* Multicolor
* Icicle (white)
* Bulb (multicolor)
* Pane versions of the above
* Shrubbery with lights
* Garland (plain/lights)
* Gingerbread Cookies (and craftitems)
* Plate of cookies (decorational)
* Glass of milk (decorational)
* Candycane (edible)
* Santa Claus mob (non-moving)
* Reindeer mob (non-moving, has animations)
* Santa hat (wearable)
* Candycane (placeable - noncraftable)
* Frosting nodes (noncraftable)
* Candycane nodes (noncraftable)
* Glass of milk (edible and decorational)
* Candycane (edible and decorational)
* Santa and Elf hats (wearable)
* Frosting, candycane, and peppermint nodes
* Colored gumdrops (edible and decorational)
* Mistletoe
* Icicles (wallmounted/hanging)
* Nutcracker
* Santa Claus and Mrs. Claus mobs (non-moving)
* Reindeer and Rudolf mobs (non-moving, has animations)
All items are craftable (excluding mob spawneggs). Use a craftguide mod to view recipes.
*Stockings are pretty cool. They will automatically fill once Christmas arrives,
or at least that is the idea. Extensive testing has supposedly confirmed this,
but we'll see what happens :P The stocking by default is set to fill with
200 gold ingots, 20 candycanes, and a full set of mese tools. These can
be edited on lines 42-53 of stocking.lua. Each player is also only allowed
to place one stocking, and there is bunches of stuff in place to make sure
other players can't steal from stockings and can't dig other people's, etc...
This is the part where I have to type out all the craft recipes.
* Stocking:
(r = red wool, w = white wool)
```
+-+-+-+
|w|w| |
+-+-+-+
|r|r| |
+-+-+-+
|r|r|r|
+-+-+-+
```
(reverse works too)
* Christmas lights:
Forget it, just look on these lines in the init.lua:
L 123-161
L 290-324
* Garland:
(p = pine needles)
```
+-+-+-+
|p|p|p|
+-+-+-+
```
(combine with 3 white LED's to make garland with lights)
* Ginger:
(p = plastic sheeting, b = brown dye, o = orange dye)
```
+-+-+-+
|p|o|p|
+-+-+-+
|p|b|p|
+-+-+-+
```
(orange and brown dye can switch places)
* Cookiecutter:
(s = steel ingot)
```
+-+-+-+
| |s| |
+-+-+-+
|s|s|s|
+-+-+-+
|s| |s|
+-+-+-+
```
* Gingerbread dough:
Combine ginger, bucket of water, flour, and sugar.
* Raw Gingerbread Man:
Combine cookiecutter and gingerbread dough.
Cook to obtain gingerbread man.
Combine gingerbread man with cutlery set to get a plate of cookies.
* Glass of milk:
Combine bucket of milk and a drinking glass.
* Candycane:
Combine candycane base with red and white dye.
* Candycane base:
(s = sugar)
```
+-+-+-+
| |s| |
+-+-+-+
|s| |s|
+-+-+-+
|s| | |
+-+-+-+
```
(reverse works too)
* Santa hat:
(w = white wool, r = red wool)
```
+-+-+-+
| |w| |
+-+-+-+
| |r| |
+-+-+-+
|r|r|r|
+-+-+-+
```
* Mistletoe:
Combine 2 normal leaves and red dye.
## Stockings
Stockings will automatically fill once Christmas arrives, or at least that's the idea. Extensive testing has supposedly confirmed this.
Each player is only allowed to place a single stocking at a time. Items can only be taken/added by the owner or players with protection_bypass.
By default stockings will be filled with 20 candycanes, 10 gingerbread men, 1 elf hat, 99 gold ingots, and a set of default mese tools. To use custom items instead, add a `christmas_decor.stocking_stuffers` setting to your configuration file with a comma-separated list of items and optional counts.
Example:
`christmas_decor.stocking_stuffers = default:diamond 30, default:coal_lump, yourmod:someitem 99`

View File

@ -1,11 +0,0 @@
default
stairs
xpanes
3d_armor
mobs
wool
bucket
farming
homedecor
vessels
mobs_animal

View File

@ -1 +0,0 @@
Adds Christmas-themed stuff :D

323
food.lua Normal file
View File

@ -0,0 +1,323 @@
local depends, default_sounds = ...
minetest.register_node("christmas_decor:candycane", {
description = "Candycane",
drawtype = "mesh",
mesh = "christmas_decor_candycane.obj",
tiles = {"christmas_decor_candycane.png"},
inventory_image = "christmas_decor_candycane_inv.png",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
collision_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_stone_defaults"),
on_use = minetest.item_eat(4),
})
minetest.register_alias("christmas_decor:candycane_edible", "christmas_decor:candycane")
minetest.register_alias("christmas_decor:candycane_base", "christmas_decor:candycane")
minetest.register_craftitem("christmas_decor:gingerbread_man", {
description = "Gingerbread Man",
inventory_image = "christmas_decor_gingerbread_man.png",
on_use = minetest.item_eat(6),
})
minetest.register_craftitem("christmas_decor:gingerbread_man_raw", {
description = "Gingerbread Man (raw)",
inventory_image = "christmas_decor_gingerbread_man_raw.png",
})
minetest.register_craftitem("christmas_decor:gingerbread_dough", {
description = "Gingerbread Dough",
inventory_image = "christmas_decor_gingerbread_dough.png",
})
minetest.register_craftitem("christmas_decor:ginger", {
description = "Ginger",
inventory_image = "christmas_decor_ginger.png",
})
minetest.register_craftitem("christmas_decor:cookiecutter", {
description = "Cookiecutter",
inventory_image = "christmas_decor_cookie_cutter.png",
})
minetest.register_node("christmas_decor:plate_with_cookies", {
description = "Plate of Cookies (decorative)",
tiles = {"christmas_decor_plate_top.png"},
inventory_image = "christmas_decor_plate_top.png",
wield_imagte = "christmas_decor_plate_top.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default_sounds("node_sound_glass_defaults"),
})
minetest.register_node("christmas_decor:milk_glass", {
description = "Glass of Milk",
drawtype = "plantlike",
tiles = {"christmas_decor_milk_glass.png"},
inventory_image = "christmas_decor_milk_glass_inv.png",
wield_image = "christmas_decor_milk_glass.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
stack_max = 1,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default_sounds("node_sound_glass_defaults"),
on_use = minetest.item_eat(4, minetest.get_modpath("vessels") and "vessels:drinking_glass"),
})
if minetest.get_modpath("default") then
minetest.register_craft({
output = "christmas_decor:plate_with_cookies",
type = "shapeless",
recipe = {
"christmas_decor:gingerbread_man", "christmas_decor:gingerbread_man",
"christmas_decor:gingerbread_man", "default:glass",
},
})
end
if minetest.get_modpath("vessels") and depends.mobs_animal and depends.bucket then
minetest.register_craft({
output = "christmas_decor:milk_glass",
type = "shapeless",
recipe = {"vessels:drinking_glass", "mobs:bucket_milk"},
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}},
})
end
if minetest.get_modpath("default") then
if minetest.get_modpath("dye") then
minetest.register_craft({
output = "christmas_decor:ginger",
recipe = {
{"default:paper", "dye:brown", "default:paper"},
{"default:paper", "dye:orange", "default:paper"},
},
})
end
minetest.register_craft({
output = "christmas_decor:cookiecutter 1",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
},
})
end
if minetest.get_modpath("bucket") and minetest.global_exists("farming") and farming.mod and farming.mod == "redo" then
minetest.register_craft({
output = "christmas_decor:gingerbread_dough",
type = "shapeless",
recipe = {"christmas_decor:ginger", "farming:flour", "bucket:bucket_water", "farming:sugar"},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
})
end
minetest.register_craft({
output = "christmas_decor:gingerbread_man_raw 5",
type = "shapeless",
recipe = {"christmas_decor:cookiecutter", "christmas_decor:gingerbread_dough"},
replacements = {{"christmas_decor:cookiecutter", "christmas_decor:cookiecutter"}},
})
minetest.register_craft({
type = "cooking",
output = "christmas_decor:gingerbread_man",
recipe = "christmas_decor:gingerbread_man_raw",
cooktime = 10,
})
if depends.farming_redo and depends.dye then
minetest.register_craft({
output = "christmas_decor:candycane_edible 2",
recipe = {
{"", "farming:sugar", ""},
{"dye:red", "", "dye:red"},
{"", "", "farming:sugar"},
},
})
minetest.register_craft({
output = "christmas_decor:candycane_edible 2",
recipe = {
{"", "farming:sugar", ""},
{"dye:red", "", "dye:red"},
{"farming:sugar", "", ""},
},
})
end
if depends.default and depends.dye then
minetest.register_craft({
output = "christmas_decor:candycane 2",
recipe = {
{"", "dye:white", ""},
{"dye:red", "default:stick", "dye:red"},
{"", "", "dye:white"},
},
})
minetest.register_craft({
output = "christmas_decor:candycane 2",
recipe = {
{"", "dye:white", ""},
{"dye:red", "default:stick", "dye:red"},
{"dye:white", "", ""},
},
})
end
minetest.register_node("christmas_decor:candycane_block", {
description = "Candycane Block",
tiles = {
"christmas_decor_candycane_block.png", "christmas_decor_candycane_block.png",
"christmas_decor_candycane_block.png", "christmas_decor_candycane_block.png",
"christmas_decor_candycane_block.png^[transformFX", "christmas_decor_candycane_block.png^[transformFX",
},
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_stone_defaults"),
})
minetest.register_node("christmas_decor:peppermint_block", {
description = "Peppermint Block",
tiles = {"christmas_decor_peppermint.png"},
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_stone_defaults"),
})
minetest.register_node("christmas_decor:frosting_block", {
description = "Frosting Block",
tiles = {"christmas_decor_frosting.png"},
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
if depends.farming_redo then
if depends.dye then
minetest.register_craft({
output = "christmas_decor:candycane_block 8",
recipe = {
{"farming:sugar", "dye:red", "farming:sugar"},
{"dye:red", "farming:sugar", "dye:red"},
{"farming:sugar", "dye:red", "farming:sugar"},
},
})
minetest.register_craft({
output = "christmas_decor:peppermint_block 8",
recipe = {
{"dye:red", "farming:sugar", "dye:red"},
{"farming:sugar", "dye:red", "farming:sugar"},
{"dye:red", "farming:sugar", "dye:red"},
},
})
end
if depends.bucket then
minetest.register_craft({
output = "christmas_decor:frosting_block 8",
recipe = {
{"farming:sugar", "farming:sugar", "farming:sugar"},
{"farming:sugar", "bucket:bucket_water", "farming:sugar"},
{"farming:sugar", "farming:sugar", "farming:sugar"},
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
})
end
end
if depends.stairs then
local candycane_def = minetest.registered_nodes["christmas_decor:candycane_block"]
stairs.register_stair_and_slab("candycane_block", "christmas_decor:candycane_block",
candycane_def.groups, candycane_def.tiles,
candycane_def.description .. " Stair", candycane_def.description .. " Slab",
candycane_def.sounds, false
)
local peppermint_def = minetest.registered_nodes["christmas_decor:peppermint_block"]
stairs.register_stair_and_slab("peppermint_block", "christmas_decor:peppermint_block",
peppermint_def.groups, peppermint_def.tiles,
peppermint_def.description .. " Stair", peppermint_def.description .. " Slab",
peppermint_def.sounds, false
)
local frosting_def = minetest.registered_nodes["christmas_decor:frosting_block"]
stairs.register_stair_and_slab("frosting_block", "christmas_decor:frosting_block",
frosting_def.groups, frosting_def.tiles,
frosting_def.description .. " Stair", frosting_def.description .. " Slab",
frosting_def.sounds, false
)
end
for color, hex in pairs({
red = "#ff0000",
orange = "#ff9000",
yellow = "#fcff00",
green = "#18cb35",
blue = "#0096FF",
purple = "#ae4eff",
}) do
minetest.register_node("christmas_decor:gumdrop_" .. color, {
description = color:gsub("^%l", string.upper) .. " Gumdrop",
drawtype = "mesh",
mesh = "christmas_decor_gumdrop.obj",
tiles = {"christmas_decor_gumdrop.png^[colorize:" .. hex .. ":150"},
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, 0.1, 0.4},
},
collision_box = {
type = "fixed",
fixed = {-0.4, -0.5, -0.4, 0.4, 0.1, 0.4},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
on_use = minetest.item_eat(2),
})
if depends.farming_redo and depends.dye then
minetest.register_craft({
output = "christmas_decor:gumdrop_" .. color .. " 2",
recipe = {
{"", "farming:sugar", ""},
{"farming:sugar", "dye:" .. color:gsub("purple", "violet"), "farming:sugar"},
{"farming:sugar", "farming:sugar", "farming:sugar"},
}
})
end
end

639
init.lua
View File

@ -1,620 +1,31 @@
local christmas_decor = {}
local MODPATH = minetest.get_modpath(minetest.get_current_modname())
-- Candycane Blocks
minetest.register_node("christmas_decor:candycane_block", {
description = "Candycane Block",
tiles = {"candycane_block.png", "candycane_block.png", "candycane_block.png", "candycane_block.png", "candycane_block.png^[transformFX", "candycane_block.png^[transformFX"},
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default.node_sound_stone_defaults(),
})
local depends = {
armor = minetest.global_exists("armor"),
basic_materials = minetest.get_modpath("basic_materials"),
bucket = minetest.get_modpath("bucket"),
default = minetest.get_modpath("default"),
dye = minetest.get_modpath("dye"),
farming_redo = minetest.global_exists("farming") and farming.mod and farming.mod == "redo",
homedecor_exterior = minetest.get_modpath("homedecor_exterior"),
mobs_animal = minetest.get_modpath("mobs_animal"),
mobs_redo = minetest.global_exists("mobs") and mobs.mod and mobs.mod == "redo",
stairs = minetest.global_exists("stairs"),
vessels = minetest.get_modpath("vessels"),
wool = minetest.get_modpath("wool"),
xpanes = minetest.global_exists("xpanes"),
}
stairs.register_all("candycane", "christmas_decor:candycane_block",
{snappy = 3},
{"candycane_block.png", "candycane_block.png", "candycane_block.png", "candycane_block.png", "candycane_block.png^[transformFX", "candycane_block.png^[transformFX"},
"Candycane",
stairs.stone)
minetest.register_node("christmas_decor:candycane", {
description = "Candycane (placeable)",
drawtype = "mesh",
mesh = "candycane.obj",
tiles = {"candycane.png"},
inventory_image = "inv_candycane.png",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
collision_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default.node_sound_stone_defaults(),
})
-- Frosting Blocks
minetest.register_node("christmas_decor:frosting_block", {
description = "Frosting Block",
tiles = {"frosting.png"},
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
})
stairs.register_all("frosting_block", "christmas_decor:frosting_block",
{snappy = 3},
{"frosting.png"},
"Frosting",
stairs.leaves)
-- Garland
minetest.register_node("christmas_decor:garland", {
description = "Garland",
tiles = {"garland.png"},
inventory_image = "garland.png",
wield_image = "garland.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("christmas_decor:garland_lights", {
description = "Garland with Lights",
tiles = {
{
image = "garland_lights.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 64,
aspect_h = 64,
length = 16
},
}
},
inventory_image = "inv_garland_lights.png",
wield_image = "inv_garland_lights.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
light_source = 8,
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
output = "christmas_decor:garland 3",
recipe = {
{"default:pine_needles", "default:pine_needles", "default:pine_needles"},
},
})
minetest.register_craft({
output = "christmas_decor:garland_lights",
type = "shapeless",
recipe = {"christmas_decor:garland", "christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
})
-- Lights
minetest.register_craftitem("christmas_decor:led_rgb", {
description = "RGB Led Light",
inventory_image = "led_rgb.png",
})
minetest.register_craftitem("christmas_decor:led_white", {
description = "White Led Light",
inventory_image = "led_white.png",
})
minetest.register_craft({
output = "christmas_decor:led_rgb",
type = "shapeless",
recipe = {"christmas_decor:led_white", "dye:green", "dye:blue", "dye:red"},
})
minetest.register_craft({
output = "christmas_decor:led_white 8",
recipe = {
{"default:glass"},
{"homedecor:power_crystal"},
{"homedecor:plastic_sheeting"},
},
})
minetest.register_craftitem("christmas_decor:wire", {
description = "Wire",
inventory_image = "wire.png",
})
minetest.register_craft({
output = "christmas_decor:wire 16",
recipe = {
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
{"homedecor:copper_strip", "homedecor:copper_strip", "homedecor:copper_strip"},
{"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting"},
},
})
local function register_lights(desc, nodename, aspect, length, def, craftitem, original_def)
minetest.register_node("christmas_decor:lights_"..nodename, {
description = desc.." Christmas Lights",
tiles = {
{
image = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}
},
inventory_image = "inv_lights_"..nodename..".png",
wield_image = "inv_lights_"..nodename..".png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
light_source = 10,
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
})
xpanes.register_pane("lights_"..nodename.."_pane", {
description = desc.." Christmas Lights (pane)",
textures = {
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
},
{
image = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}, "xpanes_space.png"
},
use_texture_alpha = true,
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
recipe = {
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename},
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename}
}
})
local tileFX = {
name = "lights_"..nodename..".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3
}
}
local tile = {
name = "lights_"..nodename..".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 3.3
}
}
for i = 1, 15 do
minetest.override_item("xpanes:lights_" .. nodename .. "_pane_" .. i, {
tiles = {"xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile},
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
end
minetest.override_item("xpanes:lights_"..nodename.."_pane", {
tiles = {"xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile},
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
minetest.override_item("xpanes:lights_"..nodename.."_pane_flat", {
tiles = {"xpanes_space.png", "xpanes_space.png", tile, tile, tileFX, tile},
sunlight_propagates = true,
walkable = false,
light_source = 10,
})
minetest.register_craft({
output = "xpanes:lights_" .. nodename .. "_pane_flat 6",
recipe = {
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename},
{"christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename, "christmas_decor:lights_"..nodename}
}
})
local function default_sounds(name)
if default and default[name] then return default[name]() end
end
register_lights("White", "white", 16, 6)
register_lights("White Icicle", "white_icicle", 16, 6)
register_lights("Multicolor", "multicolor", 16, 6)
register_lights("Multicolor Bulb", "multicolor_bulb", 8, 3)
minetest.register_craft({
output = "christmas_decor:lights_white 6",
recipe = {
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_white_icicle 6",
recipe = {
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_multicolor 6",
recipe = {
{"christmas_decor:led_rgb", "christmas_decor:led_rgb", "christmas_decor:led_rgb"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_rgb", "christmas_decor:led_rgb", "christmas_decor:led_rgb"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_multicolor_bulb 6",
recipe = {
{"christmas_decor:led_rgb", "default:glass", "christmas_decor:led_rgb"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_rgb", "default:glass", "christmas_decor:led_rgb"},
},
})
-- Stocking
dofile(minetest.get_modpath("christmas_decor").."/stocking.lua")
-- Apparel
minetest.register_tool("christmas_decor:helmet_santa_hat", {
description = "Santa Hat",
inventory_image = "inv_helmet_santa_hat.png",
groups = {
armor_head = 0,
armor_heal = 0,
armor_use = 0,
},
wear = 0,
})
minetest.register_craft({
output = "christmas_decor:helmet_santa_hat",
recipe = {
{"", "wool:white", ""},
{"", "wool:red", ""},
{"wool:red", "wool:red", "wool:red"},
},
})
-- Mobs (with help from GoldenHart)
local function register_claus(desc, mobname, original_def)
mobs:register_mob("christmas_decor:" .. mobname, {
type = "npc",
passive = true,
damage = 3,
pathfinding = false,
nametag = desc,
hp_min = 20,
hp_max = 20,
armor = 1000000000000, -- No Can Die
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
textures = {
{mobname .. ".png"},
},
makes_footstep_sound = false,
sounds = {},
walk_velocity = 0,
run_velocity = 0,
jump = false,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
view_range = 15,
owner = "",
fear_height = 3,
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
},
on_rightclick = function(self, clicker)
if mobs:capture_mob(self, clicker, 100, 100, 100, false, nil) then return end
end
})
mobs:register_egg("christmas_decor:" .. mobname, desc, "wool_red.png", 1)
mobs:alias_mob("mobs:" .. mobname, "christmas_decor:" .. mobname)
local function include(filename)
assert(loadfile(MODPATH .. "/" .. filename))(depends, default_sounds)
end
register_claus("Santa Claus", "santa")
local function register_reindeer(desc, mobname, original_def)
mobs:register_mob("christmas_decor:" .. mobname, {
type = "animal",
passive = true,
damage = 3,
hp_min = 20,
hp_max = 20,
armor = 1000000000000,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 1.2, 0.2},
visual = "mesh",
mesh = "reindeer.b3d",
textures = {mobname .. ".png"},
makes_footstep_sound = false,
walk_velocity = 0,
run_velocity = 0,
jump = false,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
animation = {
speed_normal = 25,
speed_normal = 25,
speed_run = 25,
stand_start = 0,
stand_end = 200,
walk_start = 149,
walk_end = 150,
run_start = 150,
run_end = 170,
},
follow = "christmas_decor:candycane_edible",
view_range = 15,
fear_height = 3,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 0, false, true) then return end
if mobs:capture_mob(self, clicker, 100, 100, 100, false, nil) then return end
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
end
})
mobs:register_egg("christmas_decor:" .. mobname, desc, "wool_brown.png", 1)
mobs:alias_mob("mobs:" .. mobname, "christmas_decor:" .. mobname)
end
register_reindeer("Reindeer", "reindeer")
-- Eddibles
minetest.register_craftitem("christmas_decor:candycane_edible", {
description = "Candycane",
inventory_image = "candycane_eddible.png",
on_use = minetest.item_eat(4),
})
minetest.register_craftitem("christmas_decor:candycane_base", {
description = "Candycane Base",
inventory_image = "candycane_base.png",
})
minetest.register_craftitem("christmas_decor:gingerbread_man", {
description = "Gingerbread Man",
inventory_image = "gingerbread_man.png",
on_use = minetest.item_eat(6),
})
minetest.register_craftitem("christmas_decor:gingerbread_man_raw", {
description = "Gingerbread Man (raw)",
inventory_image = "gingerbread_man_raw.png",
})
minetest.register_craftitem("christmas_decor:gingerbread_dough", {
description = "Gingerbread Dough",
inventory_image = "gingerbread_dough.png",
})
minetest.register_craftitem("christmas_decor:ginger", {
description = "Ginger",
inventory_image = "ginger.png",
})
minetest.register_craftitem("christmas_decor:cookiecutter", {
description = "Cookiecutter",
inventory_image = "cookie_cutter.png",
})
minetest.register_node("christmas_decor:plate_with_cookies", {
description = "Plate of Cookies (decorative)",
tiles = {"plate_top.png"},
inventory_image = "plate_top.png",
wield_imagte = "plate_top.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("christmas_decor:milk_glass", {
description = "Glass of Milk (decorative)",
drawtype = "plantlike",
tiles = {"milk_glass.png"},
inventory_image = "milk_glass_inv.png",
wield_image = "milk_glass.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft({
output = "christmas_decor:plate_with_cookies",
type = "shapeless",
recipe = {"christmas_decor:gingerbread_man", "christmas_decor:gingerbread_man", "christmas_decor:gingerbread_man", "homedecor:cutlery_set"},
})
minetest.register_craft({
output = "christmas_decor:milk_glass",
type = "shapeless",
recipe = {"vessels:drinking_glass", "mobs:bucket_milk"},
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}},
})
minetest.register_craft({
output = "christmas_decor:ginger",
recipe = {
{"homedecor:plastic_sheeting", "dye:orange", "homedecor:plastic_sheeting"},
{"homedecor:plastic_sheeting", "dye:brown", "homedecor:plastic_sheeting"},
},
})
minetest.register_craft({
output = "christmas_decor:ginger",
recipe = {
{"homedecor:plastic_sheeting", "dye:brown", "homedecor:plastic_sheeting"},
{"homedecor:plastic_sheeting", "dye:orange", "homedecor:plastic_sheeting"},
},
})
minetest.register_craft({
output = "christmas_decor:gingerbread_dough",
type = "shapeless",
recipe = {"christmas_decor:ginger", "farming:flour", "bucket:bucket_water", "farming:sugar"},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
})
minetest.register_craft({
output = "christmas_decor:cookiecutter 1",
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
},
})
minetest.register_craft({
output = "christmas_decor:gingerbread_man_raw 5",
type = "shapeless",
recipe = {"christmas_decor:cookiecutter", "christmas_decor:gingerbread_dough"},
replacements = {{"christmas_decor:cookiecutter", "christmas_decor:cookiecutter"}},
})
minetest.register_craft({
type = "cooking",
output = "christmas_decor:gingerbread_man",
recipe = "christmas_decor:gingerbread_man_raw",
cooktime = 10,
})
minetest.register_craft({
output = "christmas_decor:candycane_base 2",
recipe = {
{"", "farming:sugar", ""},
{"farming:sugar", "", "farming:sugar"},
{"", "", "farming:sugar"},
},
})
minetest.register_craft({
output = "christmas_decor:candycane_base 2",
recipe = {
{"", "farming:sugar", ""},
{"farming:sugar", "", "farming:sugar"},
{"farming:sugar", "", ""},
},
})
minetest.register_craft({
output = "christmas_decor:candycane_edible",
type = "shapeless",
recipe = {"christmas_decor:candycane_base", "dye:red", "dye:white"},
})
-- Mistletoe
minetest.register_node("christmas_decor:mistletoe", {
description = "Mistletoe",
tiles = {"mistletoe.png"},
drawtype = "plantlike",
walkable = false,
sunlight_propagates = true,
paramtype = "light",
use_texture_alpha = true,
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
output = "christmas_decor:mistletoe",
type = "shapeless",
recipe = {"default:leaves", "default:leaves", "dye:red"},
})
include("food.lua")
include("lights.lua")
include("mobs.lua")
include("stocking.lua")
include("misc.lua")

247
lights.lua Normal file
View File

@ -0,0 +1,247 @@
local depends, default_sounds = ...
minetest.register_craftitem("christmas_decor:led_rgb", {
description = "RGB Led Light",
inventory_image = "christmas_decor_led_rgb.png",
})
minetest.register_craftitem("christmas_decor:led_white", {
description = "White Led Light",
inventory_image = "christmas_decor_led_white.png",
})
minetest.register_craftitem("christmas_decor:wire", {
description = "Wire",
inventory_image = "christmas_decor_wire.png",
})
if depends.dye then
minetest.register_craft({
output = "christmas_decor:led_rgb",
type = "shapeless",
recipe = {"christmas_decor:led_white", "dye:green", "dye:blue", "dye:red"},
})
end
if depends.basic_materials then
if depends.default then
minetest.register_craft({
output = "christmas_decor:led_white 8",
recipe = {
{"default:glass"},
{"basic_materials:energy_crystal_simple"},
{"basic_materials:plastic_sheet"},
},
})
end
minetest.register_craft({
output = "christmas_decor:wire 16",
recipe = {
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
{"basic_materials:copper_strip", "basic_materials:copper_strip", "basic_materials:copper_strip"},
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
},
})
end
local function register_lights(desc, nodename, aspect, length)
minetest.register_node("christmas_decor:lights_" .. nodename, {
description = desc .. " Christmas Lights",
tiles = {
{
image = "christmas_decor_lights_" .. nodename .. ".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
},
}
},
inventory_image = "christmas_decor_lights_" .. nodename .. "_inv.png",
wield_image = "christmas_decor_lights_" .. nodename .. "_inv.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
light_source = 10,
paramtype2 = "wallmounted",
connects_to = {"group:christmas_lights"},
groups = {snappy = 3, christmas_lights = 1},
sounds = default_sounds("node_sound_leaves_defaults"),
})
if not depends.xpanes then return end
local tileFX = {
name = "christmas_decor_lights_" .. nodename .. ".png^[transformFX",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
}
}
local tile = {
name = "christmas_decor_lights_" .. nodename .. ".png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = aspect,
aspect_h = aspect,
length = length
}
}
xpanes.register_pane("lights_" .. nodename .. "_pane", {
description = desc .. " Christmas Lights (pane)",
textures = {},
use_texture_alpha = true,
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
recipe = {
{"christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename},
{"christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename}
}
})
minetest.override_item("xpanes:lights_" .. nodename .. "_pane", {
tiles = {"blank.png", "blank.png", tile, tileFX, tileFX, tile},
walkable = false,
light_source = 10,
})
minetest.override_item("xpanes:lights_" .. nodename .. "_pane_flat", {
tiles = {"blank.png", "blank.png", tile, tile, tileFX, tile},
walkable = false,
light_source = 10,
})
minetest.register_craft({
output = "xpanes:lights_" .. nodename .. "_pane_flat 6",
recipe = {
{"christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename},
{"christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename, "christmas_decor:lights_" .. nodename}
}
})
end
register_lights("White", "white", 16, 6)
register_lights("White Icicle", "white_icicle", 16, 6)
register_lights("Multicolor", "multicolor", 16, 6)
register_lights("Multicolor Bulb", "multicolor_bulb", 8, 3)
minetest.register_craft({
output = "christmas_decor:lights_white 6",
recipe = {
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_white_icicle 6",
recipe = {
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
{"christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_multicolor 6",
recipe = {
{"christmas_decor:led_rgb", "christmas_decor:led_rgb", "christmas_decor:led_rgb"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_rgb", "christmas_decor:led_rgb", "christmas_decor:led_rgb"},
},
})
minetest.register_craft({
output = "christmas_decor:lights_multicolor_bulb 6",
recipe = {
{"christmas_decor:led_rgb", "default:glass", "christmas_decor:led_rgb"},
{"christmas_decor:wire", "christmas_decor:wire", "christmas_decor:wire"},
{"christmas_decor:led_rgb", "default:glass", "christmas_decor:led_rgb"},
},
})
minetest.register_node("christmas_decor:garland", {
description = "Garland",
tiles = {"christmas_decor_garland.png"},
inventory_image = "christmas_decor_garland.png",
wield_image = "christmas_decor_garland.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
minetest.register_node("christmas_decor:garland_lights", {
description = "Garland with Lights",
tiles = {
{
image = "christmas_decor_garland_lights.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 64,
aspect_h = 64,
length = 16
},
}
},
inventory_image = "christmas_decor_garland_lights_inv.png",
wield_image = "christmas_decor_garland_lights_inv.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
light_source = 8,
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
if depends.default then
minetest.register_craft({
output = "christmas_decor:garland 3",
recipe = {
{"default:pine_needles", "default:pine_needles", "default:pine_needles"},
},
})
end
minetest.register_craft({
output = "christmas_decor:garland_lights",
type = "shapeless",
recipe = {"christmas_decor:garland", "christmas_decor:led_white", "christmas_decor:led_white", "christmas_decor:led_white"},
})

285
misc.lua Normal file
View File

@ -0,0 +1,285 @@
local depends, default_sounds = ...
if depends.armor then
armor:register_armor("christmas_decor:hat_santa", {
description = "Santa Hat",
inventory_image = "christmas_decor_hat_santa_inv.png",
groups = {armor_head = 1, armor_use = 0},
})
armor:register_armor("christmas_decor:hat_elf", {
description = "Elf Hat",
inventory_image = "christmas_decor_hat_elf_inv.png",
groups = {armor_head = 1, armor_use = 0},
})
minetest.register_alias("christmas_decor:helmet_santa_hat", "christmas_decor:hat_santa")
minetest.register_alias("christmas_decor:helmet_elf_hat", "christmas_decor:hat_elf")
if depends.wool then
minetest.register_craft({
output = "christmas_decor:helmet_santa_hat",
recipe = {
{"", "wool:white", ""},
{"", "wool:red", ""},
{"wool:red", "wool:red", "wool:red"},
},
})
if depends.default then
minetest.register_craft({
output = "christmas_decor:helmet_elf_hat",
recipe = {
{"", "default:bronze_ingot", ""},
{"", "wool:green", ""},
{"wool:red", "wool:green", "wool:red"},
},
})
end
end
end
minetest.register_node("christmas_decor:mistletoe", {
description = "Mistletoe",
tiles = {"christmas_decor_mistletoe.png"},
drawtype = "plantlike",
walkable = false,
sunlight_propagates = true,
paramtype = "light",
use_texture_alpha = true,
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
if depends.default and depends.dye then
minetest.register_craft({
output = "christmas_decor:mistletoe",
type = "shapeless",
recipe = {"default:leaves", "default:leaves", "dye:red"},
})
end
minetest.register_node("christmas_decor:icicles_wall", {
description = "Icicles (wall)",
tiles = {
{
image = "christmas_decor_icicles.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 2
},
}
},
inventory_image = "christmas_decor_icicles_inv.png",
sunlight_propagates = true,
walkable = false,
climbable = false,
is_ground_content = false,
selection_box = {
type = "wallmounted",
},
legacy_wallmounted = true,
use_texture_alpha = true,
drawtype = "signlike",
paramtype = "light",
light_source = 3,
paramtype2 = "wallmounted",
groups = {snappy = 3},
sounds = default_sounds("node_sound_glass_defaults"),
})
minetest.register_node("christmas_decor:icicles_hanging", {
description = "Icicles (hanging)",
tiles = {
{
image = "christmas_decor_icicles.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 32,
aspect_h = 32,
length = 2
},
}
},
use_texture_alpha = true,
inventory_image = "christmas_decor_icicles_hanging_inv.png",
wield_image = "christmas_decor_icicles_hanging_inv.png",
drawtype = "plantlike",
paramtype = "light",
light_source = 3,
paramtype2 = "degrotate",
walkable = false,
groups = {snappy = 3},
sounds = default_sounds("node_sound_glass_defaults"),
})
if depends.default then
minetest.register_craft({
output = "christmas_decor:icicles_hanging 4",
recipe = {
{"default:ice", "", "default:ice"},
{"default:ice", "", "default:ice"},
},
})
end
minetest.register_craft({
output = "christmas_decor:icicles_wall",
type = "shapeless",
recipe = {"christmas_decor:icicles_hanging"},
})
minetest.register_craft({
output = "christmas_decor:icicles_hanging",
type = "shapeless",
recipe = {"christmas_decor:icicles_wall"},
})
if depends.homedecor_exterior then
minetest.register_node("christmas_decor:christmas_shrubbery_large", {
description = "Christmas Shrubbery (large)",
drawtype = "mesh",
mesh = "homedecor_cube.obj",
tiles = {
{
image = "christmas_decor_shrubbery.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 3
},
}
},
paramtype = "light",
light_source = 8,
is_ground_content = false,
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
minetest.register_node("christmas_decor:christmas_shrubbery", {
description = "Christmas Shrubbery",
drawtype = "mesh",
mesh = "homedecor_shrubbery.obj",
tiles = {
{
image = "christmas_decor_shrubbery.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 3
},
},
"homedecor_shrubbery_green_bottom.png",
"homedecor_shrubbery_roots.png"
},
paramtype = "light",
light_source = 8,
is_ground_content = false,
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
selection_box = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
collision_box = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
})
minetest.register_craft({
output = "christmas_decor:christmas_shrubbery",
type = "shapeless",
recipe = {"homedecor:shrubbery_green", "christmas_decor:lights_multicolor"},
})
minetest.register_craft({
output = "christmas_decor:christmas_shrubbery_large",
type = "shapeless",
recipe = {"homedecor:shrubbery_large_green", "christmas_decor:lights_multicolor"},
})
minetest.register_craft({
output = "christmas_decor:christmas_shrubbery",
type = "shapeless",
recipe = {"christmas_decor:christmas_shrubbery_large"},
})
minetest.register_craft({
output = "christmas_decor:christmas_shrubbery_large",
type = "shapeless",
recipe = {"christmas_decor:christmas_shrubbery"},
})
end
minetest.register_node("christmas_decor:nutcracker", {
description = "Nutcracker",
drawtype = "mesh",
mesh = "christmas_decor_nutcracker.obj",
tiles = {"christmas_decor_nutcracker.png"},
use_texture_alpha = true,
inventory_image = "christmas_decor_nutcracker_inv.png",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.4, 0.2},
},
collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.4, 0.2},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_wood_defaults"),
})
if depends.dye and depends.default then
minetest.register_craft({
output = "christmas_decor:nutcracker",
recipe = {
{"dye:yellow", "dye:black", "dye:yellow"},
{"dye:red", "default:wood", "dye:red"},
{"dye:blue", "dye:black", "dye:blue"},
}
})
end
minetest.register_node("christmas_decor:snowman", {
description = "Snowman",
drawtype = "mesh",
mesh = "christmas_decor_snowman.obj",
tiles = {"christmas_decor_snowman.png"},
use_texture_alpha = true,
inventory_image = "christmas_decor_snowman_inv.png",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.2, 0.5},
},
collision_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1.2, 0.5},
},
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default_sounds("node_sound_leaves_defaults"),
})
if depends.default then
minetest.register_craft({
output = "christmas_decor:snowman",
recipe = {
{"default:coal_lump", "default:snowblock", "default:coal_lump"},
{"default:coal_lump", "default:snowblock", "default:coal_lump"},
{"", "default:snowblock", ""},
},
})
end

85
mobs.lua Normal file
View File

@ -0,0 +1,85 @@
local depends = (...)
if not depends.mobs_redo then return end
for name, tag in pairs({santa = "Santa Claus", mrs_claus = "Mrs. Claus"}) do
mobs:register_mob("christmas_decor:" .. name, {
type = "npc",
passive = true,
pathfinding = false,
nametag = tag,
hp_min = 20,
hp_max = 20,
armor = 0,
collisionbox = {-0.35, 0.0, -0.35, 0.35, 1.8, 0.35},
visual = "mesh",
mesh = "character.b3d",
textures = {"christmas_decor_" .. name .. ".png"},
makes_footstep_sound = false,
sounds = {},
walk_velocity = 0,
run_velocity = 0,
jump = false,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
view_range = 15,
owner = "",
fear_height = 3,
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
},
follow = {"christmas_decor:candycane", "christmas_decor:gingerbread_man"},
on_rightclick = function(self, clicker)
if mobs:capture_mob(self, clicker, 100, 100, 100, false, nil) then return end
end
})
mobs:register_egg("christmas_decor:" .. name, tag, "christmas_decor_gumdrop.png^[multiply:red", 1)
mobs:alias_mob("mobs:" .. name, "christmas_decor:" .. name)
end
for name, tag in pairs({reindeer = "Reindeer", rudolf = "Rudolf"}) do
mobs:register_mob("christmas_decor:" .. name, {
type = "animal",
passive = true,
pathfinding = false,
hp_min = 20,
hp_max = 20,
armor = 0,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 1.2, 0.2},
visual = "mesh",
mesh = "christmas_decor_reindeer.b3d",
textures = {"christmas_decor_" .. name .. ".png"},
makes_footstep_sound = false,
walk_velocity = 0,
run_velocity = 0,
jump = false,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
animation = {
speed_normal = 25,
speed_normal = 25,
speed_run = 25,
stand_start = 0,
stand_end = 200,
walk_start = 149,
walk_end = 150,
run_start = 150,
run_end = 170,
},
follow = {"christmas_decor:candycane", "christmas_decor:gingerbread_man"},
view_range = 15,
fear_height = 3,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 0, false, true) then return end
if mobs:capture_mob(self, clicker, 100, 100, 100, false, nil) then return end
end
})
mobs:register_egg("christmas_decor:" .. name, tag, "christmas_decor_gumdrop.png^[multiply:saddlebrown", 1)
mobs:alias_mob("mobs:" .. name, "christmas_decor:" .. name)
end

View File

@ -1 +1,3 @@
name = christmas_decor
description = Christmas-themed decor.
optional_depends = 3d_armor, basic_materials, bucket, default, dye, farming, homedecor_exterior, mobs, mobs_animal stairs, vessels, wool, xpanes

View File

@ -0,0 +1,229 @@
# Blender v2.79 (sub 0) OBJ File: 'gumdrop.blend'
# www.blender.org
mtllib gumdrop.mtl
o Cylinder
v 0.000000 -0.499000 0.000000
v 0.000000 -0.499000 -0.356851
v -0.000000 -0.092094 -0.290854
v 0.178426 -0.499000 -0.309042
v 0.145427 -0.092094 -0.251887
v 0.309042 -0.499000 -0.178426
v 0.251887 -0.092094 -0.145427
v 0.356851 -0.499000 0.000000
v 0.290854 -0.092094 0.000000
v 0.309042 -0.499000 0.178426
v 0.251887 -0.092094 0.145427
v 0.178426 -0.499000 0.309042
v 0.145427 -0.092094 0.251887
v 0.000000 -0.499000 0.356851
v 0.000000 -0.092094 0.290854
v -0.178426 -0.499000 0.309042
v -0.145427 -0.092094 0.251887
v -0.309042 -0.499000 0.178426
v -0.251887 -0.092094 0.145427
v -0.356851 -0.499000 0.000000
v -0.290854 -0.092094 0.000000
v -0.309042 -0.499000 -0.178425
v -0.251887 -0.092094 -0.145427
v -0.178426 -0.499000 -0.309042
v -0.145427 -0.092094 -0.251887
v -0.000000 0.032592 -0.200910
v -0.000000 0.083179 0.000000
v 0.100455 0.032592 -0.173993
v 0.173993 0.032592 -0.100455
v 0.200910 0.032592 0.000000
v 0.173993 0.032592 0.100455
v 0.100455 0.032592 0.173993
v 0.000000 0.032592 0.200910
v -0.100455 0.032592 0.173993
v -0.173993 0.032592 0.100455
v -0.200910 0.032592 0.000000
v -0.173993 0.032592 -0.100455
v -0.100455 0.032592 -0.173993
vt 0.500000 0.500000
vt 0.500000 1.000000
vt 0.750000 0.933013
vt 0.248999 0.001001
vt 0.001001 0.001001
vt 0.001001 0.248999
vt 0.248999 0.248999
vt 1.250000 0.000000
vt 1.250000 0.562500
vt 1.000000 0.562500
vt 1.000000 0.000000
vt 0.933013 0.750000
vt 0.248999 0.251001
vt 0.001001 0.251001
vt 0.001001 0.498999
vt 0.248999 0.498999
vt 0.750000 0.562500
vt 0.750000 -0.000000
vt 1.000000 0.500000
vt 0.498999 0.001001
vt 0.251001 0.001001
vt 0.251001 0.248999
vt 0.498999 0.248999
vt 0.500000 0.562500
vt 0.500000 0.000000
vt 0.933013 0.250000
vt 0.498999 0.251001
vt 0.251001 0.251001
vt 0.251001 0.498999
vt 0.498999 0.498999
vt 0.250000 0.562500
vt 0.250000 -0.000000
vt 0.750000 0.066987
vt 0.248999 0.501001
vt 0.001001 0.501001
vt 0.001001 0.748999
vt 0.248999 0.748999
vt -0.000000 0.562500
vt -0.000000 0.000000
vt 0.500000 0.000000
vt 0.748999 0.001001
vt 0.501001 0.001001
vt 0.501001 0.248999
vt 0.748999 0.248999
vt 3.000000 0.000000
vt 3.000000 0.562500
vt 2.750000 0.562500
vt 2.750000 0.000000
vt 0.250000 0.066987
vt 0.498999 0.501001
vt 0.251001 0.501001
vt 0.251001 0.748999
vt 0.498999 0.748999
vt 2.500000 0.562500
vt 2.500000 0.000000
vt 0.066987 0.250000
vt 0.748999 0.251001
vt 0.501001 0.251001
vt 0.501001 0.498999
vt 0.748999 0.498999
vt 2.250000 0.562500
vt 2.250000 0.000000
vt 0.000000 0.500000
vt 0.748999 0.501001
vt 0.501001 0.501001
vt 0.501001 0.748999
vt 0.748999 0.748999
vt 2.000000 0.562500
vt 2.000000 0.000000
vt 0.066987 0.750000
vt 0.248999 0.751001
vt 0.001001 0.751001
vt 0.001001 0.998999
vt 0.248999 0.998999
vt 1.750000 0.562500
vt 1.750000 -0.000000
vt 0.250000 0.933013
vt 0.998999 0.001001
vt 0.751001 0.001001
vt 0.751001 0.248999
vt 0.998999 0.248999
vt 1.500000 0.562500
vt 1.500000 0.000000
vt 0.498999 0.751001
vt 0.251001 0.751001
vt 0.251001 0.998999
vt 0.498999 0.998999
vt 0.500000 0.500000
vt 0.750000 0.933013
vt 0.500000 1.000000
vt 0.933013 0.750000
vt 1.000000 0.500000
vt 0.933013 0.250000
vt 0.750000 0.066987
vt 0.500000 -0.000000
vt 0.250000 0.066987
vt 0.066987 0.250000
vt -0.000000 0.500000
vt 0.066987 0.750000
vt 0.250000 0.933013
vn 0.0000 -1.0000 0.0000
vn 0.5802 0.5717 -0.5802
vn 0.2557 0.1548 -0.9543
vn 0.7925 0.5717 0.2124
vn 0.6986 0.1548 -0.6986
vn 0.2124 0.5717 0.7925
vn 0.9543 0.1548 -0.2557
vn -0.5802 0.5717 0.5802
vn 0.9543 0.1548 0.2557
vn -0.7925 0.5717 -0.2124
vn 0.6986 0.1548 0.6986
vn 0.7925 0.5717 -0.2124
vn 0.2557 0.1548 0.9543
vn 0.5802 0.5717 0.5802
vn -0.2557 0.1548 0.9543
vn -0.2124 0.5717 0.7925
vn -0.6986 0.1548 0.6986
vn -0.7925 0.5717 0.2124
vn -0.9543 0.1548 0.2557
vn 0.2124 0.5717 -0.7925
vn -0.9543 0.1548 -0.2557
vn -0.5802 0.5717 -0.5802
vn -0.6986 0.1548 -0.6986
vn -0.2124 0.5717 -0.7925
vn -0.2557 0.1548 -0.9543
vn 0.0653 0.9677 -0.2436
vn 0.1784 0.9677 -0.1784
vn 0.2436 0.9677 -0.0653
vn 0.2436 0.9677 0.0653
vn 0.1784 0.9677 0.1784
vn 0.0653 0.9677 0.2436
vn -0.0653 0.9677 0.2436
vn -0.1784 0.9677 0.1784
vn -0.2436 0.9677 0.0653
vn -0.2436 0.9677 -0.0653
vn -0.1784 0.9677 -0.1784
vn -0.0653 0.9677 -0.2436
usemtl Material
s off
f 1/1/1 2/2/1 4/3/1
f 7/4/2 5/5/2 28/6/2 29/7/2
f 2/8/3 3/9/3 5/10/3 4/11/3
f 1/1/1 4/3/1 6/12/1
f 11/13/4 9/14/4 30/15/4 31/16/4
f 4/11/5 5/10/5 7/17/5 6/18/5
f 1/1/1 6/12/1 8/19/1
f 15/20/6 13/21/6 32/22/6 33/23/6
f 6/18/7 7/17/7 9/24/7 8/25/7
f 1/1/1 8/19/1 10/26/1
f 19/27/8 17/28/8 34/29/8 35/30/8
f 8/25/9 9/24/9 11/31/9 10/32/9
f 1/1/1 10/26/1 12/33/1
f 23/34/10 21/35/10 36/36/10 37/37/10
f 10/32/11 11/31/11 13/38/11 12/39/11
f 1/1/1 12/33/1 14/40/1
f 9/41/12 7/42/12 29/43/12 30/44/12
f 12/45/13 13/46/13 15/47/13 14/48/13
f 1/1/1 14/40/1 16/49/1
f 13/50/14 11/51/14 31/52/14 32/53/14
f 14/48/15 15/47/15 17/54/15 16/55/15
f 1/1/1 16/49/1 18/56/1
f 17/57/16 15/58/16 33/59/16 34/60/16
f 16/55/17 17/54/17 19/61/17 18/62/17
f 1/1/1 18/56/1 20/63/1
f 21/64/18 19/65/18 35/66/18 36/67/18
f 18/62/19 19/61/19 21/68/19 20/69/19
f 1/1/1 20/63/1 22/70/1
f 5/71/20 3/72/20 26/73/20 28/74/20
f 20/69/21 21/68/21 23/75/21 22/76/21
f 1/1/1 22/70/1 24/77/1
f 25/78/22 23/79/22 37/80/22 38/81/22
f 22/76/23 23/75/23 25/82/23 24/83/23
f 1/1/1 24/77/1 2/2/1
f 3/84/24 25/85/24 38/86/24 26/87/24
f 24/83/25 25/82/25 3/9/25 2/8/25
f 27/88/26 28/89/26 26/90/26
f 27/88/27 29/91/27 28/89/27
f 27/88/28 30/92/28 29/91/28
f 27/88/29 31/93/29 30/92/29
f 27/88/30 32/94/30 31/93/30
f 27/88/31 33/95/31 32/94/31
f 27/88/32 34/96/32 33/95/32
f 27/88/33 35/97/33 34/96/33
f 27/88/34 36/98/34 35/97/34
f 27/88/35 37/99/35 36/98/35
f 27/88/36 38/100/36 37/99/36
f 27/88/37 26/90/37 38/100/37

View File

@ -0,0 +1,126 @@
# Blender v2.79 (sub 0) OBJ File: 'nutcracker.blend'
# www.blender.org
mtllib nutcracker.mtl
o Player.005_Cube.005
v -0.080000 -0.498000 0.040000
v -0.080000 -0.228000 0.040000
v -0.080000 -0.228000 -0.040000
v -0.080000 -0.498000 -0.040000
v -0.160000 -0.228000 -0.040000
v -0.160000 -0.228000 0.040000
v -0.160000 0.042000 -0.040000
v -0.160000 0.042000 0.040000
v -0.080000 0.362000 0.080000
v -0.080000 0.042000 0.080000
v -0.080000 0.362000 -0.080000
v -0.080000 0.042000 -0.080000
v 0.080000 0.362000 0.080000
v 0.080000 0.042000 0.080000
v 0.080000 0.362000 -0.080000
v 0.080000 0.042000 -0.080000
v 0.080000 -0.228000 0.040000
v 0.080000 -0.498000 0.040000
v 0.080000 -0.498000 -0.040000
v 0.080000 -0.228000 -0.040000
v 0.160000 0.042000 0.040000
v 0.160000 -0.228000 0.040000
v 0.160000 0.042000 -0.040000
v 0.160000 -0.228000 -0.040000
v -0.088000 0.202000 0.088000
v -0.088000 0.042000 0.088000
v -0.088000 0.202000 -0.088000
v -0.088000 0.042000 -0.088000
v 0.088000 0.202000 0.088000
v 0.088000 0.042000 0.088000
v 0.088000 0.202000 -0.088000
v 0.088000 0.042000 -0.088000
vt 0.142857 0.375000
vt 0.214286 0.375000
vt 0.214286 0.000000
vt 0.142857 0.000000
vt 0.000000 0.000000
vt 0.142857 0.000000
vt 0.142857 0.375000
vt -0.000000 0.375000
vt 0.714286 0.375000
vt 0.642857 0.375000
vt 0.642857 0.000000
vt 0.714286 0.000000
vt 0.357143 0.000000
vt 0.357143 0.375000
vt 0.214286 0.375000
vt 0.214286 0.000000
vt 0.357143 0.375000
vt 0.642857 0.500000
vt 0.357143 0.500000
vt 0.428571 1.000000
vt 0.285714 1.000000
vt 0.285714 0.500000
vt 0.428571 0.500000
vt 0.571429 1.000000
vt 0.571429 0.500000
vt 0.142857 1.000000
vt 0.142857 0.500000
vt 0.000000 1.000000
vt 0.000000 0.500000
vt 0.714286 1.000000
vt 0.571429 1.000000
vt 0.571429 0.750000
vt 0.714286 0.750000
vt 0.714286 0.500000
vt 0.714286 0.750000
vt 0.571429 0.750000
vt 0.571429 0.500000
vt 0.357143 0.500000
vt 0.214286 0.500000
vt 0.214286 0.375000
vt 0.357143 0.375000
vt 0.642857 0.375000
vt 0.642857 0.000000
vt 0.714286 0.000000
vt 0.714286 0.375000
vt 1.000000 0.375000
vt 1.000000 0.500000
vt 0.714286 0.500000
vt 0.714286 0.375000
vt 0.357143 0.000000
vt 1.000000 0.000000
vt 1.000000 0.375000
vt 0.857143 0.750000
vt 0.714286 0.750000
vt 0.714286 0.500000
vt 0.857143 0.500000
vt 1.000000 0.750000
vt 1.000000 0.500000
vt 0.857143 0.750000
vt 0.857143 0.500000
vt 0.714286 0.500000
vt 0.714286 0.750000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
usemtl Material
s off
f 2/1/1 3/2/1 4/3/1 1/4/1
f 1/5/2 18/6/2 17/7/2 2/8/2
f 8/9/1 7/10/1 5/11/1 6/12/1
f 4/13/3 3/14/3 20/15/3 19/16/3
f 23/17/4 7/10/4 8/18/4 21/19/4
f 9/20/1 11/21/1 12/22/1 10/23/1
f 13/24/2 9/20/2 10/23/2 14/25/2
f 11/21/3 15/26/3 16/27/3 12/22/3
f 13/28/5 14/29/5 16/27/5 15/26/5
f 11/30/4 9/31/4 13/32/4 15/33/4
f 16/34/6 14/35/6 10/36/6 12/37/6
f 17/7/5 18/6/5 19/16/5 20/15/5
f 4/38/6 19/39/6 18/40/6 1/41/6
f 21/42/5 22/43/5 24/44/5 23/45/5
f 6/46/6 5/47/6 24/48/6 22/49/6
f 24/50/3 5/11/3 7/10/3 23/17/3
f 22/51/2 21/52/2 8/9/2 6/12/2
f 25/53/1 27/54/1 28/55/1 26/56/1
f 29/57/2 25/53/2 26/56/2 30/58/2
f 29/59/5 30/60/5 32/61/5 31/62/5

Binary file not shown.

View File

@ -0,0 +1,180 @@
# Blender v2.79 (sub 0) OBJ File: 'snowman.blend'
# www.blender.org
mtllib snowman.mtl
o Cube.002
v 0.228415 0.582000 -0.157030
v 0.228415 0.974000 -0.157030
v 0.157030 0.582000 0.228415
v 0.157030 0.974000 0.228415
v -0.157030 0.582000 -0.228415
v -0.157030 0.974000 -0.228415
v -0.228415 0.582000 0.157030
v -0.228415 0.974000 0.157030
v 0.059783 0.789530 -0.188261
v 0.059783 0.740530 -0.188261
v 0.011602 0.740530 -0.197184
v 0.011602 0.789530 -0.197184
v 0.228415 0.789530 -0.157030
v 0.228415 0.740530 -0.157030
v 0.059783 0.974000 -0.188261
v 0.011602 0.974000 -0.197184
v -0.157030 0.789530 -0.228415
v -0.157030 0.740530 -0.228415
v 0.011602 0.582000 -0.197184
v 0.059783 0.582000 -0.188261
v 0.040739 0.789530 -0.354509
v 0.088920 0.789530 -0.345586
v 0.088920 0.740530 -0.345586
v 0.040739 0.740530 -0.354509
v 0.257984 0.142000 -0.300407
v 0.257984 0.590000 -0.300407
v 0.300407 0.142000 0.257984
v 0.300407 0.590000 0.257984
v -0.300407 0.142000 -0.257984
v -0.300407 0.590000 -0.257984
v -0.257984 0.142000 0.300407
v -0.257984 0.590000 0.300407
v 0.452312 -0.498000 -0.339727
v 0.452312 0.142000 -0.339727
v 0.339727 -0.498000 0.452312
v 0.339727 0.142000 0.452312
v -0.339727 -0.498000 -0.452312
v -0.339727 0.142000 -0.452312
v -0.452312 -0.498000 0.339727
v -0.452312 0.142000 0.339727
vt 0.320000 0.000000
vt 0.320000 0.437500
vt 0.320000 0.562500
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.562500
vt 0.000000 0.437500
vt 0.000000 0.000000
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.320000 0.437500
vt 0.320000 0.562500
vt 0.320000 1.000000
vt 0.960000 0.437500
vt 0.960000 0.562500
vt 0.820000 0.562500
vt 0.820000 0.437500
vt 0.820000 1.000000
vt 0.780000 1.000000
vt 0.780000 0.562500
vt 0.640000 0.562500
vt 0.640000 0.437500
vt 0.780000 0.437500
vt 0.640000 0.000000
vt 0.780000 0.000000
vt 0.640000 1.000000
vt 0.820000 0.000000
vt 0.960000 0.500000
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.960000 1.000000
vt 0.960000 1.000000
vt 0.960000 0.000000
vt 1.000000 0.375000
vt 1.000000 0.500000
vt 0.960000 0.500000
vt 0.960000 0.375000
vt 0.960000 0.500000
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.960000 1.000000
vt 0.960000 0.500000
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.960000 1.000000
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.125000
vt 0.320000 0.125000
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.125000
vt 0.320000 0.125000
vt 0.320000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.125000
vt 0.320000 0.125000
vt 0.640000 0.125000
vt 0.640000 1.000000
vt 0.320000 1.000000
vt 0.320000 0.125000
vt 0.320000 1.000000
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.000000 0.937500
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.320000 0.937500
vt 0.320000 0.000000
vt 0.320000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.000000
vt 0.000000 0.937500
vt 0.000000 0.000000
vt 0.320000 0.000000
vt 0.320000 0.937500
vt 0.320000 0.000000
vt 0.320000 0.937500
vt 0.000000 0.937500
vt 0.000000 0.000000
vt 0.000000 1.000000
vt 0.320000 1.000000
vt 0.320000 1.000000
vt 0.000000 1.000000
vn 0.9833 0.0000 0.1821
vn -0.1821 0.0000 0.9833
vn -0.9833 0.0000 -0.1821
vn 0.0000 1.0000 0.0000
vn 0.1821 0.0000 -0.9833
vn 0.0000 -1.0000 -0.0000
vn 0.9971 0.0000 -0.0758
vn 0.0758 0.0000 0.9971
vn -0.9971 0.0000 0.0758
vn -0.0758 0.0000 -0.9971
vn 0.9900 0.0000 0.1407
vn -0.1407 0.0000 0.9900
vn -0.9900 0.0000 -0.1407
vn 0.1407 0.0000 -0.9900
usemtl Material
s off
f 1/1/1 14/2/1 13/3/1 2/4/1 4/5/1 3/6/1
f 3/7/2 4/8/2 8/9/2 7/10/2
f 7/11/3 8/12/3 6/13/3 17/14/3 18/15/3 5/16/3
f 8/9/4 4/17/4 2/18/4 15/19/4 16/20/4 6/21/4
f 18/22/5 17/23/5 12/24/5 11/25/5
f 12/24/5 16/26/5 15/27/5 9/28/5
f 9/28/5 13/29/5 14/30/5 10/31/5
f 1/32/5 20/33/5 10/31/5 14/30/5
f 2/34/5 13/29/5 9/28/5 15/27/5
f 20/33/5 19/35/5 11/25/5 10/31/5
f 10/36/6 11/37/6 24/38/6 23/39/6
f 6/40/5 16/26/5 12/24/5 17/23/5
f 5/41/5 18/22/5 11/25/5 19/35/5
f 24/42/5 21/43/5 22/44/5 23/45/5
f 12/46/4 9/47/4 22/48/4 21/49/4
f 11/37/3 12/46/3 21/49/3 24/38/3
f 9/50/1 10/51/1 23/52/1 22/53/1
f 25/54/7 26/55/7 28/56/7 27/57/7
f 27/58/8 28/59/8 32/60/8 31/61/8
f 31/62/9 32/63/9 30/64/9 29/65/9
f 29/66/10 30/67/10 26/68/10 25/69/10
f 32/70/4 28/59/4 26/71/4 30/72/4
f 33/73/11 34/74/11 36/75/11 35/76/11
f 35/77/12 36/78/12 40/79/12 39/80/12
f 39/81/13 40/82/13 38/83/13 37/84/13
f 37/85/14 38/86/14 34/87/14 33/88/14
f 35/89/6 39/80/6 37/85/6 33/90/6
f 40/91/4 36/92/4 34/74/4 38/83/4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 429 KiB

View File

@ -1,127 +1,80 @@
local stocking = {}
local stuffer = {}
stuffer.stuffers = {}
local depends, default_sounds = ...
function stuffer.register_stuff(name, count)
if count == nil then count = 1 end
local stuff = {
name = name,
count = count,
metadata = "",
}
table.insert(stuffer.stuffers, stuff)
end
local stuffers = {}
local custom_stuffers = minetest.settings:get("christmas_decor.stocking_stuffers")
function stuffer.select_stuffers(count)
local p_stuffers = {}
for i=1,#stuffer.stuffers do
table.insert(p_stuffers, stuffer.stuffers[i])
if custom_stuffers then
-- Format: modname:itemname count
-- Count is optional (default: 1)
-- Example: christmas_decor.stocking_stuffers = default:gold_ingot 99, default:coal_lump 20, default:snow
for stack in custom_stuffers:gmatch("[%w%d:_]+ *%d*") do
stuffers[#stuffers + 1] = stack
end
local itemstacks = {}
for i=1,#stuffer.stuffers do
itemstacks[i] = stuffer.stuff_to_itemstack(stuffer.stuffers[i])
end
return itemstacks
end
function stuffer.stuff_to_itemstack(stuff)
local itemstack = {}
itemstack.name = stuff.name
itemstack.count = stuffer.determine_count(stuff)
itemstack.metadata = stuff.metadata
return ItemStack(itemstack)
end
function stuffer.determine_count(stuff)
if(type(stuff.count)=="number") then
return stuff.count
else
for _, stack in pairs({
"christmas_decor:candycane 20",
"christmas_decor:gingerbread_man 10",
"christmas_decor:hat_elf 1",
"default:gold_ingot 99",
"default:pick_mese 1",
"default:sword_mese 1",
"default:axe_mese 1",
"default:shovel_mese 1",
}) do
stuffers[#stuffers + 1] = stack
end
end
-- REGISTER STUFFERS BELOW HERE
local stocking_form = [[
size[9,9]
background[-0.8,-0.4;10,10;christmas_decor_stocking_bg.png]
image_button_exit[7.75,1;1,1;christmas_decor_button_exit.png;exit;]
listcolors[#D4393C;#d45658]
list[context;main;-0.2,2;8,2;]
list[current_player;main;-0.2,5;8,4;]
listring[context;main]
listring[current_player;main]
]]
--stuffer.register_stuff("modname:nodename", amount)
stuffer.register_stuff("default:gold_ingot", 200)
stuffer.register_stuff("christmas_decor:candycane_edible", 20)
stuffer.register_stuff("default:pick_mese", 1)
stuffer.register_stuff("default:sword_mese", 1)
stuffer.register_stuff("default:axe_mese", 1)
stuffer.register_stuff("default:shovel_mese", 1)
stuffer.register_stuff("farming:hoe_mese", 1)
-- REGISTER STUFFERS ABOVE HERE
function stocking.get_stocking_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," ..pos.z
local formspec =
"size[9,9]"..
"background[-0.8,-0.4;10,10;stocking_bg.png]"..
"image_button_exit[7.75,1;1,1;exit_button.png;exit;]"..
"listcolors[#D4393C;#d45658]"..
"list[nodemeta:".. spos .. ";main;-0.2,2;8,2;]"..
"list[current_player;main;-0.2,5;8,4;]" ..
"listring[current_player;main]"
return formspec
local function get_date()
return tonumber(os.date("%Y")), tonumber(os.date("%m")), tonumber(os.date("%d"))
end
stocking.can_dig_function = function(pos, player)
local meta = minetest.get_meta(pos);
local name = player and player:get_player_name()
local owner = meta:get_string("owner")
local inv = meta:get_inventory()
return name == owner and inv:is_empty("main")
end
local days_elapsed_in_year = function(year, month, day)
local days_elapsed_in_month = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}
local days_elapsed_in_leapyear_month = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
local function is_leap_year(year)
return year % 4 == 0 and (year % 100 ~= 0 or year % 400 == 0)
end
if is_leap_year(year) then
return (days_elapsed_in_leapyear_month[month] + (day - 1))
else
return (days_elapsed_in_month[month] + (day - 1))
end
end
local date_in_seconds = function()
local year = tonumber(os.date("%Y"))
local month = tonumber(os.date("%m"))
local day = tonumber(os.date("%d"))
local second = tonumber(os.date("%S"))
local minute = tonumber(os.date("%M"))
local hour = tonumber(os.date("%H"))
return ((days_elapsed_in_year(year, month, day) * 86400) + (hour * 3600) + (minute * 60) + second)
end
local christmas_date = 30931200 --Christmas date in seconds
check_fillable = function(pos)
local year = tonumber(os.date("%Y"))
local function try_stocking_fill(pos)
local year, month, day = get_date()
local meta = minetest.get_meta(pos)
if year == meta:get_int("fill_year") then
if date_in_seconds() > christmas_date then
return true
elseif date_in_seconds() <= christmas_date then
return false
local last_fill_year = meta:get_int("last_fill_year")
local ellapsed = year - (last_fill_year ~= 0 and last_fill_year or meta:get_int("fill_year")) -- fill_year is legacy
-- If it has been 2 or more years, Christmas has already passed at least once
-- If it has only been one year, make sure it is after Christmas
if ellapsed > 1 or (ellapsed == 1 and month == 12 and day >= 25) then
local inv = meta:get_inventory()
for _, stack in pairs(stuffers) do
if minetest.registered_items[stack:gsub("%s.*", "")] then
inv:add_item("main", stack)
end
end
elseif year > meta:get_int("fill_year") then
return true
-- Always set to this year if after Christmas, otherwise set to last year
meta:set_int("last_fill_year", (month == 12 and day >= 25) and year or year - 1)
end
end,
end
local function player_can_interact(pos, player)
local is_owner = player and player:get_player_name() == minetest.get_meta(pos):get_string("owner")
local can_bypass = player and minetest.check_player_privs(player, "protection_bypass")
return is_owner or can_bypass
end
minetest.register_node("christmas_decor:stocking", {
description = "Stocking",
drawtype = "mesh",
mesh = "stocking.obj",
tiles = {"velvet_fluff.png"},
mesh = "christmas_decor_stocking.obj",
tiles = {"christmas_decor_stocking.png"},
use_texture_alpha = true,
inventory_image = "inv_stocking.png",
wield_image = "inv_stocking.png",
inventory_image = "christmas_decor_stocking_inv.png",
wield_image = "christmas_decor_stocking_inv.png",
walkable = false,
selection_box = {
type = "fixed",
@ -135,15 +88,14 @@ minetest.register_node("christmas_decor:stocking", {
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {snappy = 3},
sounds = default.node_sound_leaves_defaults(),
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if player then
minetest.chat_send_player(player:get_player_name(), "Wait until Christmas Eve for Santa to fill your stocking!")
return 0
end
end,
sounds = default_sounds("node_sound_leaves_defaults"),
on_place = function(itemstack, placer, pointed_thing)
if minetest.is_yes(placer:get_attribute("has_placed_stocking")) then
-- Convert legacy attribute values
if placer.get_attribute and placer:get_attribute("has_placed_stocking") then
placer:get_meta():set_int("has_placed_stocking", minetest.is_yes(placer:get_attribute("has_placed_stocking")) and 1 or 0)
end
if minetest.is_yes(placer:get_meta():get_int("has_placed_stocking")) then
minetest.chat_send_player(placer:get_player_name(), "Santa won't fill more than one stocking!")
return itemstack
else
@ -153,91 +105,63 @@ minetest.register_node("christmas_decor:stocking", {
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local owner = placer:get_player_name()
local inv = meta:get_inventory()
meta:set_string("owner", owner)
meta:set_string("infotext", owner.."'s Stocking")
local inv = meta:get_inventory()
inv:set_size("main", 8*2)
placer:set_attribute("has_placed_stocking", "true")
local year = tonumber(os.date("%Y"))
if date_in_seconds() >= christmas_date then
meta:set_int("fill_year", year + 1)
elseif date_in_seconds() < christmas_date then
meta:set_int("fill_year", year)
end
meta:set_string("formspec", stocking_form)
inv:set_size("main", 8 * 2)
local year, month, day = get_date()
meta:set_int("last_fill_year", (month == 12 and day >= 25) and year or year - 1)
placer:get_meta():set_int("has_placed_stocking", 1)
end,
on_rightclick = function(pos, node, clicker, itemstack)
on_rightclick = function(pos)
-- Legacy handling
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local player = clicker:get_player_name()
local stuffers = stuffer.select_stuffers()
local year = tonumber(os.date("%Y"))
local owner = meta:get_string("owner")
if owner == player then
if check_fillable(pos) == true or clicker:get_attribute("needs_fill") == "true" then
for i=1, #stuffers do
inv:set_stack("main", i, stuffers[i])
end
if date_in_seconds() >= christmas_date then
meta:set_int("fill_year", year + 1)
elseif date_in_seconds() < christmas_date then
meta:set_int("fill_year", year)
end
clicker:set_attribute("needs_fill", "false")
end
if owner == player then
minetest.show_formspec(
clicker:get_player_name(),
"default:chest_locked",
stocking.get_stocking_formspec(pos))
else
return itemstack
end
return itemstack
if meta:get_string("formspec") == "" then
meta:set_string("formspec", stocking_form)
end
try_stocking_fill(pos)
end,
can_dig = stocking.can_dig_function,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
minetest.log("action", player:get_player_name() ..
" moves stuff in stocking at " .. minetest.pos_to_string(pos))
can_dig = function(pos, player)
return player_can_interact(pos, player) and minetest.get_meta(pos):get_inventory():is_empty("main")
end,
allow_metadata_inventory_move = function(pos, _, _, _, _, count, player)
return player_can_interact(pos, player) and count or 0
end,
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() .. " moves stuff in stocking at " .. minetest.pos_to_string(pos))
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" moves stuff to stocking at " .. minetest.pos_to_string(pos))
minetest.log("action", player:get_player_name() .. " moves stuff to stocking at " .. minetest.pos_to_string(pos))
end,
on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() ..
" takes stuff from stocking at " .. minetest.pos_to_string(pos))
minetest.log("action", player:get_player_name() .. " takes stuff from stocking at " .. minetest.pos_to_string(pos))
end,
on_dig = function(pos, node, digger)
local meta = minetest.get_meta(pos)
local inv = digger:get_inventory()
if stocking.can_dig_function(pos, digger) then
if minetest.is_yes(check_fillable(pos)) then
digger:set_attribute("needs_fill", "true")
end
digger:set_attribute("has_placed_stocking", "false")
minetest.remove_node(pos)
inv:add_item("main", "christmas_decor:stocking")
end
end
digger:get_meta():set_int("has_placed_stocking", 0)
return minetest.node_dig(pos, node, digger)
end,
})
-- Crafts
minetest.register_craft({
output = "christmas_decor:stocking",
recipe = {
{"", "wool:white", "wool:white"},
{"", "wool:red", "wool:red"},
{"wool:red", "wool:red", "wool:red"},
}
})
if depends.wool then
minetest.register_craft({
output = "christmas_decor:stocking",
recipe = {
{"", "wool:white", "wool:white"},
{"", "wool:red", "wool:red"},
{"wool:red", "wool:red", "wool:red"},
}
})
minetest.register_craft({
output = "christmas_decor:stocking",
recipe = {
{"wool:white", "wool:white", ""},
{"wool:red", "wool:red", ""},
{"wool:red", "wool:red", "wool:red"},
}
})
minetest.register_craft({
output = "christmas_decor:stocking",
recipe = {
{"wool:white", "wool:white", ""},
{"wool:red", "wool:red", ""},
{"wool:red", "wool:red", "wool:red"},
}
})
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Some files were not shown because too many files have changed in this diff Show More