Modify the candy amount probability.
This makes the distribution a bit more interesting, but also less generous.
This commit is contained in:
parent
c491bd9918
commit
19ea9c8bb2
5
init.lua
5
init.lua
@ -51,6 +51,8 @@ local candy = {
|
||||
'mtcandy:emenems'
|
||||
}
|
||||
|
||||
local distribution = {1, 1, 1, 2, 2, 3}
|
||||
|
||||
minetest.register_craftitem('trick_or_treat:candy_bucket', {
|
||||
description = 'Candy Bucket',
|
||||
stack_max = 1,
|
||||
@ -88,7 +90,8 @@ minetest.register_node('trick_or_treat:treat_box', {
|
||||
|
||||
-- It's almost Halloween so give them candy.
|
||||
local item = candy[math.random(1,#candy)]
|
||||
local amount = math.random(1, 5)
|
||||
local amount = distribution[math.random(1, #distribution)]
|
||||
|
||||
local inv = puncher:get_inventory()
|
||||
if inv:room_for_item('main', item..' '..amount) then
|
||||
puncher:get_inventory():add_item('main', item..' '..amount)
|
||||
|
Loading…
x
Reference in New Issue
Block a user