[Mod] Christmas [1.0] [christmas]

Post Reply
User avatar
Extex
Member
Posts: 184
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

[Mod] Christmas [1.0] [christmas]

by Extex » Post

My Third mod!

Image

Christmas themed mod

Currently adds:
  • Candy canes
  • Gingerbread man
  • Mince pie
  • Eggnog
  • Stocking (Gives rewards every 1.5 hours)
  • Tree
  • Present
  • Red Bauble
  • Christmas lights
  • Star (Tree topper)
  • Sugar (To make your favorite sweets)
+ Spoiler
License: Code (MIT), Textures (CC BY-SA 3.0)

Optional dependencies: default, farming, wool, dye.

Browse code: https://github.com/Extex101/christmas

Download: https://github.com/Extex101/christmas/a ... master.zip
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Nathan.S
Member
Posts: 993
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Christmas [1.0] [christmas]

by Nathan.S » Post

Looks promising. You're missing recipes for a handful of items though.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Extex
Member
Posts: 184
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Christmas [1.0] [christmas]

by Extex » Post

Some items aren't craftable their only obtainable as a reward in the stocking
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Nathan.S
Member
Posts: 993
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Christmas [1.0] [christmas]

by Nathan.S » Post

Does that include the sugar? because it's needed to crate a few things, but has no craft for itself.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Extex
Member
Posts: 184
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Christmas [1.0] [christmas]

by Extex » Post

Yes it's also a reward
Look at the end of init.lua
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Nathan.S
Member
Posts: 993
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Christmas [1.0] [christmas]

by Nathan.S » Post

Okay, will check that out and see about recording a video today or tomorrow. :)
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Nathan.S
Member
Posts: 993
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: [Mod] Christmas [1.0] [christmas]

by Nathan.S » Post

Okay, this time I think I found an actual bug. I can right click on the stocking as much as I want after it's filled and I keep adding the items to my inventory. Also if my active item in the hotbar is the same as what is in the stocking it won't add anything, or if the hotbar slot is empty, it will not get filled. Looking at the code it doesn't look like the inventory of the stocking is ever cleared.
This code snippet seems to fix the problem. I don't know what the leftover locals were for, and removing them and calling playerinv:add_item seemed to work just fine.

Code: Select all

		elseif not inv:is_empty("main") then --stocking has something in it.
			local item1 = inv:get_stack("main", 1)
			local item2 = inv:get_stack("main", 2)
			local item3 = inv:get_stack("main", 3)
            playerinv:add_item("main", item1)
            playerinv:add_item("main", item2)
            playerinv:add_item("main", item3)
            inv:set_stack("main", 1 ,'')
            inv:set_stack("main", 2 ,'')
            inv:set_stack("main", 3 ,'')
			timer:start(5400)
This code doesn't check if the player inventory is full, but neither did the original. If the player inventory is full the items are lost and the clock is still restarted. There is a way to check if the items will fit in inventory, and if they don't they could either be dropped in world, or you could opt to not set the inventory empty. However if a player had two empty slots they could keep right clicking on the stocking and fill those two slots to 99 items because the stocking keeps giving items.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
Extex
Member
Posts: 184
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Christmas [1.0] [christmas]

by Extex » Post

Oh...
I'll look into it
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

User avatar
Extex
Member
Posts: 184
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Christmas [1.0] [christmas]

by Extex » Post

Ok fixed.
Sorry for the long delay
Been busy...
Player of PK, RIP. Creator of the light_tool and motorbike mods. Working on another mod which should be coming soon!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests