small sussy changes

This commit is contained in:
Looki2000 2023-02-28 18:51:57 +01:00
parent 8f0806b0a4
commit 8a08384a6c
4 changed files with 51 additions and 34 deletions

View File

@ -332,43 +332,56 @@ minetest.register_node("amogus_blocks:iron_ore", {
--sounds = default.node_sound_stone_defaults(),
})
local loot = {
"amogus_items:amogus_items:dynamite",
"amogus_items:amogus",
"amogus_items:coke",
"amogus_items:fanta",
"amogus_items:tomato",
"amogus_items:sugar",
"amogus_items:water",
"amogus_items:lightsaber_blue",
"amogus_items:lightsaber_red",
"amogus_items:water",
"amogus_items:amogus",
"amogus_items:water",
"amogus_items:sugar",
"amogus_items:fanta",
"amogus_items:tomato",
"amogus_items:sprite",
"amogus_items:lightsaber_green",
"amogus_items:sugar",
"amogus_items:amogus_items:dynamite",
"amogus_items:amogus",
"amogus_items:sprite",
"amogus_items:coke",
"amogus_items:water",
"amogus_items:sugar",
"amogus_items:amogus",
"amogus_items:amogus_items:dynamite",
-- item name, probability (larger number = larger probability relative to numbers of other items)
local lucky_loot = {
{"amogus_items:dynamite" , 3.0},
{"amogus_items:amogus" , 4.0},
{"amogus_items:coke" , 2.0},
{"amogus_items:fanta" , 2.0},
{"amogus_items:tomato" , 2.0},
{"amogus_items:sugar" , 4.0},
{"amogus_items:water" , 4.0},
{"amogus_items:sprite" , 2.0},
{"amogus_items:lightsaber_blue" , 1.0},
{"amogus_items:lightsaber_red" , 1.0},
{"amogus_items:lightsaber_green" , 1.0},
}
-- sum of all numbers in second column
local lucky_loot_propability_sum = 0
local last_lucky_loot_propability_sum = 0
for _, item in ipairs(lucky_loot) do
last_lucky_loot_propability_sum = lucky_loot_propability_sum
lucky_loot_propability_sum = lucky_loot_propability_sum + item[2]
item[2] = last_lucky_loot_propability_sum
-- create new column element
item[3] = lucky_loot_propability_sum
end
minetest.register_node("amogus_blocks:lucky_block", {
description = "Lucky Block",
tiles = {"luckyblock.png"},
groups = {cracky = 3},
on_punch = function(pos, node, puncher, pointed_thing)
local item = loot[math.random(#loot)]
minetest.add_item(pos, item)
local random_number = math.random() * lucky_loot_propability_sum
for _, item in ipairs(lucky_loot) do
-- if random_number is in range of current item (inclusive start, exclusive end)
if random_number >= item[2] and random_number < item[3] then
minetest.add_item(pos, item[1])
break
end
end
--local item = lucky_loot[math.random(#lucky_loot)]
--minetest.add_item(pos, item)
minetest.add_particlespawner({
amount = 100,
time = 0.1,

View File

@ -542,7 +542,7 @@ minetest.register_abm({
-- only spawn on solid blocks AND in the dark
if minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name].walkable and minetest.get_node_light(pos) < 10 then
-- do not spawn if there is already an sussy imposter nearby
local nearby_entities = minetest.get_objects_inside_radius(pos, 20)
local nearby_entities = minetest.get_objects_inside_radius(pos, 30)
local imposter_nearby = false
for _, entity in pairs(nearby_entities) do

View File

@ -106,8 +106,10 @@ minetest.register_craftitem("amogus_items:tomato", {
inventory_image = "tomato.png",
on_use = minetest.item_eat(2),
})
minetest.register_craftitem("amogus_items:water", {
inventory_image = "water.png",
description = "Water",
inventory_image = "water_bottle.png",
on_use = minetest.item_eat(8),
})
@ -122,7 +124,7 @@ minetest.register_tool("amogus_items:lightsaber_blue", {
},
damage_groups = {fleshy=1.01},
},
sound = {breaks = "amogus_sound"},
--sound = {breaks = "amogus_sound"},
})
minetest.register_tool("amogus_items:lightsaber_red", {
@ -137,7 +139,7 @@ minetest.register_tool("amogus_items:lightsaber_red", {
damage_groups = {fleshy=1.01},
},
sound = {breaks = "amogus_sound"},
--sound = {breaks = "amogus_sound"},
})
minetest.register_tool("amogus_items:lightsaber_green", {
@ -151,8 +153,9 @@ minetest.register_tool("amogus_items:lightsaber_green", {
},
damage_groups = {fleshy=1.01},
},
sound = {breaks = "amogus_sound"},
--sound = {breaks = "amogus_sound"},
})
minetest.register_craftitem("amogus_items:gold_ingot", {
description = "Gold Ingot",
inventory_image = "gold_ingot.png",
@ -164,6 +167,7 @@ minetest.register_craftitem("amogus_items:sussium_ingot", {
description = "Sussium Ingot",
inventory_image = "sussium_ingot.png",
})
--add theese items goldenpickaxe, stonepickaxe and allow them slowly break nodes and destroy it after 30 uses
minetest.register_tool("amogus_items:goldenplumba", {
description = "Golden Plumba",

View File

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 284 B