This commit is contained in:
Extex101 2019-12-12 16:49:44 -08:00 committed by GitHub
commit 50336b7401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 6573 additions and 0 deletions

59
LICENSE.TXT Normal file
View File

@ -0,0 +1,59 @@
License of source code
----------------------
The MIT License (MIT)
Copyright (C) 2019 Extex
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 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.
For more details:
https://opensource.org/licenses/MIT
Licenses of media (texture)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
Copyright (C) 2019 Extex
You are free to:
Share — copy and redistribute the material in any medium or format.
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license, and
indicate if changes were made. You may do so in any reasonable manner, but not in any way
that suggests the licensor endorses you or your use.
ShareAlike — If you remix, transform, or build upon the material, you must distribute
your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures that
legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions necessary
for your intended use. For example, other rights such as publicity, privacy, or moral
rights may limit how you use the material.
For more details:
http://creativecommons.org/licenses/by-sa/3.0/

68
crafting.lua Normal file
View File

@ -0,0 +1,68 @@
local depends = {}
depends.default = minetest.get_modpath("default")
depends.farming = minetest.get_modpath("farming")
depends.wool = minetest.get_modpath("wool")
depends.dye = minetest.get_modpath("dye")
if depends.default then
if depends.farming then
minetest.register_craft({
type = "shapeless",
output = "christmas:mince_pie 3",
recipe = {
"default:blueberries",
"farming:flour",
"default:apple",
"default:blueberries",
"christmas:sugar"
},
})
end
minetest.register_craft({
output = "christmas:present",
recipe = {
{"default:paper","default:paper","default:paper"},
{"default:paper","","default:paper"},
{"default:paper","default:paper","default:paper"},
},
})
minetest.register_craft({
output = "default:paper 8",
recipe = {
{"christmas:present"},
},
})
end
if depends.wool then
minetest.register_craft({
output = "christmas:stocking",
recipe = {
{"","wool:white","wool:white"},
{"default:gold_ingot","wool:red","wool:red"},
{"wool:red","wool:red","wool:red"},
},
})
end
if depends.dye then
minetest.register_craft({
output = "christmas:candy_cane 12",
recipe = {
{"dye:red","christmas:sugar","dye:white"},
{"christmas:sugar","dye:white","christmas:sugar"},
{"christmas:sugar","dye:red",""},
},
})
end
minetest.register_craft({
output = "christmas:tree",
recipe = {
{"group:leaves","group:leaves","group:leaves"},
{"group:leaves","group:leaves","group:leaves"},
{"group:leaves","group:tree","group:leaves"},
},
})

BIN
crafting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
farming?
default?
wool?
dye?

146
functions.lua Normal file
View File

@ -0,0 +1,146 @@
local function xplayer(player)
if not player:is_player() then
return
end
local name = player:get_player_name()
return christmas.players[name]
end
function christmas.get_present_formspec(pos)--Taken from default chest
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
"list[nodemeta:" .. spos .. ";main;3.5,2.5;1,1;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]"
return formspec
end
function christmas.to_time(time)
local remaining = time % 86400
remaining = remaining % 3600
local minutes = math.floor(remaining/60)
remaining = remaining % 60
local seconds = remaining
if (minutes < 10) then
minutes = "0" .. tostring(minutes)
end
if (seconds < 10) then
seconds = "0" .. tostring(seconds)
end
answer = minutes..':'..seconds
return answer
end
function christmas.register_reward(item, quantity, rarity)
table.insert(christmas.rewards, {item=item, quantity=quantity, rarity=rarity})
end
function christmas.random_reward()--Adapted from Dungeontest room selection "dungeon_rooms.random_roomdata"
local pool = christmas.rewards
local candidates = {}
local raresum = 0
for i=1, #pool do
local reward = pool[i]
table.insert(candidates, pool)
raresum = raresum + reward.rarity
end
local rarepick = math.random() * raresum
local rarecount = 0
for c=1, #candidates do
local rewards = candidates[c]
rarecount = rarecount + christmas.rewards[c].rarity
local q = christmas.rewards[c].quantity
local quantity = math.random(q.min, q.max)
if rarecount >= rarepick then
--return christmas.rewards[c].item
return ItemStack(christmas.rewards[c].item.." "..quantity)
end
end
end
function christmas.eat_candy(hp_change, replace_with_item)
return function(itemstack, user, pointed_thing)
local name = user:get_player_name()
local p = xplayer(user)
christmas.players[name].candy = p.candy +1
if p.candy == 8 then
p.time = 60
p.hud.ui = user:hud_add({
hud_elem_type = "image",
position = {x = 0.2, y = 0.2},
offset = {x = 0, y = 0},
text = "christmas_powerup_ui.png",
scale = { x = 10, y = 10},
alignment = { x = 0, y = 0 },
})
p.hud.icon = user:hud_add({
hud_elem_type = "image",
position = {x = 0.2, y = 0.2},
offset = {x = 0, y = 0},
text = "christmas_candy_cane.png",
scale = { x = 10, y = 10},
alignment = { x = 0, y = 0 },
})
p.hud.time = user:hud_add({
hud_elem_type = "text",
position = {x = 0.2, y = 0.2},
offset = {x = 0, y = 0},
text = "SUGAR RUSH!!\n"..christmas.to_time (p.time),
number = 0xffffff,
scale = { x = 10, y = 10},
alignment = { x = 0, y = 0 },
})
end
if p.time > 0 then
p.time = p.time + 3
end
return minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
end
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
christmas.players[name] = {}
christmas.players[name].candy = 0
christmas.players[name].hud = {}
christmas.players[name].time = 0
end)
local t = 0
minetest.register_globalstep (function(dtime)
t = t + dtime
if t > 1 then
t = 0
end
for _, player in ipairs(minetest.get_connected_players()) do
local p = xplayer(player)
if p.time > 0 and t > 1-dtime then
p.time = p.time - 1
player:hud_change(p.hud.time, "text", "SUGAR RUSH!!\n~~"..christmas.to_time(p.time).."~~")
elseif math.floor(p.time) == 1 then
p.candy = 0
end
if p.time > 0 then
player:set_physics_override({
speed = 2.5,
})
end
--minetest.chat_send_all(p.candy)
if p.time == 0 then
player:set_physics_override({
speed = 1,
})
player:hud_remove(p.hud.ui)
player:hud_remove(p.hud.icon)
player:hud_remove(p.hud.time)
end
end
end)

330
init.lua Normal file
View File

@ -0,0 +1,330 @@
christmas = {}
christmas.players = {}
christmas.path = minetest.get_modpath("christmas")
christmas.rewards = {}
local mod_storage = minetest.get_mod_storage()
dofile(christmas.path.."/functions.lua" )
dofile(christmas.path.."/crafting.lua")
local data = christmas.data
------------------------------------ Craft Items ------------------------------------
minetest.register_craftitem("christmas:candy_cane", {
description = "Candy Cane",
inventory_image = "christmas_candy_cane.png",
on_use = christmas.eat_candy(1)
})
minetest.register_craftitem("christmas:mince_pie", {
description = "Mince Pie",
inventory_image = "christmas_mincepie.png",
on_use = minetest.item_eat(6)
})
minetest.register_craftitem("christmas:sugar", {
description = "Sugar",
inventory_image = "christmas_sugar.png",
})
minetest.register_craftitem("christmas:gingerbread_man", {
description = "Gingerbread Man",
inventory_image = "christmas_gingerbread_man.png",
on_use = minetest.item_eat(4)
})
minetest.register_craftitem("christmas:bauble_red", {
description = "Bauble (Red)",
inventory_image = "christmas_bauble_red.png",
groups = {tree_bauble=1},
colour_code = 1,--Future support
})
minetest.register_craftitem("christmas:star", {
description = "Star",
inventory_image = "christmas_star_inv.png",
groups = {tree_topper=1},
})
------------------------------------ Nodes ------------------------------------
minetest.register_node("christmas:eggnog", {
description = "Eggnog",
drawtype = "plantlike",
tiles = {"christmas_eggnog.png"},
inventory_image = "christmas_eggnog.png",
on_use = minetest.item_eat(10),
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
})
minetest.register_node("christmas:present", {
description = "Christmas present",
tiles = {
"christmas_present.png",
"christmas_present_top.png"
},
drawtype = "mesh",
paramtype = "light",
mesh = "christmas_present.obj",
groups = {oddly_breakable_by_hand = 3, attached_node = 1},
selection_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, -0.3125, 0.3125, 0.125, 0.3125},
}
},
on_construct = function(pos, itemstack, placer, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Christmas Present")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 1)
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
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", "Present from ".. meta:get_string("owner"))
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.after(0.2,
minetest.show_formspec,
player:get_player_name(),
"christmas:present",
christmas.get_present_formspec(pos))
end,
})
minetest.register_node("christmas:stocking", {
description = "Christmas Stocking",
drawtype = "signlike",
tiles = {"christmas_stocking.png"},
inventory_image = "christmas_stocking.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
selection_box = {
type = "wallmounted",
},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, attached_node = 1},
walkable = false,
on_construct = function(pos, itemstack, placer, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Stocking: No owner")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 3)
end,
after_place_node = function(pos, player, itemstack, pointed_thing)
local name = player:get_player_name()
local meta = minetest.get_meta(pos)
local stocking_pos = mod_storage:get_string(name.."_stocking_pos")
local spos = minetest.string_to_pos(stocking_pos)
if (spos and minetest.get_node(spos).name ~= "christmas:stocking") or stocking_pos == (nil or "") then
mod_storage:set_string(name.."_stocking_pos", minetest.pos_to_string(pos))
elseif spos and minetest.get_node(spos).name == "christmas:stocking" then
minetest.set_node(pos, {name="air"})
minetest.chat_send_player(name, "You already have a stocking at: ".. stocking_pos)
return itemstack
end
meta:set_string("infotext", player:get_player_name().."'s Stocking")
meta:set_string("owner", player:get_player_name())
local timer = minetest.get_node_timer(pos)
timer:start(5400)
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
local stocking_pos = mod_storage:get_string(owner.."_stocking_pos")
local spos = minetest.string_to_pos(stocking_pos)
if minetest.string_to_pos(stocking_pos) == pos then
mod_storage:set_string(owner.."_stocking_pos", " ")
end
end,
on_timer = function(pos)
local meta = minetest.get_meta(pos)
local owner = meta:get_string("owner")
minetest.chat_send_player(owner, "Your stocking has refilled")--Hooray
local inv = meta:get_inventory()
inv:set_stack("main", 1, christmas.random_reward())
inv:set_stack("main", 2, christmas.random_reward())
inv:set_stack("main", 3, christmas.random_reward())
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
local timer = minetest.get_node_timer(pos)
local owner = meta:get_string("owner")
local playerinv = player:get_inventory()
if player:get_player_name() ~= owner then
minetest.chat_send_player(player:get_player_name(), "This isn't your stocking")--Imposter!!
return itemstack
end
local inv = meta:get_inventory()
if inv:is_empty("main") then
local time = christmas.to_time(math.floor(timer:get_timeout() - timer:get_elapsed()))
minetest.chat_send_player(owner, "Your stocking is empty. (refill in: "..time..")")--Whyyyyyyy??? 😭
elseif not inv:is_empty("main") then
local item1 = inv:get_stack("main", 1)
local leftover1 = playerinv:add_item("main", item1)
local item2 = inv:get_stack("main", 2)
local leftover2 = playerinv:add_item("main", item2)
local item3 = inv:get_stack("main", 3)
local leftover3 = playerinv:add_item("main", item3)
timer:start(5400)
end
end,
})
minetest.register_node("christmas:lights", {
description = "Christmas lights",
drawtype = "signlike",
tiles = {
{
name = "christmas_lights_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
inventory_image = "christmas_lights.png",
wield_image = "christmas_lights.png",
paramtype = "light",
paramtype2 = "wallmounted",
light_source = 3,
selection_box = {
type = "wallmounted",
},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, attached_node = 1},
walkable = false,
})
------------------------------------ Christmas tree ------------------------------------
minetest.register_node("christmas:tree", {
description = "Christmas Tree",
tiles = {
"christmas_tree_leaves.png"
},
inventory_image = "christmas_tree_inv.png",
drawtype = "mesh",
paramtype = "light",
mesh = "christmas_tree.obj",
groups = {snappy = 2, attached_node = 1},
collision_box = {
type = "fixed",
fixed = {-0.625, -0.5, -0.625, 0.625, 2, 0.625},
},
selection_box = {
type = "fixed",
fixed = {-0.75, -0.5, -0.75, 0.75, 2.3125, 0.75},
},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
local pos2 = {x=pos.x, y=pos.y+2, z=pos.z}
local node1 = minetest.get_node(pos1)
local node2 = minetest.get_node(pos2)
if node1.name ~= "air" or node2.name ~= "air" then
minetest.set_node(pos, {name="air"})
minetest.chat_send_player(placer:get_player_name(), "You need a 3 block tall space to place the tree")
return itemstack
end
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local item = minetest.registered_items[itemstack:get_name()]
if item.groups.tree_bauble ~= nil then
local pos2 = {x=pos.x, y=pos.y+1, z=pos.z}
local name = minetest.get_node(pos2).name
if minetest.registered_nodes[name].buildable_to then
minetest.set_node(pos2, {name="christmas:ornament"})
end
itemstack:take_item()
elseif item.groups.tree_topper ~= nil then
local pos2 = {x=pos.x, y=pos.y+2, z=pos.z}
local name = minetest.get_node(pos2).name
if minetest.registered_nodes[name].buildable_to then
minetest.set_node(pos2, {name="christmas:topper"})
end
itemstack:take_item()
end
end,
on_destruct = function(pos)
local pos1 = {x=pos.x, y=pos.y+1, z=pos.z}
local pos2 = {x=pos.x, y=pos.y+2, z=pos.z}
local name = minetest.get_node(pos1).name
local name2 = minetest.get_node(pos2).name
minetest.after(0.01, function()
if name == "christmas:ornament" then
minetest.set_node(pos1, {name="air"})
minetest.add_item(pos1, "christmas:bauble_red")
end
if name2 == "christmas:topper" then
minetest.set_node(pos2, {name="air"})
minetest.add_item(pos2, "christmas:star")
end
end)
end,
})
minetest.register_node("christmas:ornament", {
description = "Bauble",
tiles = {
"christmas_bauble.png"
},
drawtype = "mesh",
paramtype = "light",
paramtype2 = "color",
color = "red",
mesh = "christmas_tree_balls.obj",
groups = {not_in_creative_inventory = 1},
walkable = false,
pointable = false,
on_construct = function(pos)
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
local name = minetest.get_node(npos).name
if name ~= "christmas:tree" then
minetest.set_node(pos, {name="air"})
end
end,
})
minetest.register_node("christmas:topper", {
description = "Topper",
tiles = {
"christmas_star.png"
},
drawtype = "mesh",
paramtype = "light",
light_source = 8,
paramtype2 = "color",
color = "yellow",
mesh = "christmas_star.obj",
groups = {not_in_creative_inventory = 1},
walkable = false,
pointable = false,
on_construct = function(pos)
local npos = {x=pos.x, y=pos.y-2, z=pos.z}
local name = minetest.get_node(npos).name
if name ~= "christmas:tree" then
minetest.set_node(pos, {name="air"})
end
end,
})
christmas.register_reward("christmas:lights", {min=1, max=5}, 0.5)
christmas.register_reward("christmas:candy_cane", {min=3, max=15}, 0.15)
christmas.register_reward("christmas:eggnog", {min=1, max=3}, 0.15)
christmas.register_reward("christmas:gingerbread_man", {min=1, max=9}, 0.5)
christmas.register_reward("christmas:mince_pie", {min=6, max=12}, 0.3)
christmas.register_reward("christmas:tree", {min=0, max=1}, 0.15)
christmas.register_reward("christmas:bauble_red", {min=0, max=1}, 0.15)
christmas.register_reward("christmas:star", {min=0, max=1}, 0.1)
christmas.register_reward("christmas:sugar", {min=1, max=7}, 0.36)
christmas.register_reward("christmas:present", {min=1, max=2}, 0.26)

2
mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = christmas
description = Mod that adds festive christmas items to minetest.

View File

@ -0,0 +1,80 @@
# Blender v2.70 (sub 0) OBJ File: ''
# www.blender.org
o model
v 0.312500 0.125000 0.312500
v 0.312500 0.125000 -0.312500
v -0.312500 0.125000 -0.312500
v -0.312500 0.125000 0.312500
v 0.312500 -0.500000 -0.312500
v 0.312500 -0.500000 0.312500
v -0.312500 -0.500000 0.312500
v -0.312500 -0.500000 -0.312500
v -0.062194 0.119289 0.002570
v -0.062194 0.139334 -0.154991
v 0.062194 0.139334 -0.154991
v 0.062194 0.119289 0.002570
v -0.062194 0.240666 -0.094237
v -0.062194 0.260711 -0.251798
v 0.062194 0.260711 -0.251798
v 0.062194 0.240666 -0.094237
v 0.062194 0.119289 -0.002570
v 0.062194 0.139334 0.154991
v -0.062194 0.139334 0.154990
v -0.062194 0.119289 -0.002570
v 0.062194 0.240666 0.094238
v 0.062194 0.260711 0.251798
v -0.062194 0.260711 0.251797
v -0.062194 0.240666 0.094237
v -0.060931 0.120726 0.002517
v -0.060931 0.140363 -0.151842
v 0.060931 0.140363 -0.151842
v 0.060931 0.120726 0.002517
v -0.060931 0.239636 -0.092323
v -0.060931 0.259274 -0.246682
v 0.060931 0.259274 -0.246682
v 0.060931 0.239636 -0.092323
v 0.060931 0.120726 -0.002517
v 0.060931 0.140363 0.151842
v -0.060931 0.140363 0.151842
v -0.060931 0.120726 -0.002518
v 0.060931 0.239636 0.092323
v 0.060931 0.259274 0.246682
v -0.060931 0.259274 0.246682
v -0.060931 0.239636 0.092323
vt 0.000000 0.000000
vt 0.500000 0.000000
vt 0.500000 1.000000
vt 0.000000 1.000000
vt 1.000000 -0.000000
vt 1.000000 1.000000
vt 0.999999 -0.000001
vt 1.000001 0.999999
vt 0.500001 1.000001
vt 0.499999 0.000001
vt 0.700000 0.900000
vt 0.700000 0.600000
vt 0.800000 0.600000
vt 0.800000 0.900000
s off
f 1/1 2/2 3/3 4/4
f 5/1 6/2 7/3 8/4
f 1/3 6/2 5/5 2/6
f 7/7 4/8 3/9 8/10
f 8/7 3/8 2/9 5/10
f 6/7 1/8 4/9 7/10
f 14/11 15/12 11/13 10/14
f 16/14 13/11 9/12 12/13
f 9/14 10/11 11/12 12/13
f 16/11 15/12 14/13 13/14
f 22/11 23/12 19/13 18/14
f 24/14 21/11 17/12 20/13
f 17/14 18/11 19/12 20/13
f 24/11 23/12 22/13 21/14
f 30/11 26/12 27/13 31/14
f 32/13 28/14 25/11 29/12
f 25/14 28/11 27/12 26/13
f 32/11 29/12 30/13 31/14
f 38/11 34/12 35/13 39/14
f 40/13 36/14 33/11 37/12
f 33/14 36/11 35/12 34/13
f 40/11 37/12 38/13 39/14

36
models/christmas_star.obj Normal file
View File

@ -0,0 +1,36 @@
# Blender v2.70 (sub 0) OBJ File: 'christmas_tree.blend'
# www.blender.org
o Cube_Cube.001
v -0.139980 0.202010 -0.002398
v -0.143371 0.400000 0.195563
v -0.139979 0.597990 -0.002398
v -0.136588 0.400000 -0.200359
v 0.139979 0.202010 0.002398
v 0.136588 0.400000 0.200359
v 0.139980 0.597990 0.002398
v 0.143371 0.400000 -0.195563
v 0.000000 0.260000 0.197990
v -0.197990 0.260000 0.000000
v -0.000000 0.260000 -0.197990
v 0.197990 0.260000 -0.000000
v 0.000000 0.540000 0.197990
v -0.197990 0.540000 0.000000
v -0.000000 0.540000 -0.197990
v 0.197990 0.540000 -0.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
s off
f 5/1 6/2 2/3 1/4
f 6/1 7/2 3/3 2/4
f 7/1 8/2 4/3 3/4
f 8/1 5/2 1/3 4/4
f 1/1 2/2 3/3 4/4
f 8/1 7/2 6/3 5/4
f 13/1 14/2 10/3 9/4
f 14/1 15/2 11/3 10/4
f 15/1 16/2 12/3 11/4
f 16/1 13/2 9/3 12/4
f 9/1 10/2 11/3 12/4
f 16/1 15/2 14/3 13/4

5469
models/christmas_tree.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
# Blender v2.70 (sub 0) OBJ File: ''
# www.blender.org
o Cube.001_Cube.002
v 0.745683 -0.680000 0.585688
v 0.745683 -0.680000 0.745688
v 0.585683 -0.680000 0.745688
v 0.585683 -0.680000 0.585688
v 0.745683 -0.520000 0.585688
v 0.745683 -0.520000 0.745688
v 0.585683 -0.520000 0.745688
v 0.585683 -0.520000 0.585688
v 0.585687 -0.680000 -0.745683
v 0.745687 -0.680000 -0.745683
v 0.745687 -0.680000 -0.585683
v 0.585687 -0.680000 -0.585683
v 0.585687 -0.520000 -0.745683
v 0.745687 -0.520000 -0.745683
v 0.745687 -0.520000 -0.585683
v 0.585687 -0.520000 -0.585683
v -0.745684 -0.680000 -0.585686
v -0.745684 -0.680000 -0.745686
v -0.585684 -0.680000 -0.745686
v -0.585684 -0.680000 -0.585686
v -0.745684 -0.520000 -0.585686
v -0.745684 -0.520000 -0.745686
v -0.585684 -0.520000 -0.745686
v -0.585684 -0.520000 -0.585687
v -0.778823 -0.680000 0.665685
v -0.665686 -0.680000 0.552548
v -0.552549 -0.680000 0.665685
v -0.665686 -0.680000 0.778822
v -0.778823 -0.520000 0.665685
v -0.665686 -0.520000 0.552548
v -0.552549 -0.520000 0.665685
v -0.665686 -0.520000 0.778822
v -0.353555 0.520000 0.240414
v -0.240418 0.520000 0.353552
v -0.353556 0.520000 0.466688
v -0.466693 0.520000 0.353551
v -0.353555 0.680000 0.240414
v -0.240418 0.680000 0.353552
v -0.353556 0.680000 0.466688
v -0.466693 0.680000 0.353551
v 0.240415 0.520000 0.353555
v 0.353552 0.520000 0.240418
v 0.466689 0.520000 0.353556
v 0.353551 0.520000 0.466692
v 0.240415 0.680000 0.353555
v 0.353552 0.680000 0.240418
v 0.466689 0.680000 0.353556
v 0.353551 0.680000 0.466692
v 0.353554 0.520000 -0.240415
v 0.240418 0.520000 -0.353552
v 0.353555 0.520000 -0.466689
v 0.466692 0.520000 -0.353551
v 0.353554 0.680000 -0.240415
v 0.240418 0.680000 -0.353552
v 0.353555 0.680000 -0.466689
v 0.466692 0.680000 -0.353552
v -0.240415 0.520000 -0.353554
v -0.353553 0.520000 -0.240417
v -0.466689 0.520000 -0.353555
v -0.353552 0.520000 -0.466692
v -0.240415 0.680000 -0.353554
v -0.353553 0.680000 -0.240417
v -0.466689 0.680000 -0.353555
v -0.353552 0.680000 -0.466692
v 0.720000 -0.180000 0.080000
v 0.720000 -0.180000 -0.080000
v 0.880000 -0.180000 -0.080000
v 0.880000 -0.180000 0.080000
v 0.720000 -0.020000 0.080000
v 0.720000 -0.020000 -0.080000
v 0.880000 -0.020000 -0.080000
v 0.880000 -0.020000 0.080000
v -0.080001 -0.180000 0.880000
v -0.080001 -0.180000 0.720000
v 0.079999 -0.180000 0.720000
v 0.079999 -0.180000 0.880000
v -0.080001 -0.020000 0.880000
v -0.080001 -0.020000 0.720000
v 0.079999 -0.020000 0.720000
v 0.079999 -0.020000 0.880000
v -0.720000 -0.180000 -0.080001
v -0.720000 -0.180000 0.079999
v -0.880000 -0.180000 0.079998
v -0.880000 -0.180000 -0.080002
v -0.720000 -0.020000 -0.080001
v -0.720000 -0.020000 0.079999
v -0.880000 -0.020000 0.079998
v -0.880000 -0.020000 -0.080002
v 0.080002 -0.180000 -0.720000
v -0.079998 -0.180000 -0.720000
v -0.079998 -0.180000 -0.880000
v 0.080002 -0.180000 -0.880000
v 0.080002 -0.020000 -0.720000
v -0.079998 -0.020000 -0.720000
v -0.079998 -0.020000 -0.880000
v 0.080002 -0.020000 -0.880000
vt 0.000000 1.000000
vt -0.000000 0.000000
vt 1.000000 -0.000000
vt 1.000000 1.000000
vt 0.999999 1.000001
vt 1.000001 0.000001
vt 0.000001 -0.000001
vt -0.000001 0.999999
vt 0.999999 -0.000001
vt 1.000001 0.999999
vt 0.000001 1.000001
vt -0.000001 0.000001
s off
f 5/1 6/2 2/3 1/4
f 6/1 7/2 3/3 2/4
f 7/1 8/2 4/3 3/4
f 8/1 5/2 1/3 4/4
f 1/1 2/2 3/3 4/4
f 8/1 7/2 6/3 5/4
f 13/1 14/2 10/3 9/4
f 14/1 15/2 11/3 10/4
f 15/1 16/2 12/3 11/4
f 16/1 13/2 9/3 12/4
f 9/1 10/2 11/3 12/4
f 16/1 15/2 14/3 13/4
f 21/1 22/2 18/3 17/4
f 22/1 23/2 19/3 18/4
f 23/1 24/2 20/3 19/4
f 24/1 21/2 17/3 20/4
f 17/1 18/2 19/3 20/4
f 24/1 23/2 22/3 21/4
f 29/1 30/2 26/3 25/4
f 30/1 31/2 27/3 26/4
f 31/1 32/2 28/3 27/4
f 32/1 29/2 25/3 28/4
f 25/1 26/2 27/3 28/4
f 32/1 31/2 30/3 29/4
f 37/1 38/2 34/3 33/4
f 38/1 39/2 35/3 34/4
f 39/1 40/2 36/3 35/4
f 40/1 37/2 33/3 36/4
f 33/1 34/2 35/3 36/4
f 40/1 39/2 38/3 37/4
f 45/5 46/6 42/7 41/8
f 46/9 47/10 43/11 42/12
f 47/9 48/10 44/11 43/12
f 48/9 45/10 41/11 44/12
f 41/1 42/2 43/3 44/4
f 48/1 47/2 46/3 45/4
f 53/1 54/2 50/3 49/4
f 54/1 55/2 51/3 50/4
f 55/1 56/2 52/3 51/4
f 56/1 53/2 49/3 52/4
f 49/1 50/2 51/3 52/4
f 56/1 55/2 54/3 53/4
f 61/1 62/2 58/3 57/4
f 62/1 63/2 59/3 58/4
f 63/1 64/2 60/3 59/4
f 64/1 61/2 57/3 60/4
f 57/1 58/2 59/3 60/4
f 64/1 63/2 62/3 61/4
f 69/1 70/2 66/3 65/4
f 70/1 71/2 67/3 66/4
f 71/1 72/2 68/3 67/4
f 72/1 69/2 65/3 68/4
f 65/1 66/2 67/3 68/4
f 72/1 71/2 70/3 69/4
f 77/1 78/2 74/3 73/4
f 78/1 79/2 75/3 74/4
f 79/1 80/2 76/3 75/4
f 80/1 77/2 73/3 76/4
f 73/1 74/2 75/3 76/4
f 80/1 79/2 78/3 77/4
f 85/1 86/2 82/3 81/4
f 86/1 87/2 83/3 82/4
f 87/1 88/2 84/3 83/4
f 88/1 85/2 81/3 84/4
f 81/1 82/2 83/3 84/4
f 88/1 87/2 86/3 85/4
f 93/1 94/2 90/3 89/4
f 94/1 95/2 91/3 90/4
f 95/1 96/2 92/3 91/4
f 96/1 93/2 89/3 92/4
f 89/1 90/2 91/3 92/4
f 96/1 95/2 94/3 93/4

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
textures/christmas_star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

195
textures/init.lua~ Normal file
View File

@ -0,0 +1,195 @@
christmas = {}
christmas.players = {}
christmas.data = minetest.get_mod_storage("christmas")
local function xplayer(player)
if not player:is_player() then
return
end
local name = player:get_player_name()
return christmas.players[name]
end
function christmas.get_present_formspec(pos)--Taken from default chest
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]"
return formspec
end
local function to_time(time)
local remaining = time % 86400
remaining = remaining % 3600
local minutes = math.floor(remaining/60)
remaining = remaining % 60
local seconds = remaining
if (minutes < 10) then
minutes = "0" .. tostring(minutes)
end
if (seconds < 10) then
seconds = "0" .. tostring(seconds)
end
answer = minutes..':'..seconds
return answer
end
function christmas.eat_candy(hp_change, replace_with_item)
return function(itemstack, user, pointed_thing)
local name = user:get_player_name()
local p = xplayer(user)
christmas.players[name].candy = p.candy +1
if p.candy == 8 then
p.time = 60
p.hud.ui = user:hud_add({
hud_elem_type = "image",
position = {x = 0.1, y = 0.5},
offset = {x = -220, y = -260},
text = "christmas_powerup_ui.png",
scale = { x = 16, y = 17},
alignment = { x = 1, y = 0 },
})
p.hud.icon = user:hud_add({
hud_elem_type = "image",
position = {x = 0.1, y = 0.5},
offset = {x = -90, y = -251},
text = "christmas_candy_cane.png",
scale = { x = 16, y = 16},
alignment = { x = 1, y = 0 },
})
p.hud.time = user:hud_add({
hud_elem_type = "text",
position = {x = 0.1, y = 0.5},
offset = {x = 10, y = -10},
text = to_time (p.time),
number = 0xffffff,
scale = { x = 16, y = 16},
alignment = { x = 0, y = 0 },
})
end
if p.time > 0 then
p.time = p.time + 3
end
return minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
end
end
minetest.register_craftitem("christmas:candy_cane", {
description = "Candy Cane",
inventory_image = "christmas_candy_cane.png",
on_use = christmas.eat_candy(1)
})
minetest.register_craftitem("christmas:mince_pie", {
description = "Mince Pie",
inventory_image = "christmas_mincepie.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("christmas:gingerbread_man", {
description = "Gingerbread Man",
inventory_image = "christmas_gingerbread_man.png",
on_use = minetest.item_eat(2)
})
minetest.register_craftitem("christmas:cracker", {
description = "Christmas Cracker\n (To be shared with a friend)",
inventory_image = "christmas_cracker.png",
on_use = minetest.item_eat(2)
})
minetest.register_node("christmas:eggnog", {
description = "Eggnog",
drawtype = "plantlike",
tiles = {"christmas_eggnog.png"},
inventory_image = "christmas_eggnog.png",
on_use = minetest.item_eat(10),
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
})
minetest.register_node("christmas:present", {
description = "Christmas present",
tiles = {
"christmas_present.png",
"christmas_present_top.png"
},
drawtype = "mesh",
paramtype = "light",
mesh = "christmas_present.obj",
groups = {oddly_breakable_by_hand = 3, attached_node = 1},
on_construct = function(pos, itemstack, placer, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Christmas Present")
meta:set_string("owner", "")
local inv = meta:get_inventory()
inv:set_size("main", 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", "Present from ".. meta:get_string("owner"))
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
minetest.after(0.2,
minetest.show_formspec,
player:get_player_name(),
"christmas:present",
christmas.get_present_formspec(pos))
end,
})
minetest.register_node("christmas:stocking", {
description = "Christmas Stocking",
drawtype = "signlike",
tiles = {"christmas_stocking.png"},
inventory_image = "christmas_stocking.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
selection_box = {
type = "wallmounted",
},
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
walkable = false,
on_construct = function(pos, itemstack, player)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", player:get_player_name().."'s Stocking")
end,
})
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
christmas.players[name] = {}
christmas.players[name].candy = 0
christmas.players[name].hud = {}
christmas.players[name].time = 0
end)
local t = 0
minetest.register_globalstep (function(dtime)
t = t + dtime
if t > 1 then
t = 0
end
for _, player in ipairs(minetest.get_connected_players()) do
local p = xplayer(player)
if p.time > 0 and t > 1-dtime then
p.time = p.time - 1
player:hud_change(p.hud.time, "text", to_time(p.time))
elseif math.floor(p.time) == 1 then
p.candy = 0
end
if p.time > 0 then
player:set_physics_override({
speed = 2.5,
})
end
--minetest.chat_send_all(p.candy)
if p.time == 0 then
player:set_physics_override({
speed = 1,
})
player:hud_remove(p.hud.ui)
player:hud_remove(p.hud.icon)
player:hud_remove(p.hud.time)
end
end
end)