mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 18:20:36 +01:00
Merge branch 'crabman77-fix_physics' into NALC2
This commit is contained in:
commit
9417e3335d
126
minetestforfun_game/mods/player_physics/init.lua
Normal file
126
minetestforfun_game/mods/player_physics/init.lua
Normal file
@ -0,0 +1,126 @@
|
||||
local players = {}
|
||||
player_physics = {}
|
||||
|
||||
|
||||
function player_physics.check(playername)
|
||||
if players[playername] == nil then
|
||||
players[playername] = {speed = {}, jump = {}, gravity={}, temp={}}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local playername = player:get_player_name()
|
||||
player_physics.check(playername)
|
||||
end)
|
||||
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local playername = player:get_player_name()
|
||||
players[playername] = nil
|
||||
end)
|
||||
|
||||
|
||||
function player_physics.add(player, physicsname , name, value)
|
||||
if physicsname ~= "speed" and physicsname ~= "jump" and physicsname ~= "gravity" then
|
||||
return
|
||||
end
|
||||
local playername = player:get_player_name()
|
||||
player_physics.check(playername)
|
||||
players[playername][physicsname][name] = value
|
||||
end
|
||||
|
||||
|
||||
function player_physics.remove(player, physicsname, name)
|
||||
if physicsname ~= "speed" and physicsname ~= "jump" and physicsname ~= "gravity" then
|
||||
return
|
||||
end
|
||||
local playername = player:get_player_name()
|
||||
player_physics.check(playername)
|
||||
players[playername][physicsname][name] = nil
|
||||
end
|
||||
|
||||
|
||||
function player_physics.add_effect(player, physicsname, name, value, time)
|
||||
if physicsname ~= "speed" and physicsname ~= "jump" and physicsname ~= "gravity" then
|
||||
return
|
||||
end
|
||||
if type(value) ~= "number" or type(time) ~= "number" then
|
||||
return
|
||||
end
|
||||
local playername = player:get_player_name()
|
||||
player_physics.check(playername)
|
||||
players[playername]["temp"][name] = {n=physicsname, v=value, t=time}
|
||||
end
|
||||
|
||||
|
||||
function player_physics.remove_effect(player, name)
|
||||
local playername = player:get_player_name()
|
||||
player_physics.check(playername)
|
||||
players[playername]["temp"][name] = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local playername = player:get_player_name()
|
||||
if playername ~= "" then
|
||||
player_physics.check(playername)
|
||||
local speed = 1
|
||||
local jump = 1
|
||||
local gravity = 1
|
||||
|
||||
for _, v in pairs(players[playername]["speed"]) do
|
||||
speed = speed + v
|
||||
end
|
||||
for _, v in pairs(players[playername]["jump"]) do
|
||||
jump = jump + v
|
||||
end
|
||||
for _, v in pairs(players[playername]["gravity"]) do
|
||||
gravity = gravity + v
|
||||
end
|
||||
|
||||
--temporary effect
|
||||
for n, k in pairs(players[playername]["temp"]) do
|
||||
if k.n == "speed" then
|
||||
speed = speed + k.v
|
||||
elseif k.n == "jump" then
|
||||
jump = jump + k.v
|
||||
elseif k.n == "gravity" then
|
||||
gravity = gravity + k.v
|
||||
end
|
||||
|
||||
t = k.t-dtime
|
||||
if t > 0 then
|
||||
players[playername]["temp"][n]["t"] = t
|
||||
else
|
||||
players[playername]["temp"][n] = nil
|
||||
end
|
||||
end
|
||||
|
||||
if speed > 4 then
|
||||
speed = 4
|
||||
elseif speed < 0 then
|
||||
speed = 0
|
||||
end
|
||||
|
||||
if jump > 3 then
|
||||
jump = 3
|
||||
elseif jump < 0 then
|
||||
jump = 0
|
||||
end
|
||||
|
||||
if gravity > 2 then
|
||||
gravity = 2
|
||||
elseif gravity < -2 then
|
||||
gravity = -2
|
||||
end
|
||||
|
||||
player:set_physics_override({speed=speed,jump=jump, gravity=gravity})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -1 +1,2 @@
|
||||
hudbars?
|
||||
player_physics
|
||||
|
@ -208,9 +208,13 @@ function setSprinting(playerName, sprinting) --Sets the state of a player (0=sto
|
||||
if sprint.players[playerName] then
|
||||
sprint.players[playerName]["sprinting"] = sprinting
|
||||
if sprinting == true then
|
||||
player:set_physics_override({speed=SPRINT_SPEED + bonus_speed,jump=SPRINT_JUMP + bonus_jump})
|
||||
-- player:set_physics_override({speed=SPRINT_SPEED + bonus_speed,jump=SPRINT_JUMP + bonus_jump})
|
||||
player_physics.add(player, "speed", "sprint_speed", 0.35+ bonus_speed)
|
||||
player_physics.add(player, "jump", "sprint_jump", 0.1+ bonus_jump)
|
||||
elseif sprinting == false then
|
||||
player:set_physics_override({speed=1.0 + bonus_speed,jump=1.0 + bonus_jump})
|
||||
-- player:set_physics_override({speed=1.0 + bonus_speed,jump=1.0 + bonus_jump})
|
||||
player_physics.add(player, "speed", "sprint_speed", bonus_speed)
|
||||
player_physics.add(player, "jump", "sprint_jump", bonus_jump)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -2,10 +2,11 @@ default
|
||||
vessels
|
||||
tnt
|
||||
fire
|
||||
player_physics
|
||||
playereffects
|
||||
farming?
|
||||
lightning?
|
||||
pmobs?
|
||||
hud_hunger?
|
||||
moreplants?
|
||||
horror?
|
||||
horror?
|
||||
|
@ -73,7 +73,7 @@ minetest.register_node("witchcraft:shelf", {
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
local to_stack = inv:get_stack(to_list, to_index)
|
||||
if to_list == "vessels" then
|
||||
if minetest.get_item_group(stack:get_name(), "potion") ~= 0
|
||||
if minetest.get_item_group(stack:get_name(), "potion") ~= 0
|
||||
and to_stack:is_empty() then
|
||||
return 1
|
||||
else
|
||||
@ -914,12 +914,12 @@ minetest.register_entity("witchcraft:tnt_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:tnt_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -938,7 +938,7 @@ minetest.register_entity("witchcraft:tnt_splash", {
|
||||
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:tnt_splash" and n ~="default:obsidian" and n ~= "air" then
|
||||
if n ~= "witchcraft:tnt_splash" and n ~="default:obsidian" and n ~= "air" then
|
||||
local pos = self.object:getpos()
|
||||
minetest.sound_play("default_break_glass.1", {
|
||||
pos = self.object:getpos(),
|
||||
@ -973,7 +973,7 @@ minetest.register_entity("witchcraft:tnt_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -984,12 +984,12 @@ minetest.register_entity("witchcraft:fire_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:fire_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1043,7 +1043,7 @@ minetest.register_entity("witchcraft:fire_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1052,12 +1052,12 @@ minetest.register_entity("witchcraft:death_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:death_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1089,8 +1089,6 @@ minetest.register_entity("witchcraft:death_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1099,12 +1097,12 @@ minetest.register_entity("witchcraft:heal_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:heal_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1136,8 +1134,6 @@ minetest.register_entity("witchcraft:heal_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1146,12 +1142,12 @@ minetest.register_entity("witchcraft:slow_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:slow_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1168,7 +1164,6 @@ minetest.register_entity("witchcraft:slow_splash", {
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:slow_splash" and n ~= "air" then
|
||||
|
||||
self.object:remove()
|
||||
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
|
||||
minetest.sound_play("default_break_glass.1", {
|
||||
@ -1182,8 +1177,6 @@ minetest.register_entity("witchcraft:slow_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1192,18 +1185,34 @@ minetest.register_entity("witchcraft:fast_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(5, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:is_player() then
|
||||
playereffects.apply_effect_type("potion_slow_lv1", 11, obj)
|
||||
minetest.sound_play("default_break_glass", {
|
||||
pos = self.object:getpos(),
|
||||
max_hear_distance = 20,
|
||||
gain = 10.0,
|
||||
})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:fast_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if obj:get_luaentity().name ~= "witchcraft:fast_splash" and obj:get_luaentity().name ~= "__builtin:item" and obj:get_luaentity().name ~= "gauges:hp_bar" then
|
||||
local vel = obj:getvelocity()
|
||||
obj:setvelocity({x=vel.x*4, y=vel.y*1, z=vel.z*4})
|
||||
self.object:remove()
|
||||
minetest.sound_play("default_break_glass", {
|
||||
pos = self.object:getpos(),
|
||||
max_hear_distance = 20,
|
||||
gain = 10.0,
|
||||
})
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1214,8 +1223,7 @@ minetest.register_entity("witchcraft:fast_splash", {
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:fast_splash" and n ~= "air" then
|
||||
|
||||
self.object:remove()
|
||||
self.object:remove()
|
||||
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
|
||||
minetest.sound_play("default_break_glass.1", {
|
||||
pos = self.object:getpos(),
|
||||
@ -1228,8 +1236,6 @@ minetest.register_entity("witchcraft:fast_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1238,12 +1244,12 @@ minetest.register_entity("witchcraft:antigrav_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:antigrav_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1259,11 +1265,8 @@ minetest.register_entity("witchcraft:antigrav_splash", {
|
||||
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:antigrav_splash" and n ~= "air" then
|
||||
|
||||
self.object:remove()
|
||||
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
|
||||
minetest.sound_play("default_break_glass.1", {
|
||||
if n ~= "air" then
|
||||
minetest.sound_play("default_break_glass", {
|
||||
pos = self.object:getpos(),
|
||||
max_hear_distance = 20,
|
||||
gain = 10.0,
|
||||
@ -1274,8 +1277,6 @@ minetest.register_entity("witchcraft:antigrav_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1284,12 +1285,12 @@ minetest.register_entity("witchcraft:jump_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:jump_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1305,11 +1306,8 @@ minetest.register_entity("witchcraft:jump_splash", {
|
||||
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:jump_splash" and n ~= "air" then
|
||||
|
||||
self.object:remove()
|
||||
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
|
||||
minetest.sound_play("default_break_glass.1", {
|
||||
if n ~= "air" then
|
||||
minetest.sound_play("default_break_glass", {
|
||||
pos = self.object:getpos(),
|
||||
max_hear_distance = 20,
|
||||
gain = 10.0,
|
||||
@ -1320,8 +1318,6 @@ minetest.register_entity("witchcraft:jump_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1330,12 +1326,12 @@ minetest.register_entity("witchcraft:murky_splash", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:murky_splash" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -1367,8 +1363,6 @@ minetest.register_entity("witchcraft:murky_splash", {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -1378,8 +1372,8 @@ minetest.register_entity("witchcraft:shadow_splash", {
|
||||
damage = 2,
|
||||
physical = true,
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(5, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(5, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
@ -1408,8 +1402,8 @@ minetest.register_entity("witchcraft:smoke_splash", {
|
||||
damage = 2,
|
||||
physical = true,
|
||||
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(10, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(10, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
@ -1431,101 +1425,121 @@ minetest.register_entity("witchcraft:smoke_splash", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_smoke.png" --texture
|
||||
)
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
--player effects
|
||||
|
||||
playereffects.register_effect_type("potion_speed_lv1", "High speed", nil, {"speed"},
|
||||
playereffects.register_effect_type("potion_speed_lv1", "High speed", nil, {"speed"},
|
||||
function(player)
|
||||
player:set_physics_override(2,nil,nil)
|
||||
--player:set_physics_override(2,nil,nil)
|
||||
player_physics.add(player, "speed", "potion_speed_lv1", 1)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,nil)
|
||||
--player:set_physics_override(1,nil,nil)
|
||||
player_physics.remove(player, "speed", "potion_speed_lv1")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_speed_lv2", "High speed", nil, {"speed"},
|
||||
playereffects.register_effect_type("potion_speed_lv2", "High speed", nil, {"speed"},
|
||||
function(player)
|
||||
player:set_physics_override(2.5,nil,nil)
|
||||
--player:set_physics_override(2.5,nil,nil)
|
||||
player_physics.add(player, "speed", "potion_speed_lv2", 1.5)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,nil)
|
||||
--player:set_physics_override(1,nil,nil)
|
||||
player_physics.remove(player, "speed", "potion_speed_lv2")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_jump_lvx", "High Jump", nil, {"jump"},
|
||||
playereffects.register_effect_type("potion_jump_lvx", "High Jump", nil, {"jump"},
|
||||
function(player)
|
||||
player:set_physics_override(nil,1.5,0.8)
|
||||
--player:set_physics_override(nil,1.5,0.8)
|
||||
player_physics.add(player, "jump", "potion_jump_lvx", 0.5)
|
||||
player_physics.add(player, "gravity", "potion_jump_lvx", -0.2)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(nil,1,1)
|
||||
--player:set_physics_override(nil,1,1)
|
||||
player_physics.remove(player, "jump", "potion_jump_lvx")
|
||||
player_physics.remove(player, "gravity", "potion_jump_lvx")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_antigrav_lvx", "Light weight", nil, {"gravity"},
|
||||
playereffects.register_effect_type("potion_antigrav_lvx", "Light weight", nil, {"gravity"},
|
||||
function(player)
|
||||
player:set_physics_override(nil,nil,0.1)
|
||||
--player:set_physics_override(nil,nil,0.1)
|
||||
player_physics.add(player, "gravity", "potion_antigrav_lvx", -0.9)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(nil,nil,1)
|
||||
--player:set_physics_override(nil,nil,1)
|
||||
player_physics.remove(player, "gravity", "potion_antigrav_lvx")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_slow_lv1", "Low speed", nil, {"speed"},
|
||||
playereffects.register_effect_type("potion_slow_lv1", "Low speed", nil, {"speed"},
|
||||
function(player)
|
||||
player:set_physics_override(0.5,nil,nil)
|
||||
--player:set_physics_override(0.5,nil,nil)
|
||||
player_physics.add(player, "speed", "potion_slow_lv1", -0.5)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,nil)
|
||||
--player:set_physics_override(1,nil,nil)
|
||||
player_physics.remove(player, "speed", "potion_slow_lv1")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_slow_lv2", "Low speed", nil, {"speed"},
|
||||
playereffects.register_effect_type("potion_slow_lv2", "Low speed", nil, {"speed"},
|
||||
function(player)
|
||||
player:set_physics_override(0.4,nil,nil)
|
||||
--player:set_physics_override(0.4,nil,nil)
|
||||
player_physics.add(player, "speed", "potion_slow_lv2", -0.6)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,nil)
|
||||
--player:set_physics_override(1,nil,nil)
|
||||
player_physics.remove(player, "speed", "potion_slow_lv2")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_swim_lv1", "Fast Swim", nil, {"swim"},
|
||||
playereffects.register_effect_type("potion_swim_lv1", "Fast Swim", nil, {"swim"},
|
||||
function(player)
|
||||
player:set_physics_override(3,nil,nil)
|
||||
--player:set_physics_override(3,nil,nil)
|
||||
player_physics.add(player, "speed", "potion_swim_lv1", 2)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,nil)
|
||||
--player:set_physics_override(1,nil,nil)
|
||||
player_physics.remove(player, "speed", "potion_swim_lv1")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_swim_lv2", "Dive", nil, {"swim"},
|
||||
playereffects.register_effect_type("potion_swim_lv2", "Dive", nil, {"swim"},
|
||||
function(player)
|
||||
player:set_physics_override(3,nil,4)
|
||||
--player:set_physics_override(3,nil,4)
|
||||
player_physics.add(player, "speed", "potion_swim_lv2", 2)
|
||||
player_physics.add(player, "gravity", "potion_swim_lv2", 3)
|
||||
end,
|
||||
|
||||
|
||||
function(effect, player)
|
||||
player:set_physics_override(1,nil,1)
|
||||
--player:set_physics_override(1,nil,1)
|
||||
player_physics.remove(player, "speed", "potion_swim_lv2")
|
||||
player_physics.remove(player, "gravity", "potion_swim_lv2")
|
||||
end,
|
||||
false
|
||||
)
|
||||
|
||||
playereffects.register_effect_type("potion_silver", "Fire resist", nil, {"fire_resist"},
|
||||
playereffects.register_effect_type("potion_silver", "Fire resist", nil, {"fire_resist"},
|
||||
function(player)
|
||||
local pos = player:getpos()
|
||||
local node = minetest.get_node(pos).name
|
||||
@ -1996,7 +2010,7 @@ minetest.register_node("witchcraft:potion_darkpurple", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_effect.png" --texture
|
||||
)
|
||||
|
||||
|
||||
-- take item
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
|
||||
@ -2083,7 +2097,7 @@ minetest.register_node("witchcraft:potion_darkpurple_2", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_effect.png" --texture
|
||||
)
|
||||
|
||||
|
||||
-- take item
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
|
||||
@ -2187,12 +2201,12 @@ minetest.register_entity("witchcraft:fire", {
|
||||
velocity = 0.1,
|
||||
damage = 2,
|
||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
on_step = function(self, obj, pos)
|
||||
local remove = minetest.after(2, function()
|
||||
self.object:remove()
|
||||
end)
|
||||
local pos = self.object:getpos()
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "witchcraft:fire" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
@ -2210,7 +2224,7 @@ minetest.register_entity("witchcraft:fire", {
|
||||
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
|
||||
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
|
||||
local n = minetest.env:get_node(p).name
|
||||
if n ~= "witchcraft:fire" and n ~= "air" and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
|
||||
if n ~= "witchcraft:fire" and n ~= "air" and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
|
||||
minetest.env:set_node(t, {name="fire:basic_flame"})
|
||||
elseif n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
|
||||
self.object:remove()
|
||||
@ -2255,7 +2269,7 @@ minetest.register_entity("witchcraft:fire", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_flame.png" --texture
|
||||
)
|
||||
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -2298,7 +2312,7 @@ minetest.register_node("witchcraft:potion_orange", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_flame.png" --texture
|
||||
)
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
@ -2342,7 +2356,7 @@ minetest.register_node("witchcraft:potion_orange_2", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_flame.png^[colorize:blue:200" --texture
|
||||
)
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
@ -2442,7 +2456,7 @@ minetest.register_node("witchcraft:potion_purple", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_smoke.png^[colorize:magenta:50" --texture
|
||||
)
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
@ -2522,7 +2536,7 @@ else
|
||||
itemstack:replace("vessels:glass_bottle")
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
|
||||
minetest.register_node("witchcraft:potion_gred", {
|
||||
description = "Hunger Potion (better with hunger mod)",
|
||||
drawtype = "plantlike",
|
||||
@ -2585,7 +2599,7 @@ minetest.register_node("witchcraft:potion_purple_2", {
|
||||
false, --collisiondetection
|
||||
"witchcraft_smoke.png^[colorize:magenta:50" --texture
|
||||
)
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end,
|
||||
@ -2943,7 +2957,7 @@ minetest.register_node("witchcraft:potion_aqua", {
|
||||
minetest.env:add_entity(pos, "experience:orb")
|
||||
minetest.env:add_entity(pos, "experience:orb")
|
||||
minetest.env:add_entity(pos, "experience:orb")
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end
|
||||
@ -2989,7 +3003,7 @@ minetest.register_node("witchcraft:potion_aqua", {
|
||||
minetest.add_item(pos, "default:gold_lump")
|
||||
minetest.add_item(pos, "farming:bread")
|
||||
minetest.add_item(pos, "default:copper_ingot")
|
||||
|
||||
|
||||
item:replace("vessels:glass_bottle")
|
||||
return item
|
||||
end
|
||||
@ -3705,7 +3719,7 @@ minetest.register_node("witchcraft:pentagram", {
|
||||
use_texture_alpha = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
light_source = 50,
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
@ -3748,7 +3762,7 @@ minetest.register_node("witchcraft:portal", {
|
||||
use_texture_alpha = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
light_source = 50,
|
||||
walkable = false,
|
||||
is_ground_content = true,
|
||||
|
Loading…
Reference in New Issue
Block a user