This commit is contained in:
Kacper Kostka 2023-02-05 12:19:14 +01:00
commit e32fed7ebc
7 changed files with 288 additions and 79 deletions

View File

@ -26,7 +26,7 @@ minetest.register_node("amogus_blocks:tv", {
},
paramtype2 = "facedir",
drop = { -- amogus_items:capacitor amogus_items:pcb
-- drop two items
-- drop two items
max_items = 2,
items = {
{items = {'amogus_items:capacitor'}, rarity = 1},
@ -199,72 +199,6 @@ minetest.register_node("amogus_blocks:wood", {
})
-- OLD water. not flowing. throwing massive amounts of errors.
--minetest.register_node("amogus_blocks:water", {
-- description = "Water",
-- drawtype = "liquid",
-- tiles = {
-- {
-- name = "water.png",
-- --animation = {
-- -- type = "vertical_frames",
-- -- aspect_w = 16,
-- -- aspect_h = 16,
-- -- length = 2.0,
-- --},
-- },
-- --{
-- -- name = "water.png",
-- -- animation = {
-- -- type = "vertical_frames",
-- -- aspect_w = 16,
-- -- aspect_h = 16,
-- -- length = 2.0,
-- -- },
-- --},
-- },
-- --special_tiles = {
-- -- -- New-style water source material (mostly unused)
-- -- {
-- -- name = "water.png",
-- -- backface_culling = false,
-- -- animation = {
-- -- type = "vertical_frames",
-- -- aspect_w = 16,
-- -- aspect_h = 16,
-- -- length = 2.0,
-- -- },
-- -- },
-- -- -- New-style flowing water material (mostly unused)
-- -- {
-- -- name = "water.png",
-- -- backface_culling = true,
-- -- animation = {
-- -- type = "vertical_frames",
-- -- aspect_w = 16,
-- -- aspect_h = 16,
-- -- length = 0.8,
-- -- },
-- -- },
-- --},
-- alpha = 160,
-- paramtype = "light",
-- walkable = false,
-- pointable = false,
-- diggable = false,
-- --buildable_to = true,
-- drowning = 1,
-- liquidtype = "source",
-- --liquid_alternative_flowing = "amogus_blocks:water_flowing",
-- --liquid_alternative_source = "amogus_blocks:water_source",
-- liquid_viscosity = 1,
-- post_effect_color = {a = 103, r = 30, g = 60, b = 90},
-- groups = {water = 3, liquid = 3, puts_out_fire = 1},
--})
minetest.register_node("amogus_blocks:water_source", {
description = "Water Source",
drawtype = "liquid",
@ -295,7 +229,7 @@ minetest.register_node("amogus_blocks:water_source", {
liquid_alternative_source = "amogus_blocks:water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
groups = {water = 3, liquid = 3, cools_lava = 1}
groups = {water = 3, liquid = 3, cools_lava = 1, not_in_creative_inventory = 1},
})
minetest.register_node("amogus_blocks:water_flowing", {

View File

@ -3,10 +3,10 @@ minetest.register_on_joinplayer(function(player)
--player:set_sky({r=0, g=0, b=0}, "plain", {})
-- play music in loop without position
-- minetest.sound_play("amogus_incomming", {
-- to_player = player:get_player_name(),
-- loop = true,
--gain = 1
--minetest.sound_play("amogus_incomming", {
-- to_player = player:get_player_name(),
-- loop = true,
-- gain = 1
--})
end)

View File

@ -69,7 +69,9 @@ minetest.register_ore({
clust_size = 1,
y_max = 31000,
y_min = -31000,
})minetest.register_ore({
})
minetest.register_ore({
ore_type = "scatter",
ore = "amogus_blocks:gold_ore",
wherein = "amogus_blocks:stone",
@ -78,7 +80,9 @@ minetest.register_ore({
clust_size = 1,
y_max = 31000,
y_min = -31000,
})minetest.register_ore({
})
minetest.register_ore({
ore_type = "scatter",
ore = "amogus_blocks:obsusian",
wherein = "amogus_blocks:stone",
@ -87,7 +91,9 @@ minetest.register_ore({
clust_size = 1,
y_max = 31000,
y_min = -31000,
})minetest.register_ore({
})
minetest.register_ore({
ore_type = "scatter",
ore = "amogus_blocks:iron_ore",
wherein = "amogus_blocks:stone",
@ -531,6 +537,8 @@ minetest.register_decoration({
schematic = "/schematics/STATUE_GIANT.mts",
})
-- wtf is this??
--minetest.register_on_generated(function(minp, maxp, seed)
-- for x = minp.x, maxp.x do
-- for y = minp.y, maxp.y do

View File

@ -427,3 +427,254 @@ minetest.register_entity("amogus_items:dynamite_entity", {
self.object:remove()
end
})
-- below is modified code from bucket mod from minetest_game. (Minetest 0.4 mod: bucket)
-- original is licensed under:
-- GNU Lesser General Public License, version 2.1
-- Copyright (C) 2011-2016 Kahrl <kahrl@gmx.net>
-- Copyright (C) 2011-2016 celeron55, Perttu Ahola <celeron55@gmail.com>
-- Copyright (C) 2011-2016 Various Minetest developers and contributors
minetest.register_alias("empty_bucket", "amogus_items:empty_bucket")
minetest.register_alias("water_bucket", "amogus_items:water_bucket")
minetest.register_craft({
output = "bucket:empty_bucket 1",
recipe = {
{"amogus_items:iron_ingot", "", "amogus_items:iron_ingot"},
{"", "amogus_items:iron_ingot", ""},
}
})
bucket = {}
bucket.liquids = {}
local function check_protection(pos, name, text)
if minetest.is_protected(pos, name) then
minetest.log("action", (name ~= "" and name or "A mod")
.. " tried to " .. text
.. " at protected position "
.. minetest.pos_to_string(pos)
.. " with a bucket")
minetest.record_protection_violation(pos, name)
return true
end
return false
end
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- name = text description of the bucket item
-- groups = (optional) groups of the bucket item, for example {water_bucket = 1}
-- force_renew = (optional) bool. Force the liquid source to renew if it has a
-- source neighbour, even if defined as 'liquid_renewable = false'.
-- Needed to avoid creating holes in sloping rivers.
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
groups, force_renew)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
force_renew = force_renew,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
groups = groups,
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
local node = minetest.get_node_or_nil(pointed_thing.under)
local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it
if ndef and ndef.on_rightclick and
not (user and user:is_player() and
user:get_player_control().sneak) then
return ndef.on_rightclick(
pointed_thing.under,
node, user,
itemstack)
end
local lpos
-- Check if pointing to a buildable node
if ndef and ndef.buildable_to then
-- buildable; replace the node
lpos = pointed_thing.under
else
-- not buildable to; place the liquid above
-- check if the node above can be replaced
lpos = pointed_thing.above
node = minetest.get_node_or_nil(lpos)
local above_ndef = node and minetest.registered_nodes[node.name]
if not above_ndef or not above_ndef.buildable_to then
-- do not remove the bucket with the liquid
return itemstack
end
end
if check_protection(lpos, user
and user:get_player_name()
or "", "place "..source) then
return
end
minetest.set_node(lpos, {name = source})
return ItemStack("amogus_items:empty_bucket")
end
})
end
end
-- random prefixes for names
local bucket_names_prefixes = {
"Sussy",
"Sussy wussy",
"Sus",
"Imposterous",
"This is",
"I wonder what is the",
"You probably need",
"Big",
"Cursed",
"I want that",
"Very funny",
"Suspicious",
"SuspicioususUSSuS",
"SuspiciousususSuSuSsSSuS",
"AAAAA!! IT'S AGAIN THAT",
"Fantastick",
"I don't know what is that",
"This is propably the longest item name you will ever see and btw this item is called",
"I like",
"Whatever that is, I've got my own",
"A",
"Wonderful",
"Respectful",
"Amogus shaped",
"Impostor shaped",
"Imposter shaped",
"Sussy shaped"
}
-- random name
local empty_bucket_names = {
"Bmpty Eucket",
"Bupty Emcket",
"Emptt Buckey",
"Emckty Bupet"
}
minetest.register_craftitem("amogus_items:empty_bucket", {
-- random name
--description = (empty_bucket_names[math.random(1, #empty_bucket_names)]),
description = (bucket_names_prefixes[math.random(1, #bucket_names_prefixes)] .. " " .. empty_bucket_names[math.random(1, #empty_bucket_names)]),
inventory_image = "empty_bucket.png",
groups = {tool = 1},
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then
pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil)
return user:get_wielded_item()
elseif pointed_thing.type ~= "node" then
-- do nothing if it's neither object nor node
return
end
-- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under)
local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count()
if liquiddef ~= nil
and liquiddef.itemname ~= nil
and node.name == liquiddef.source then
if check_protection(pointed_thing.under,
user:get_player_name(),
"take ".. node.name) then
return
end
-- default set to return filled bucket
local giving_back = liquiddef.itemname
-- check if holding more than 1 empty bucket
if item_count > 1 then
-- if space in inventory add filled bucked, otherwise drop as item
local inv = user:get_inventory()
if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname)
else
local pos = user:get_pos()
pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, liquiddef.itemname)
end
-- set to return empty buckets minus 1
giving_back = "amogus_items:empty_bucket "..tostring(item_count-1)
end
-- force_renew requires a source neighbour
local source_neighbor = false
if liquiddef.force_renew then
source_neighbor =
minetest.find_node_near(pointed_thing.under, 1, liquiddef.source)
end
if not (source_neighbor and liquiddef.force_renew) then
minetest.add_node(pointed_thing.under, {name = "air"})
end
return ItemStack(giving_back)
else
-- non-liquid nodes will have their on_punch triggered
local node_def = minetest.registered_nodes[node.name]
if node_def then
node_def.on_punch(pointed_thing.under, node, user, pointed_thing)
end
return user:get_wielded_item()
end
end,
})
-- random name
local water_bucket_names = {
"Bater Wucket",
"Buter Wacket",
"Watet Bucker",
"Wacker Butet"
}
bucket.register_liquid(
"amogus_blocks:water_source",
"amogus_blocks:water_flowing",
"amogus_items:water_bucket",
"water_bucket.png",
-- random name
(bucket_names_prefixes[math.random(1, #bucket_names_prefixes)] .. " " .. water_bucket_names[math.random(1, #water_bucket_names)]),
{tool = 1, water_bucket = 1}
)
-- end of modifed code from bucket mod from minetest_game

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

View File

@ -135,19 +135,35 @@ local function get_inv_slots(data, fs)
local spacing = legacy_inventory and 0.25 or 0.1
local size = 1
-- for hotbar on the bottom
local inv_hitbar_y = inv_y + (legacy_inventory and 3.75 or 3.45 - spacing)
fs"style_type[box;colors=#77777710,#77777710,#777,#777]"
for i = 0, hotbar_len - 1 do
box(i * size + inv_x + (i * spacing), inv_y, size, size, "")
--box(i * size + inv_x + (i * spacing), inv_y, size, size, "")
-- for hotbar on the bottom
box(i * size + inv_x + (i * spacing), inv_hitbar_y, size, size, "")
end
fs("style_type[list;size=%f;spacing=%f]", size, spacing)
fs("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len)
-- inventory grid
--fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15), hotbar_len, data.inv_size / hotbar_len, hotbar_len)
-- inventory grid on the top
fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y, hotbar_len, data.inv_size / hotbar_len, hotbar_len)
fs("style_type[list;size=%f;spacing=%f,%f]", size, spacing, legacy_inventory and 0.15 or spacing)
fs("list[current_player;main;%f,%f;%u,%u;%u]", inv_x, inv_y + (legacy_inventory and 1.25 or 1.15),
hotbar_len, data.inv_size / hotbar_len, hotbar_len)
-- hotbar
--fs("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_y, hotbar_len)
-- hotbar on the bottom of the inventory grid
fs("list[current_player;main;%f,%f;%u,1;]", inv_x, inv_hitbar_y, hotbar_len)
fs"style_type[list;size=1;spacing=0.15]"
fs"listring[current_player;craft]listring[current_player;main]"