[Mod] bring the joy of xmas to minetest. [christmas_craft]

User avatar
balthazariv
Member
Posts: 214
Joined: Mon Apr 07, 2014 15:48
Contact:

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by balthazariv » Post

Hello,
CheerfulCherub wrote:06:47:16: ERROR[main]: Failed to load and run script from
06:47:16: ERROR[main]: C:\Users\\Documents\minetest-0.4.10\bin\..\mods\christmas_craft\init.lua:
06:47:16: ERROR[main]: cannot open C:\Users\Maleta\Documents\minetest-0.4.10\bin\..\mods\christmas_craft\init.lua: No such file or directory
06:47:16: ERROR[main]: ======= END OF ERROR FROM LUA ========
06:47:16: ERROR[main]: Server: Failed to load and run C:\Users\\Documents\minetest-0.4.10\bin\..\mods\christmas_craft\init.lua
06:47:16: ERROR[main]: ModError: ModError: Failed to load and run C:\Users\Documents\minetest-0.4.10\bin\..\mods\christmas_craft\init.lua
06:47:25: INFO: event_handler(): Ctrl+C, Close Event, Logoff Event or Shutdown Event, shutting down
Ok, this mod is in my mod folder rename it christmas_craft, and got this error.
When you extract the repertory, you find "christmas_craft_0.2" and inside the repertory "christmas_craft"
Just take the last.

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by Topywo » Post

Wuzzy wrote:Nice simple mod. Finally some usage for gold ingots. :-)

A tiny suggestion: The christmas star nodedef should have sunglight_propagates = true. Otherwise, the star appears so dark.
Did it for the lights and star (I think it still looks dark, especially compared with the star in the hand).

and @CheerfulCherub, try this download:
https://dl.dropboxusercontent.com/u/654 ... _craft.zip

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by bell07 » Post

To the present boxes I ported the support for Treasurer (viewtopic.php?id=7292) from tsm_surprise (viewtopic.php?f=9&t=9452) block.
Instead of just picking-up, the gift is dropped. A nice effect, currently only in treasurer implementation, but can be ported to the non treasurer logic too.
Maybe some treasurer-parameters can be adjusted to taste.


I do not have an account on bitbucket.org for pull request,therefor as patch:

Code: Select all

diff --git a/init.lua b/init.lua
index 2fbeaea..309adf4 100644
--- a/init.lua
+++ b/init.lua
@@ -37,6 +37,102 @@ if config:get("enable_crafts") == "true"  then
 	dofile(MODPATH .."/crafts.lua")--if snow enabled, execute this file
 end
 
+-- presents
+local open_present_hardcoded = function(max)
+	local drop
+        if not minetest.get_modpath("treasurer") then
+-- try to port the old logic
+		if max == 1 then
+			drop = {
+				max_items = 1, min_items = 1, items = {
+				{items = {'default:bookshelf'},	rarity = 90,},
+				{items = {'default:pick_mese'},	rarity = 80,},
+				{items = {'default:shovel_steel'},	rarity = 90,},
+				{items = {'default:axe_steel'},	rarity = 90,},
+				{items = {'default:pick_steel'},	rarity = 90,},
+				{items = {'default:sign_wall'},	rarity = 80,},
+				{items = {'default:chest'},	rarity = 80,},
+				{items = {'default:furnace'},	rarity = 80,},
+				{items = {'default:steelblock'},	rarity = 80,},
+				{items = {'default:coal_lump'},	rarity = 80,},
+				{items = {'default:pick_diamond'},	rarity = 75,},
+				{items = {'default:shovel_diamond'},	rarity = 75,},
+				{items = {'default:axe_diamond'},	rarity = 75,},
+				{items = {'default:diamondblock'},	rarity = 75},
+				{items = {'fake_fire:flint_and_steel'},	rarity = 90,},
+				{items = {'default:chest_locked'},	rarity = 80,},
+				{items = {'default:brick'},	rarity = 80,},
+				{items = {'default:dirt_with_grass'}, rarity = 80,},
+			}}
+		else
+			drop = {
+				max_items = max, items = {
+				{items = {'default:bookshelf'},	rarity = 15,},
+				{items = {'default:pick_mese'},	rarity = 20,},
+				{items = {'default:shovel_steel'},	rarity = 15,},
+				{items = {'default:axe_steel'},	rarity = 15,},
+				{items = {'default:pick_steel'},	rarity = 15,},
+				{items = {'default:sign_wall'},	rarity = 20,},
+				{items = {'default:chest'},	rarity = 20,},
+				{items = {'default:furnace'},	rarity = 20,},
+				{items = {'default:steelblock'},	rarity = 25,},
+				{items = {'default:coal_lump'},	rarity = 25,},
+				{items = {'diamonds:pick'},	rarity = 30,},
+				{items = {'diamonds:shovel'},	rarity = 30,},
+				{items = {'diamonds:axe'},	rarity = 30,},
+				{items = {'diamonds:block'},	rarity = 30,},
+				{items = {'fake_fire:flint_and_steel'},	rarity = 15,},
+				{items = {'default:chest_locked'},	rarity = 20,},
+				{items = {'default:brick'},	rarity = 25,},
+				{items = {'default:dirt_with_grass'},	rarity = 30,},
+			}}
+		end
+	end
+	return drop
+end
+
+local open_present_treasurer = function(max)
+	if minetest.get_modpath("treasurer") then
+	--- functionality ported from surprise_block
+		after_destruct = function (pos, oldnode)
+			local drops = treasurer.select_random_treasures(max)
+			for _,item in ipairs(drops) do
+				local count, name
+				if type(item) == "string" then
+					name, count = item:match("^([a-zA-Z0-9_:]*) ([0-9]*)$")
+					if not name then
+						name = item
+					end
+					if not count then
+						count = 1
+					end
+				else
+					count = item:get_count()
+					name = item:get_name()
+				end
+				if not inv or not inv:contains_item("main", ItemStack(name)) then
+					for i=1,count do
+						local obj = minetest.env:add_item(pos, name)
+						if obj ~= nil then
+							obj:get_luaentity().collect = true
+							local x = math.random(1, 5)
+							if math.random(1,2) == 1 then
+							x = -x
+							end
+							local z = math.random(1, 5)
+							if math.random(1,2) == 1 then
+								z = -z
+							end
+							obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
+						end
+					end
+				end
+			end
+		end
+
+	end
+	return after_destruct
+end
 
 -- blocks --
 
