renaming and formating

master
Nathaniel Freeman 2021-08-06 20:53:27 +02:00
parent 0ce6bfe571
commit c17814e137
4 changed files with 204 additions and 232 deletions

View File

@ -21,63 +21,51 @@
-- Cristalcitos uwus hacen algo más uwu... el bloque uwu :D!
-- UwU Crafteo de Bloque
minetest.register_craft({
output = 'uwu:bloque_uwu',
recipe = {
{'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu'},
{'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu'},
{'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu'},
}
core.register_craft({
output = "uwu:block",
recipe = {
{"uwu:crystal", "uwu:crystal", "uwu:crystal"},
{"uwu:crystal", "uwu:crystal", "uwu:crystal"},
{"uwu:crystal", "uwu:crystal", "uwu:crystal"},
}
})
-- UwU Espadita
minetest.register_craft({
output = 'uwu:espadita_uwu',
recipe = {
{'','uwu:cristalcito_uwu',''},
{'','uwu:cristalcito_uwu',''},
{'','group:stick',''}
}
core.register_craft({
output = "uwu:shovel",
recipe = {
{"","uwu:crystal",""},
{"","uwu:crystal",""},
{"","group:stick",""}
}
})
-- UwU Piquito
minetest.register_craft({
output = 'uwu:piquito_uwu',
recipe = {
{'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu'},
{'', 'group:stick', ''},
{'', 'group:stick', ''},
}
core.register_craft({
output = "uwu:pick",
recipe = {
{"uwu:crystal", "uwu:crystal", "uwu:crystal"},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})
-- UwU Hachita
minetest.register_craft({
output = 'uwu:hachita_uwu',
recipe = {
{'uwu:cristalcito_uwu', 'uwu:cristalcito_uwu', ''},
{'uwu:cristalcito_uwu', 'group:stick', ''},
{'', 'group:stick', ''},
}
core.register_craft({
output = "uwu:axe",
recipe = {
{"uwu:crystal", "uwu:crystal", ""},
{"uwu:crystal", "group:stick", ""},
{"", "group:stick", ""},
}
})
-- UwU Palita
minetest.register_craft({
output = 'uwu:palita_uwu',
recipe = {
{'', 'uwu:cristalcito_uwu', ''},
{'', 'group:stick', ''},
{'', 'group:stick', ''},
}
core.register_craft({
output = "uwu:shovel",
recipe = {
{"", "uwu:crystal", ""},
{"", "group:stick", ""},
{"", "group:stick", ""},
}
})

45
gen.lua
View File

@ -1,45 +0,0 @@
-- Copyright (C) 2020 2021 PsycoJaker
-- This file is part of UwU Mod Minetest Mod.
-- UwU Mod is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- any later version.
-- UwU Mod is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with UwU Mod. If not, see <https://www.gnu.org/licenses/>.
-- UwU Gen
local stonelike = {"mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"}
minetest.register_ore({
ore_type = "scatter",
ore = "uwu:stone_with_uwu",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_overworld_min,
y_max = -55,
})
minetest.register_ore({
ore_type = "scatter",
ore = "uwu:stone_with_uwu",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 2,
clust_size = 2,
y_min = mcl_vars.mg_overworld_min,
y_max = -55,
})

View File

@ -18,14 +18,45 @@
-- along with UwU Mod. If not, see <https://www.gnu.org/licenses/>.
-----------------UWU-----------------
local modpath = minetest.get_modpath(minetest.get_current_modname())
local modpath = core.get_modpath(core.get_current_modname())
dofile(modpath .. "/tools.lua")
dofile(modpath .. "/gen.lua")
dofile(modpath .. "/crafts.lua")
dofile(modpath .. "/nodes.lua")
dofile(modpath .. "/tools.lua")
dofile(modpath .. "/crafts.lua")
minetest.log("[MOD] UwU")
-- UwU Gen
local stonelike = {"mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"}
core.register_ore({
ore_type = "scatter",
ore = "uwu:ore",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_overworld_min,
y_max = -55,
})
core.register_ore({
ore_type = "scatter",
ore = "uwu:ore",
wherein = stonelike,
clust_scarcity = 20000,
clust_num_ores = 2,
clust_size = 2,
y_min = mcl_vars.mg_overworld_min,
y_max = -55,
})
-- old alias
core.register_alias("uwu:espadita_uwu", "uwu:sword")
core.register_alias("uwu:piquito_uwu", "uwu:pick")
core.register_alias("uwu:hachita_uwu", "uwu:axe")
core.register_alias("uwu:palita_uwu", "uwu:shovel")
core.register_alias("uwu:bloque_uwu", "uwu:block")
core.register_alias("uwu:cristalcito_uwu", "uwu:crystal")
core.register_alias("uwu:stone_with_uwu", "uwu:ore")

268
tools.lua
View File

@ -19,159 +19,157 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
local modname = core.get_current_modname()
local modpath = core.get_modpath(modname)
local S = core.get_translator(modname)
local wield_scale = mcl_vars.tool_wield_scale
local function make_grass_path(itemstack, placer, pointed_thing)
-- Use pointed node's on_rightclick function first, if present
local node = minetest.get_node(pointed_thing.under)
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
-- Use pointed node's on_rightclick function first, if present
local node = core.get_node(pointed_thing.under)
if placer and not placer:get_player_control().sneak then
if core.registered_nodes[node.name] and core.registered_nodes[node.name].on_rightclick then
return core.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
end
end
-- Only make grass path if tool used on side or top of target node
if pointed_thing.above.y < pointed_thing.under.y then
return itemstack
end
if (minetest.get_item_group(node.name, "grass_block") == 1) then
local above = table.copy(pointed_thing.under)
above.y = above.y + 1
if minetest.get_node(above).name == "air" then
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a shovely node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "shovely")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end
end
return itemstack
-- Only make grass path if tool used on side or top of target node
if pointed_thing.above.y < pointed_thing.under.y then
return itemstack
end
if (core.get_item_group(node.name, "grass_block") == 1) then
local above = table.copy(pointed_thing.under)
above.y = above.y + 1
if core.get_node(above).name == "air" then
if core.is_protected(pointed_thing.under, placer:get_player_name()) then
core.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if not core.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a shovely node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "shovely")
itemstack:add_wear(wear)
end
core.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
core.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
end
end
return itemstack
end
local function make_stripped_trunk(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node(pointed_thing.under)
local noddef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
if not placer:get_player_control().sneak and noddef.on_rightclick then
return minetest.item_place(itemstack, placer, pointed_thing)
end
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
minetest.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if noddef._mcl_stripped_variant == nil then
return itemstack
else
minetest.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
if not minetest.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
itemstack:add_wear(wear)
end
end
return itemstack
if pointed_thing.type ~= "node" then return end
local node = core.get_node(pointed_thing.under)
local noddef = core.registered_nodes[core.get_node(pointed_thing.under).name]
if not placer:get_player_control().sneak and noddef.on_rightclick then
return core.item_place(itemstack, placer, pointed_thing)
end
if core.is_protected(pointed_thing.under, placer:get_player_name()) then
core.record_protection_violation(pointed_thing.under, placer:get_player_name())
return itemstack
end
if noddef._mcl_stripped_variant == nil then
return itemstack
else
core.swap_node(pointed_thing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
if not core.is_creative_enabled(placer:get_player_name()) then
-- Add wear (as if digging a axey node)
local toolname = itemstack:get_name()
local wear = mcl_autogroup.get_wear(toolname, "axey")
itemstack:add_wear(wear)
end
end
return itemstack
end
-- Herramientitas uwu
-- uwu tools
minetest.register_tool("uwu:espadita_uwu", {
description = S("Espadita UwU"),
inventory_image = "uwu_espadita.png",
wield_scale = wield_scale,
groups = { weapon=1, sword=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=2,
damage_groups = {fleshy=4},
punch_attack_uses = 33,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:cristalcito_uwu",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 12, level = 4, uses = 800 },
swordy_cobweb = { speed = 12, level = 4, uses = 250 }
},
core.register_tool("uwu:sword", {
description = S("UwU Sword"),
inventory_image = "uwu_sword.png",
wield_scale = wield_scale,
groups = { weapon=1, sword=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=2,
damage_groups = {fleshy=4},
punch_attack_uses = 33,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:crystal",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 12, level = 4, uses = 800 },
swordy_cobweb = { speed = 12, level = 4, uses = 250 }
},
})
minetest.register_tool("uwu:piquito_uwu", {
description = S("Piquito UwU"),
inventory_image = "uwu_piquito.png",
wield_scale = wield_scale,
groups = { tool=1, pickaxe=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=2,
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:cristalcito_uwu",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 12, level = 5, uses = 250 }
},
core.register_tool("uwu:pick", {
description = S("UwU Pickaxe"),
inventory_image = "uwu_pick.png",
wield_scale = wield_scale,
groups = { tool=1, pickaxe=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 0.83333333,
max_drop_level=2,
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:crystal",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 12, level = 5, uses = 250 }
},
})
minetest.register_tool("uwu:hachita_uwu", {
description = S("Hachita UwU"),
inventory_image = "uwu_hachita.png",
wield_scale = wield_scale,
groups = { tool=1, axe=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=2,
damage_groups = {fleshy=7},
punch_attack_uses = 17,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:cristalcito_uwu",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 12, level = 4, uses = 250 }
},
core.register_tool("uwu:axe", {
description = S("UwU Axe"),
inventory_image = "uwu_axe.png",
wield_scale = wield_scale,
groups = { tool=1, axe=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=2,
damage_groups = {fleshy=7},
punch_attack_uses = 17,
},
on_place = make_stripped_trunk,
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:crystal",
_mcl_toollike_wield = true,
_mcl_diggroups = {
axey = { speed = 12, level = 4, uses = 250 }
},
})
minetest.register_tool("uwu:palita_uwu", {
description = S("Palita UwU"),
inventory_image = "uwu_palita.png",
wield_image = "uwu_palita.png^[transformR90",
wield_scale = wield_scale,
groups = { tool=1, shovel=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=2,
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:cristalcito_uwu",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 12, level = 4, uses = 250 }
},
core.register_tool("uwu:shovel", {
description = S("UwU Shovel"),
inventory_image = "uwu_shovel.png",
wield_image = "uwu_shovel.png^[transformR90",
wield_scale = wield_scale,
groups = { tool=1, shovel=1, dig_speed_class=6, enchantability=22 },
tool_capabilities = {
full_punch_interval = 1,
max_drop_level=2,
damage_groups = {fleshy=2},
punch_attack_uses = 17,
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
_repair_material = "uwu:crystal",
_mcl_toollike_wield = true,
_mcl_diggroups = {
shovely = { speed = 12, level = 4, uses = 250 }
},
})