Initial Commit

master
A.C.M 2020-03-06 16:17:16 +01:00
parent 6583c3a89a
commit 4eda50552a
16 changed files with 308 additions and 1 deletions

View File

@ -1,2 +1,26 @@
# userfull_gadgets
A mod for Minetest
Use(r)full Gadgets is a mod for Minetest, with some usefull tools.
## Vacuum Cleaner
Is taken from the Vacuum Cleaner of technic, but has no dependencies to technic.
## Magnifier Glass
Is a tool to get a list of Informations from the pointed Node.
Like propagates the Node light, how much light is shining ON and UNDER the node?
## Install
Move your Download to the Mods-Folder.
## Depends
default<br>
wool<br>
## License
License: GPL 3.0
Core code for Vacuumcleaner taken from the mod technic.
Sound and Image for Vacuumcleaner taken from the mod technic too.

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
wool

119
functions.lua Normal file
View File

@ -0,0 +1,119 @@
local S = userfull_gadgets.S
-- Shows Information about an Item you point on it
function userfull_gadgets.show_node(name, pos)
if pos then
local node = minetest.get_node(pos)
local light = minetest.get_node_light(pos)
local dlight = minetest.get_node_light({x=pos.x, y=pos.y -1, z=pos.z})
local ulight = minetest.get_node_light({x=pos.x, y=pos.y +1, z=pos.z})
local nodepos = minetest.pos_to_string(pos)
local protected = minetest.is_protected(pos, name)
userfull_gadgets.print(name, S("Name of the Node: "), userfull_gadgets.purple)
userfull_gadgets.print(name, node.name, userfull_gadgets.green)
userfull_gadgets.print(name, S("Located at: ") .. nodepos, userfull_gadgets.green)
userfull_gadgets.print(name, S("Light on the Node: ") .. light .. ".", userfull_gadgets.yellow)
userfull_gadgets.print(name, S("Light above: ") .. ulight .. ".", userfull_gadgets.yellow)
userfull_gadgets.print(name, S("Light under: ") .. dlight .. ".", userfull_gadgets.yellow)
if(protected) then
userfull_gadgets.print(name, S("Is protected? Yes."), userfull_gadgets.white)
else
userfull_gadgets.print(name, S("Is protected: No."), userfull_gadgets.white)
end
if(minetest.registered_nodes[node.name] ~= nil) then
if(minetest.registered_nodes[node.name].diggable) then
userfull_gadgets.print(name, S("Is diggable."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].walkable) then
userfull_gadgets.print(name, S("Is walkable."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].climbable) then
userfull_gadgets.print(name, S("Is climbable."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].buildable_to) then
userfull_gadgets.print(name, S("Is replaceable."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].liquid_renewable) then
userfull_gadgets.print(name, S("Is regenerateable."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].use_texture_alpha) then
userfull_gadgets.print(name, S("Has an alpha-channel."), userfull_gadgets.orange)
userfull_gadgets.print(name, S("With a transparency of ") .. 255 - minetest.registered_nodes[node.name].alpha .. " / 255.", userfull_gadgets.light_blue)
end
if(minetest.registered_nodes[node.name].sunlight_propagates) then
userfull_gadgets.print(name, S("Light shines trough."), userfull_gadgets.orange)
end
if(minetest.registered_nodes[node.name].light_source > 0) then
userfull_gadgets.print(name, S("Shines with Lightlevel ") .. minetest.registered_nodes[node.name].light_source .. " / 15.", userfull_gadgets.light_blue)
end
if(minetest.registered_nodes[node.name].damage_per_second > 0) then
userfull_gadgets.print(name, S("Deals with ") .. minetest.registered_nodes[node.name].damage_per_second .. S(" Points Damage per Second."), userfull_gadgets.light_green)
end
userfull_gadgets.print(name, S("Stacks with ") .. minetest.registered_nodes[node.name].stack_max .. S(" Items / Stack."), userfull_gadgets.light_red)
else
userfull_gadgets.print(name, S("Node unknown!"), userfull_gadgets.red)
end
else
userfull_gadgets.print(name, S("Pointed on no Node."), userfull_gadgets.red)
end
end -- userfull_gadgets.show_me()
-- Writes a Message in a specific color or Logs it
function userfull_gadgets.print(name, message, color)
if(color ~= userfull_gadgets.none) then
minetest.chat_send_player(name, core.colorize(color, message))
return
else
minetest.chat_send_player(name, message)
return
end
end -- userfull_gadgets.print_message()
-- Code taken form technic
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
function userfull_gadgets.vacuumize(itemstack, user, pointed_thing)
local pos = user:getpos()
local inv = user:get_inventory()
local vacuum_range = userfull_gadgets.settings.vacuum_range
for _, object in ipairs(minetest.get_objects_inside_radius(pos, vacuum_range)) do
local luaentity = object:get_luaentity()
if not object:is_player() and luaentity and luaentity.name == "__builtin:item" and luaentity.itemstring ~= "" then
if inv and inv:room_for_item("main", ItemStack(luaentity.itemstring)) then
inv:add_item("main", ItemStack(luaentity.itemstring))
minetest.sound_play("userfull_gadgets_vacuumcleaner", {
to_player = user:get_player_name(),
})
luaentity.itemstring = ""
object:remove()
end -- if inv and
end -- if not object:is_player
end -- for _, object
end -- function userfull_gadgets.vacuumize

38
init.lua Normal file
View File