@@ -336,31 +432,6 @@ minetest.register_node("christmas_craft:silver_baubles", {
 ------------
 --nodes--
 	
-	-- presents --
-	
-	--store the drop in a variable
-	local presents_drop = {
-			max_items = 2, items = {
-				{items = {'default:bookshelf'},	rarity = 15,},
-				{items = {'default:pick_mese'},	rarity = 20,},
-				{items = {'default:shovel_steel'},	rarity = 15,},
-				{items = {'default:axe_steel'},	rarity = 15,},
-				{items = {'default:pick_steel'},	rarity = 15,},
-				{items = {'default:sign_wall'},	rarity = 20,},
-				{items = {'default:chest'},	rarity = 20,},
-				{items = {'default:furnace'},	rarity = 20,},
-				{items = {'default:steelblock'},	rarity = 25,},
-				{items = {'default:coal_lump'},	rarity = 25,},
-				{items = {'diamonds:pick'},	rarity = 30,},
-				{items = {'diamonds:shovel'},	rarity = 30,},
-				{items = {'diamonds:axe'},	rarity = 30,},
-				{items = {'diamonds:block'},	rarity = 30,},
-				{items = {'fake_fire:flint_and_steel'},	rarity = 15,},
-				{items = {'default:chest_locked'},	rarity = 20,},
-				{items = {'default:brick'},	rarity = 25,},
-				{items = {'default:dirt_with_grass'},	rarity = 30,},	
-			}}
-	
 	minetest.register_node("christmas_craft:present_box", {
 		description = "Present Box",
 		tiles = {"christmas_craft_present_box.png"},
@@ -375,27 +446,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_wh.png^christmas_craft_bow_top.png", "christmas_craft_present_wh.png^christmas_craft_bow_bottom.png", "christmas_craft_present_wh.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = {
-			max_items = 1, min_items = 1, items = {
-				{items = {'default:bookshelf'},	rarity = 90,},
-				{items = {'default:pick_mese'},	rarity = 80,},
-				{items = {'default:shovel_steel'},	rarity = 90,},
-				{items = {'default:axe_steel'},	rarity = 90,},
-				{items = {'default:pick_steel'},	rarity = 90,},
-				{items = {'default:sign_wall'},	rarity = 80,},
-				{items = {'default:chest'},	rarity = 80,},
-				{items = {'default:furnace'},	rarity = 80,},
-				{items = {'default:steelblock'},	rarity = 80,},
-				{items = {'default:coal_lump'},	rarity = 80,},
-				{items = {'default:pick_diamond'},	rarity = 75,},
-				{items = {'default:shovel_diamond'},	rarity = 75,},
-				{items = {'default:axe_diamond'},	rarity = 75,},
-				{items = {'default:diamondblock'},	rarity = 75},
-				{items = {'fake_fire:flint_and_steel'},	rarity = 90,},
-				{items = {'default:chest_locked'},	rarity = 80,},
-				{items = {'default:brick'},	rarity = 80,},
-				{items = {'default:dirt_with_grass'}, rarity = 80,},	
-			}},
+		drop = open_present_hardcoded(1), --old way
+		after_destruct = open_present_treasurer(1), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -406,7 +458,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_gr.png^christmas_craft_bow_top.png", "christmas_craft_present_gr.png^christmas_craft_bow_bottom.png", "christmas_craft_present_gr.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -417,7 +470,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -428,7 +482,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_bl.png^christmas_craft_bow_top.png", "christmas_craft_present_bl.png^christmas_craft_bow_bottom.png", "christmas_craft_present_bl.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -439,7 +494,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_ye.png^christmas_craft_bow_top.png", "christmas_craft_present_ye.png^christmas_craft_bow_bottom.png", "christmas_craft_present_ye.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -450,7 +506,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_re.png^christmas_craft_bow_top.png", "christmas_craft_present_re.png^christmas_craft_bow_bottom.png", "christmas_craft_present_re.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -461,7 +518,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_vi.png^christmas_craft_bow_top.png", "christmas_craft_present_vi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_vi.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -472,7 +530,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_or.png^christmas_craft_bow_top.png", "christmas_craft_present_or.png^christmas_craft_bow_bottom.png", "christmas_craft_present_or.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),
@@ -483,7 +542,8 @@ minetest.register_node("christmas_craft:silver_baubles", {
 		tiles = {"christmas_craft_present_pi.png^christmas_craft_bow_top.png", "christmas_craft_present_pi.png^christmas_craft_bow_bottom.png", "christmas_craft_present_pi.png^christmas_craft_bow_side.png"},
 		is_ground_content = true,
 		groups = {crumbly=3},
-		drop = presents_drop,	
+		drop = open_present_hardcoded(2), --old way
+		after_destruct = open_present_treasurer(2), --using treasurer
 		sounds = default.node_sound_dirt_defaults({
 			footstep = {name="default_grass_footstep", gain=0.4},
 		}),

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by bell07 » Post

Christmas comes closer and I work on some update for this mod.
Currently you can throw the snowballs in this mod but without an effect, the ball fly trough other players or mobs.
I implemented already the hit, to players without effect, to mobs with reducement of hp and write a tag on mobs (like in mobs_redo), but it is not really nice. I am not artistic enough for this. Can anyone provide me a nice effect if a snow ball hit a player or mob? If possible as some lua-code lines?

User avatar
AccidentallyRhine
Member
Posts: 252
Joined: Sun Aug 02, 2015 05:43

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by AccidentallyRhine » Post

This might be a dumb question but are the gift boxes functional or just decoration?
xWzyMP8HoXkGdqgxyKQ0yJXnXZzhYtln

User avatar
Semmett9
Member
Posts: 157
Joined: Sun Oct 07, 2012 13:48
Location: Gallifrey
Contact:

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by Semmett9 » Post

AnxiousInfusion wrote:This might be a dumb question but are the gift boxes functional or just decoration?
When you remove the present node you will get a random item. starting from a node (such as grass block) to tools (iron pick).

User avatar
Semmett9
Member
Posts: 157
Joined: Sun Oct 07, 2012 13:48
Location: Gallifrey
Contact:

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by Semmett9 » Post

NEW UPDATE V0.1

I have decided to update and improve some of my older mods. So I have updated this mod so that it has better support over the new version of minetest.

They should be no problem with upgradeing to the newest version of the mod,

this update adds the following things


More coloured presents
More coloured barbels
Clear barbels
Candy Cain
Candy Cain Block
Candy Cain Pole
Christmas Pudding
Non wall mount lights
Ginger bread man as
Snow slap (can be placed on top of slabs)
Snow steps (can be placed on top of steps)
Snow corners (can be placed on corner steps)

Update log

Better support for MT 0.4.14
Removed most textures and replaced with colourise system
Cleaned up code and added functions
Improved node box so it can suport an X16 texture
Bug fixes
Removed snowballs ( planning to add them back when I fix the system)

hope you all enjoy the update

Chibi ghost
Member
Posts: 845
Joined: Fri Jan 08, 2016 21:17
In-game: Ghost

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by Chibi ghost » Post

I love most of the pack but those christmas trees look ugly can you make them a optional extra so I can opt out
other than that I am so happy that it now works but because of those trees I won't be using it

or someone can tell me how to remove the tree code from the zip file without affecting the rest of the code I would be so thankfull

User avatar
Andrey01
Member
Posts: 2577
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] bring the joy of xmas to minetest. [christmas_craf

by Andrey01 » Post

Chibi ghost wrote:I love most of the pack but those christmas trees look ugly can you make them a optional extra so I can opt out
other than that I am so happy that it now works but because of those trees I won't be using it

or someone can tell me how to remove the tree code from the zip file without affecting the rest of the code I would be so thankfull
The christmas trees are beautiful

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests