mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 02:00:37 +01:00
Change item_drop mod
Change player speed parameters (come back to normal values)
This commit is contained in:
parent
3894e98988
commit
cfac0a37c8
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -147,3 +147,6 @@
|
||||
[submodule "mods/playereffects"]
|
||||
path = mods/playereffects
|
||||
url = https://github.com/sys4-fr/playereffects.git
|
||||
[submodule "mods/item_drop"]
|
||||
path = mods/item_drop
|
||||
url = https://github.com/tacotexmex/item_drop.git
|
||||
|
@ -60,29 +60,29 @@ curl_timeout = 15000
|
||||
### MOVEMENT MODIFICATIONS ###
|
||||
##############################
|
||||
# Slightly decreased compared to minetest_next.
|
||||
movement_acceleration_default = 2.4
|
||||
#movement_acceleration_default = 2.4
|
||||
# Same acceleration in air and on the ground, to fix some movement glitches. Also is easier to play.
|
||||
movement_acceleration_air = 1.2
|
||||
#movement_acceleration_air = 1.2
|
||||
# Almost instant acceleration in fast mode for more control.
|
||||
movement_acceleration_fast = 24
|
||||
#movement_acceleration_fast = 24
|
||||
# Walking is 20 % faster than in minetest_game. Makes playing without the "fast" privilege less boring.
|
||||
movement_speed_walk = 4.8
|
||||
#movement_speed_walk = 4.8
|
||||
# Half the speed of walking, just like the animation.
|
||||
movement_speed_crouch = 2.4
|
||||
#movement_speed_crouch = 2.4
|
||||
# 5 times faster than walking.
|
||||
movement_speed_fast = 24
|
||||
#movement_speed_fast = 24
|
||||
# Makes climbing speed faster than rising in the water. Also makes ladders more useful.
|
||||
movement_speed_climb = 4.8
|
||||
#movement_speed_climb = 4.8
|
||||
# Faster movement in liquids. Jumping at the water surface also speeds up swimming.
|
||||
movement_liquid_fluidity = 1.6 (default = 1)
|
||||
#movement_liquid_fluidity = 1.6 (default = 1)
|
||||
# Ralentissement à la surface de l'eau
|
||||
movement_liquid_fluidity_smooth = 0.5
|
||||
#movement_liquid_fluidity_smooth = 0.5
|
||||
# Vitesse à laquelle le joueur coule
|
||||
movement_liquid_sink = 15
|
||||
#movement_liquid_sink = 15
|
||||
# Slightly less gravity.
|
||||
movement_gravity = 9.5
|
||||
#movement_gravity = 9.5
|
||||
# Jump height slightly reduced.
|
||||
movement_speed_jump = 6.5
|
||||
#movement_speed_jump = 6.5
|
||||
# Emplacement du static spawn point
|
||||
static_spawnpoint = 144, 25, 261
|
||||
# Emplacment du static spawn pour le nether
|
||||
@ -195,3 +195,11 @@ secure.trusted_mods = irc, snow, stacktraceplus
|
||||
|
||||
## Player Anim ##
|
||||
player_model_version = default_character_v1
|
||||
|
||||
# item_drop
|
||||
enable_item_drop = false
|
||||
enable_item_pickup_key = false
|
||||
enable_item_pickup = true
|
||||
item_pickup_radius = 0.75
|
||||
item_pickup_keytype = Sneak
|
||||
|
||||
|
1
mods/item_drop
Submodule
1
mods/item_drop
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 962d0a3889db609c349e3e99a58104bbb22f4c93
|
@ -1,42 +0,0 @@
|
||||
===ITEM_DROP MOD for MINETEST-C55===
|
||||
by PilzAdam
|
||||
|
||||
Introduction:
|
||||
This mod adds Minecraft like drop/pick up of items to Minetest.
|
||||
|
||||
How to install:
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
if you have a windows client or a linux run-in-place client. If you have
|
||||
a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
If you want to install this mod only in one world create the folder
|
||||
worldmods/ in your worlddirectory.
|
||||
For further information or help see:
|
||||
http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
Just install it an everything works.
|
||||
|
||||
For developers:
|
||||
You dont have to use get_drops() anymore because of changes in the
|
||||
builtin files of minetest.
|
||||
|
||||
License:
|
||||
Sourcecode: WTFPL (see below)
|
||||
Sound: WTFPL (see below)
|
||||
|
||||
See also:
|
||||
http://minetest.net/
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
@ -1,184 +0,0 @@
|
||||
item_drop = {}
|
||||
local enable_damage = minetest.setting_getbool("enable_damage")
|
||||
local creative_mode = minetest.setting_getbool("creative_mode")
|
||||
local TICK_UPDATE = 0.1
|
||||
|
||||
|
||||
-- Following edits by gravgun
|
||||
|
||||
item_drop.drop_callbacks = {}
|
||||
item_drop.pickup_callbacks = {}
|
||||
|
||||
-- on_drop(dropper, drop_entity, itemstack)
|
||||
function item_drop.add_drop_callback(on_drop)
|
||||
table.insert(item_drop.drop_callbacks, on_drop)
|
||||
end
|
||||
|
||||
-- on_pickup(picker, itemstack)
|
||||
function item_drop.add_pickup_callback(on_pickup)
|
||||
table.insert(item_drop.pickup_callbacks, on_pickup)
|
||||
end
|
||||
|
||||
-- Idea is to have a radius pickup range around the player, whatever the height
|
||||
-- We need to have a radius that will at least contain 1 node distance at the player's feet
|
||||
-- Using simple trigonometry, we get that we need a radius of
|
||||
-- sqrt(pickup_range² + player_half_height²)
|
||||
local pickup_range = 1.3
|
||||
local pickup_range_squared = pickup_range*pickup_range
|
||||
local player_half_height = 0.9
|
||||
local scan_range = math.sqrt(player_half_height*player_half_height + pickup_range_squared)
|
||||
-- Node drops are insta-pickup, everything else (player drops) are not
|
||||
local delay_before_playerdrop_pickup = 1
|
||||
-- Time in which the node comes to the player
|
||||
local pickup_duration = 0.1
|
||||
-- Little treshold so the items aren't already on the player's middle
|
||||
local pickup_inv_duration = 1/pickup_duration*0.7
|
||||
|
||||
local function tick()
|
||||
local tstamp = minetest.get_us_time()
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
if player:get_hp() > 0 or not enable_damage then
|
||||
local pos = player:getpos()
|
||||
pos.y = pos.y + player_half_height
|
||||
local inv = player:get_inventory()
|
||||
|
||||
if inv then
|
||||
for _,object in ipairs(minetest.get_objects_inside_radius(pos, scan_range)) do
|
||||
local luaEnt = object:get_luaentity()
|
||||
if luaEnt and luaEnt.name == "__builtin:item" then
|
||||
local ticky = luaEnt.item_drop_min_tstamp
|
||||
if ticky then
|
||||
if tstamp >= ticky then
|
||||
luaEnt.item_drop_min_tstamp = nil
|
||||
end
|
||||
elseif not luaEnt.item_drop_nopickup then
|
||||
-- Point-line distance computation, heavily simplified since the wanted line,
|
||||
-- being the player, is completely upright (no variation on X or Z)
|
||||
local pos2 = object:getpos()
|
||||
-- No sqrt, avoid useless computation
|
||||
-- (just take the radius, compare it to the square of what you want)
|
||||
-- Pos order doesn't really matter, we're squaring the result
|
||||
-- (but don't change it, we use the cached values afterwards)
|
||||
local dX = pos.x-pos2.x
|
||||
local dZ = pos.z-pos2.z
|
||||
local playerDistance = dX*dX+dZ*dZ
|
||||
if playerDistance <= pickup_range_squared then
|
||||
local itemStack = ItemStack(luaEnt.itemstring)
|
||||
if inv:room_for_item("main", itemStack) then
|
||||
local vec = {x=dX, y=pos.y-pos2.y, z=dZ}
|
||||
vec.x = vec.x*pickup_inv_duration
|
||||
vec.y = vec.y*pickup_inv_duration
|
||||
vec.z = vec.z*pickup_inv_duration
|
||||
object:setvelocity(vec)
|
||||
luaEnt.physical_state = false
|
||||
luaEnt.object:set_properties({
|
||||
physical = false
|
||||
})
|
||||
-- Mark the object as already picking up
|
||||
luaEnt.item_drop_nopickup = true
|
||||
|
||||
minetest.after(pickup_duration, function()
|
||||
local lua = luaEnt
|
||||
if object == nil or lua == nil or lua.itemstring == nil then
|
||||
return
|
||||
end
|
||||
if inv:room_for_item("main", itemStack) then
|
||||
inv:add_item("main", itemStack)
|
||||
if luaEnt.itemstring ~= "" then
|
||||
minetest.sound_play("item_drop_pickup", {pos = pos, gain = 0.3, max_hear_distance = 8})
|
||||
end
|
||||
luaEnt.itemstring = ""
|
||||
object:remove()
|
||||
for i, cb in ipairs(item_drop.pickup_callbacks) do
|
||||
cb(player, itemstack)
|
||||
end
|
||||
else
|
||||
object:setvelocity({x = 0,y = 0,z = 0})
|
||||
luaEnt.physical_state = true
|
||||
luaEnt.object:set_properties({
|
||||
physical = true
|
||||
})
|
||||
luaEnt.item_drop_nopickup = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.after(TICK_UPDATE, tick)
|
||||
end
|
||||
|
||||
local mt_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if digger and digger.is_fake_player then -- Pipeworks' wielders
|
||||
mt_handle_node_drops(pos, drops, digger)
|
||||
return
|
||||
end
|
||||
local inv
|
||||
if 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
|
||||
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 = minetest.spawn_item(pos, name)
|
||||
if obj ~= nil then
|
||||
obj:setvelocity({x=1/x, y=obj:getvelocity().y, z=1/z})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local mt_item_drop = minetest.item_drop
|
||||
function minetest.item_drop(itemstack, dropper, pos)
|
||||
if dropper and dropper.is_player then
|
||||
local v = dropper:get_look_dir()
|
||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||
local cs = itemstack:get_count()
|
||||
if dropper:get_player_control().sneak then
|
||||
cs = 1
|
||||
end
|
||||
local item = itemstack:take_item(cs)
|
||||
local obj = core.add_item(p, item)
|
||||
if obj then
|
||||
v.x = v.x*2
|
||||
v.y = v.y*2 + 2
|
||||
v.z = v.z*2
|
||||
obj:setvelocity(v)
|
||||
obj:get_luaentity().item_drop_min_tstamp = minetest.get_us_time() + delay_before_playerdrop_pickup * 1000000
|
||||
for i, cb in ipairs(item_drop.drop_callbacks) do
|
||||
cb(dropper, obj, itemstack)
|
||||
end
|
||||
end
|
||||
else
|
||||
core.add_item(pos, itemstack)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if minetest.setting_getbool("log_mods") then
|
||||
minetest.log("action", "[item_drop] item_drop overriden: " .. tostring(mt_item_drop) .. " " .. tostring(minetest.item_drop))
|
||||
minetest.log("action", "[item_drop] loaded.")
|
||||
end
|
||||
|
||||
tick()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user