@ -0,0 +1,38 @@
userfull_gadgets = {}
userfull_gadgets.S = nil
userfull_gadgets.settings = {}
userfull_gadgets.vers = "1.0"
userfull_gadgets.modname = minetest.get_current_modname()
userfull_gadgets.modpath = minetest.get_modpath(userfull_gadgets.modname)
-- get Boilerplate
if (minetest.get_translator ~= nil) then
userfull_gadgets.S = minetest.get_translator(minetest.get_current_modname())
else
userfull_gadgets.S = function ( s ) return s end
end
userfull_gadgets.green = '#00FF00'
userfull_gadgets.red = '#FF0000'
userfull_gadgets.orange = '#FF6700'
userfull_gadgets.blue = '#0000FF'
userfull_gadgets.yellow = '#FFFF00'
userfull_gadgets.purple = '#FF00FF'
userfull_gadgets.pink = '#FFAAFF'
userfull_gadgets.white = '#FFFFFF'
userfull_gadgets.black = '#000000'
userfull_gadgets.grey = '#888888'
userfull_gadgets.light_blue = '#8888FF'
userfull_gadgets.light_green = '#88FF88'
userfull_gadgets.light_red = '#FF8888'
userfull_gadgets.none = 99
dofile(userfull_gadgets.modpath .. "/settings.lua")
dofile(userfull_gadgets.modpath .. "/functions.lua")
dofile(userfull_gadgets.modpath .. "/register_nodes.lua")
dofile(userfull_gadgets.modpath .. "/recipes.lua")
print("[MOD]" .. userfull_gadgets.modname .. " Version " .. userfull_gadgets.vers .. " successfully loaded.")
minetest.log("[MOD]" .. userfull_gadgets.modname .. " Version " .. userfull_gadgets.vers .. " successfully loaded.")

32
locale/template.txt Normal file
View File

@ -0,0 +1,32 @@
# textdomain: userfull_gadgets
### functions.lua ###
Items / Stack.=
Points Damage per Second.=
Deals with =
Has an alpha-channel.=
Is climbable.=
Is diggable.=
Is protected: No.=
Is protected? Yes.=
Is regenerateable.=
Is replaceable.=
Is walkable.=
Light above: =
Light on the Node: =
Light shines trough.=
Light under: =
Located at: =
Name of the Node: =
Node unknown!=
Pointed on no Node.=
Shines with Lightlevel =
Stacks with =
With a transparency of =
### register_nodes.lua ###
Magnifying Glass=
Vacuum Cleaner=

View File

@ -0,0 +1,32 @@
# textdomain: userfull_gadgets
### functions.lua ###
Items / Stack.= Stück / Stapel.
Points Damage per Second.= Punkte Schaden pro Sekunde.
Deals with =Verteilt
Has an alpha-channel.=Hat einen Alpha-Kanal.
Is climbable.=Kann man erklettern.
Is diggable.=Ist abbaubar.
Is protected: No.=Ist geschützt? Nein.
Is protected? Yes.=Ist geschützt? Ja.
Is regenerateable.=Erneuert sich.
Is replaceable.=Ist ersetzbar.
Is walkable.=Ist begehbar.
Light above: =Lichtstärke darüber:
Light on the Node: =Licht im Block:
Light shines trough.=Licht scheint durch.
Light under: =Lichtstärke darunter:
Located at: =Gefunden bei:
Name of the Node: =Name des Blockes:
Node unknown!=Block unbekannt!
Pointed on no Node.=Zeigt auf keinen Block.
Shines with Lightlevel =Scheint mit einer Lichtstärke von
Stacks with =Stapelbar bis zu
With a transparency of =Mit einer Transparenz von
### register_nodes.lua ###
Magnifying Glass=Vergrößerungsglas
Vacuum Cleaner=Staubsauger

2
mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = userfull_gadgets
depends = default, wool

16
recipes.lua Normal file
View File

@ -0,0 +1,16 @@
minetest.register_craft({
output = "userfull_gadgets:vacuum",
recipe = { {"default:steel_ingot", "default:papyrus", "group:wool"},
{"", "default:papyrus", ""},
{"default:mese", "default:chest", "default:mese"}
}
})
minetest.register_craft({
output = "userfull_gadgets:magnifier",
recipe = {
{"default:glass", "default:mese_crystal_fragment"},
{"default:stick", ""}
}
})

31
register_nodes.lua Normal file
View File

@ -0,0 +1,31 @@
-- get Boilerplate
local S = userfull_gadgets.S
-- Vacuum-cleaner
minetest.register_tool("userfull_gadgets:vacuum", {
description = S("Vacuum Cleaner"),
inventory_image = "userfull_gadgets_vacuum.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
userfull_gadgets.vacuumize(itemstack, user, pointed_thing)
end, -- on_use
})
-- magnifier
minetest.register_craftitem("userfull_gadgets:magnifier", {
description = S("Magnifying Glass"),
inventory_image = "userfull_gadgets_magnifier.png",
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
local pos = minetest.get_pointed_thing_position(pointed_thing)
local name = user:get_player_name()
userfull_gadgets.show_node(name, pos)
end,-- on_use
})

7
settings.lua Normal file
View File

@ -0,0 +1,7 @@
local ug = "userfull_gadgets.settings."
-- Set's the range of the Vacuum_Cleaner
userfull_gadgets.settings.vacuum_range = tonumber(minetest.settings:get(ug .. "vacuum_range")) or 8
print("[MOD]" .. userfull_gadgets.modname .. ": Vacuum_range is set to " .. userfull_gadgets.settings.vacuum_range)
minetest.log("[MOD]" .. userfull_gadgets.modname .. ": Vacuum_range is set to " .. userfull_gadgets.settings.vacuum_range)

4
settingtypes.txt Normal file
View File

@ -0,0 +1,4 @@
#vacuum_range
# default = 8
# set's the Radius of the vacuum_cleaner
userfull_gadgets.settings.vacuum_range (Radius) int 8

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B