Addendum Final lock

This commit is contained in:
maikerumine 2017-11-24 13:05:34 -05:00
parent ae6f682508
commit 1497125d33
11 changed files with 113 additions and 2 deletions

View File

@ -476,7 +476,7 @@ minetest.register_craftitem("es:emerald_dust", {
inventory_image = "dye_green.png",
})
--[[[
--ES RUBBER
minetest.register_craftitem("es:rubber_dust", {
description = "Rubber Dust",
@ -498,7 +498,7 @@ minetest.register_craft({
{"default:jungletree", "default:jungletree","default:jungletree"},
},
})
]]

View File

@ -24,6 +24,8 @@ es.modpath = modpath
dofile(modpath.."/alias.lua")
dofile(modpath.."/crafting.lua")
dofile(modpath.."/antigrief.lua")
dofile(modpath.."/itemdrop.lua")
dofile(modpath.."/musicmod.lua")
dofile(modpath.."/armor.lua")
dofile(modpath.."/kill.lua")
dofile(modpath.."/shields.lua")

72
mods/es/itemdrop.lua Normal file
View File

@ -0,0 +1,72 @@
minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.setting_getbool("enable_damage") then
local pos = player:getpos()
pos.y = pos.y+0.5
local inv = player:get_inventory()
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
-- only pick up resting objects, so "q" can be used to drop without immediately picking an item up again
local vel = object:getvelocity()
if inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) and math.abs(vel.x) < .2 and math.abs(vel.z) < .2 then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
if object:get_luaentity().itemstring ~= "" then
minetest.sound_play("item_drop_pickup", {
to_player = player:get_player_name(),
gain = 0.4,
})
end
object:get_luaentity().itemstring = ""
object:remove()
end
end
end
end
end
end)
function minetest.handle_node_drops(pos, drops, digger)
local inv
if minetest.setting_getbool("creative_mode") and digger and digger:is_player() then
inv = digger:get_inventory()
end
for _,item in ipairs(drops) do
local count, name
if type(item) == "string" then
count = 1
name = item
else
count = item:get_count()
name = item:get_name()
end
if not inv or not inv:contains_item("main", ItemStack(name)) then
for i=1,count do
local obj = minetest.add_item(pos, name)
if obj ~= nil then
obj:get_luaentity().collect = true
local x = math.random(1, 5)
if math.random(1,2) == 1 then
x = -x
end
local z = math.random(1, 5)
if math.random(1,2) == 1 then
z = -z
end
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
-- FIXME this doesnt work for deactiveted objects
if minetest.setting_get("remove_items") and tonumber(minetest.setting_get("remove_items")) then
minetest.after(tonumber(minetest.setting_get("remove_items")), function(obj)
obj:remove()
end, obj)
end
end
end
end
end
end
if minetest.setting_get("log_mods") then
minetest.log("action", "item_drop loaded")
end

28
mods/es/musicmod.lua Normal file
View File

@ -0,0 +1,28 @@
math.randomseed(3)
sound_playing = 0
minetest.register_globalstep(function(time)
local time = minetest.env:get_timeofday()
--minetest.chat_send_all(time .. " " .. sound_playing)
if sound_playing == 0 then
sound_playing = time
end
if sound_playing > 1 and time < 0.2 then
sound_playing = 0.2
end
if time > sound_playing then
if time > 0.8 or time < 0.2 then
sound_playing = time + 0.2
minetest.sound_play("mm_dark")
return true
end
sound_playing = time + 0.2
minetest.sound_play("mm_light")
return true
end
end)

View File

@ -0,0 +1,9 @@
mm_dark.1.ogg - by yd; original title: Searching.ogg
- compressed
- released as CC0 on opengameart.org
mm_light.1.ogg - by Écrivain; original title: music.ogg
- compressed
- released as CC0 on opengameart.org

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.