More colors and tweaks in general

This commit is contained in:
KaadmY 2017-05-11 14:03:08 -07:00
parent 029adbbe8b
commit 583925d611
4 changed files with 100 additions and 95 deletions

View File

@ -257,7 +257,7 @@ end)
minetest.register_on_joinplayer(
function(player)
local function welcome()
minetest.chat_send_player(player:get_player_name(), "Welcome to Pixture! Type /help for a list of commands.")
minetest.chat_send_player(player:get_player_name(), core.colorize("#0f0", "Welcome to Pixture! Type /help for a list of commands."))
end
minetest.after(1.0, welcome)

6
mods/goodies/depends.txt Normal file
View File

@ -0,0 +1,6 @@
default
farming
bed
mobs
gold?
jewels?

View File

@ -1,6 +1,6 @@
--
-- Goodies mod
-- By Kaadmy
-- By Kaadmy, for Pixture
--
goodies = {}
@ -10,17 +10,17 @@ goodies.max_items = 20
goodies.types = {}
-- custom types
goodies.types["FURNACE_SRC"] = {
goodies.types["FURNACE_SRC"] = {
["default:lump_iron"] = 3,
["default:dust_carbonsteel"] = 8,
["farming:flour"] = 5,
}
goodies.types["FURNACE_FUEL"] = {
goodies.types["FURNACE_FUEL"] = {
["default:lump_coal"] = 2,
["default:planks_oak"] = 4,
["default:planks_birch"] = 5,
}
goodies.types["FURNACE_DST"] = {
goodies.types["FURNACE_DST"] = {
["default:ingot_steel"] = 5,
["default:ingot_carbonsteel"] = 12,
["farming:bread"] = 8,
@ -28,7 +28,7 @@ goodies.types["FURNACE_DST"] = {
-- chunk types for villages
if minetest.get_modpath("village") ~= nil then
goodies.types["forge"] = {
goodies.types["forge"] = {
["default:ingot_steel"] = 10,
["default:lump_coal"] = 4,
["default:lump_iron"] = 6,
@ -43,7 +43,7 @@ if minetest.get_modpath("village") ~= nil then
["mobs:pork"] = 9,
["default:ladder"] = 9,
}
goodies.types["house"] = {
goodies.types["house"] = {
["default:stick"] = 2,
["farming:bread"] = 6,
["farming:cotton_1"] = 9,
@ -80,7 +80,7 @@ function goodies.fill(pos, ctype, pr, listname, keepchance)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local size = inv:get_size(listname)
if size < 1 then return end

View File

@ -45,32 +45,31 @@ minetest.register_tool(
"locks:pick",
{
description = "Lock Pick",
inventory_image = "locks_pick.png",
wield_image = "locks_pick.png",
stack_max = 1,
on_use = function(itemstack, player, pointed_thing)
if math.random(1, 5) <= 1 then
local pos = pointed_thing.under
if math.random(1, 5) <= 1 then
local pos = pointed_thing.under
local meta = minetest.get_meta(pos)
meta:set_float("last_lock_pick", minetest.get_gametime() + picked_time)
local meta = minetest.get_meta(pos)
meta:set_float("last_lock_pick", minetest.get_gametime() + picked_time)
local own = meta:get_string("lock_owner")
if own then
minetest.chat_send_player(
own,
player:get_player_name() .. " has broken into your locked chest!"
)
end
end
local own = meta:get_string("lock_owner")
if own then
minetest.chat_send_player(
own,
core.colorize("#f00", player:get_player_name() .. " has broken into your locked chest!"))
end
end
itemstack:add_wear(8200) -- about 8 uses
return itemstack
end,
})
itemstack:add_wear(8200) -- about 8 uses
return itemstack
end,
})
minetest.register_craftitem(
"locks:lock",
@ -79,7 +78,7 @@ minetest.register_craftitem(
inventory_image = "locks_lock.png",
wield_image = "locks_lock.png",
})
})
minetest.register_craft(
{
@ -89,7 +88,7 @@ minetest.register_craft(
{"", "default:stick", ""},
{"default:stick", "", ""},
},
})
})
minetest.register_craft(
{
@ -99,7 +98,7 @@ minetest.register_craft(
{"default:ingot_steel", "", "default:ingot_steel"},
{"group:planks", "group:planks", "group:planks"},
},
})
})
minetest.register_node(
"locks:chest",
@ -112,90 +111,90 @@ minetest.register_node(
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_float("last_lock_pick", -1)
local inv = meta:get_inventory()
inv:set_size("main", 8 * 4)
end,
local meta = minetest.get_meta(pos)
meta:set_float("last_lock_pick", -1)
local inv = meta:get_inventory()
inv:set_size("main", 8 * 4)
end,
after_place_node = function(pos, player)
local name = player:get_player_name()
local name = player:get_player_name()
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Locked Chest (Owned by " .. name .. ")")
meta:set_string("lock_owner", name)
end,
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Locked Chest (Owned by " .. name .. ")")
meta:set_string("lock_owner", name)
end,
on_rightclick = function(pos, node, player)
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos)
if not locks.is_locked(meta, player) then
if locks.is_owner(meta, player) then
-- also unlock when owner opens for "sharing" locked stuff
meta:set_float("last_lock_pick", minetest.get_gametime() + 5)
end
if not locks.is_locked(meta, player) then
if locks.is_owner(meta, player) then
-- also unlock when owner opens for "sharing" locked stuff
meta:set_float("last_lock_pick", minetest.get_gametime() + 5)
end
local np = pos.x .. "," .. pos.y .. "," .. pos.z
local form = default.ui.get_page("core_2part")
form = form .. "list[nodemeta:" .. np .. ";main;0.25,0.25;8,4;]"
form = form .. "listring[nodemeta:" .. np .. ";main]"
form = form .. default.ui.get_itemslot_bg(0.25, 0.25, 8, 4)
local np = pos.x .. "," .. pos.y .. "," .. pos.z
local form = default.ui.get_page("core_2part")
form = form .. "list[nodemeta:" .. np .. ";main;0.25,0.25;8,4;]"
form = form .. "listring[nodemeta:" .. np .. ";main]"
form = form .. default.ui.get_itemslot_bg(0.25, 0.25, 8, 4)
form = form .. "list[current_player;main;0.25,4.75;8,4;]"
form = form .. "listring[current_player;main]"
form = form .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
form = form .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
form = form .. "list[current_player;main;0.25,4.75;8,4;]"
form = form .. "listring[current_player;main]"
form = form .. default.ui.get_hotbar_itemslot_bg(0.25, 4.75, 8, 1)
form = form .. default.ui.get_itemslot_bg(0.25, 5.75, 8, 3)
minetest.show_formspec(
player:get_player_name(),
"default_chest",
form
)
end
end,
minetest.show_formspec(
player:get_player_name(),
"default_chest",
form
)
end
end,
allow_metadata_inventory_move = function(pos, from_l, from_i, to_l, to_i, cnt, player)
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return cnt
end,
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return cnt
end,
allow_metadata_inventory_put = function(pos, listname, index, itemstack, player)
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return itemstack:get_count()
end,
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return itemstack:get_count()
end,
allow_metadata_inventory_take = function(pos, listname, index, itemstack, player)
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return itemstack:get_count()
end,
local meta = minetest.get_meta(pos)
if locks.is_locked(meta, player) then
return 0
end
return itemstack:get_count()
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main") and locks.is_owner(meta, player)
end,
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main") and locks.is_owner(meta, player)
end,
write_name = function(pos, text)
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(pos)
if text ~= "" then
meta:set_string("infotext", text .. " (Owned by " .. meta:get_string("lock_owner") .. ")")
else
meta:set_string("infotext", "Locked Chest (Owned by " .. meta:get_string("lock_owner") .. ")")
end
end,
if text ~= "" then
meta:set_string("infotext", text .. " (Owned by " .. meta:get_string("lock_owner") .. ")")
else
meta:set_string("infotext", "Locked Chest (Owned by " .. meta:get_string("lock_owner") .. ")")
end
end,
on_blast = function() end,
})
})
minetest.register_craft(
{
output = "locks:chest",
type = "shapeless",
recipe = {"default:chest", "locks:lock"},
})
})
-- Achievements
@ -206,7 +205,7 @@ achievements.register_achievement(
description = "Craft a lock",
times = 1,
craftitem = "locks:lock",
})
})
achievements.register_achievement(
"burglar",
@ -215,6 +214,6 @@ achievements.register_achievement(
description = "Craft a lock pick",
times = 1,
craftitem = "locks:pick",
})
})
default.log("mod:locks", "loaded")
default.log("mod:locks", "loaded")