Update potions and vessels

master
MoNTE48 2019-06-04 10:27:42 +02:00
parent 1c00b33fef
commit 343f40e2f7
33 changed files with 58 additions and 72 deletions

View File

@ -160,7 +160,6 @@ mobs:register_arrow("mobs_animal:egg_entity", {
-- egg throwing item
local egg_GRAVITY = 9
local egg_VELOCITY = 19
-- shoot egg
@ -194,7 +193,7 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
obj:set_acceleration({
x = dir.x * -3,
y = -egg_GRAVITY,
y = -9.81,
z = dir.z * -3
})

View File

@ -10,60 +10,40 @@ local ppa = minetest.get_modpath("playerphysics")
pep = {}
function pep.register_potion(potiondef)
local on_use
if(potiondef.effect_type ~= nil) then
on_use = function(itemstack, user, pointed_thing)
-- Particles
minetest.add_particlespawner({
amount = 40,
time = 0.1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x = -1, y = 1, z = -1},
maxvel = {x = 1, y = 2, z = 1},
minacc = {x = 0, y = -5, z = 0},
maxacc = {x = 0, y = -9, z = 0},
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 3,
collisiondetection = false,
vertical = false,
texture = "pep_"..potiondef.basename..".png",
})
on_use = function(itemstack, user, pointed_thing)
-- Particles
minetest.add_particlespawner({
amount = 30,
time = 0.1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x = -1, y = 1, z = -1},
maxvel = {x = 1, y = 2, z = 1},
minacc = {x = 0, y = -5, z = 0},
maxacc = {x = 0, y = -9, z = 0},
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 2,
collisiondetection = false,
vertical = false,
texture = "pep_"..potiondef.basename.."_particle.png",
})
if(potiondef.effect_type ~= nil) then
playereffects.apply_effect_type(potiondef.effect_type, potiondef.duration, user)
itemstack:take_item()
return itemstack
end
else
on_use = function(itemstack, user, pointed_thing)
-- Particles
minetest.add_particlespawner({
amount = 40,
time = 0.1,
minpos = pointed_thing.above,
maxpos = pointed_thing.above,
minvel = {x = -1, y = 1, z = -1},
maxvel = {x = 1, y = 2, z = 1},
minacc = {x = 0, y = -5, z = 0},
maxacc = {x = 0, y = -9, z = 0},
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 3,
collisiondetection = false,
vertical = false,
texture = "pep_"..potiondef.basename..".png",
})
else
itemstack:take_item()
return itemstack
end
return itemstack
end
minetest.register_craftitem("pep:"..potiondef.basename, {
description = string.format(S("Glass Bottle (%s)"), potiondef.contentstring),
_doc_items_longdesc = potiondef.longdesc,
_doc_items_usagehelp = S("Hold it in your hand, then left-click to drink it."),
inventory_image = "pep_"..potiondef.basename..".png^[mask:pep_glass_bottle_overlay.png",
wield_image = "pep_"..potiondef.basename..".png^[mask:pep_glass_bottle_overlay.png",
inventory_image = "pep_"..potiondef.basename..".png",
wield_image = "pep_"..potiondef.basename..".png",
on_use = on_use,
groups = {vessel = 1},
})
@ -350,7 +330,7 @@ if(minetest.get_modpath("default")~=nil) then
type = "shapeless",
output = "pep:breath",
recipe = { "default:papyrus", "default:papyrus", "default:papyrus", "default:papyrus",
"default:papyrus", "default:papyrus", "default:papyrus", "default:papyrus", "vessels:glass_bottle" }
"default:papyrus", "default:papyrus", "default:papyrus", "default:papyrus", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
@ -361,8 +341,8 @@ if(minetest.get_modpath("default")~=nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:jumpplus",
recipe = { "flowers:flower_tulip", "default:grass_1", "default:mese_crystal_fragment",
"default:mese_crystal_fragment", "vessels:glass_bottle" }
recipe = { "flowers:tulip", "default:grass_1", "mesecons:wire_00000000_off_fragment",
"mesecons:wire_00000000_off_fragment", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
@ -388,12 +368,12 @@ if(minetest.get_modpath("default")~=nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:jumpminus",
recipe = { "default:leaves", "default:jungleleaves", "default:iron_lump", "flowers:dandelion_yellow", "vessels:glass_bottle" }
recipe = { "default:leaves", "default:jungleleaves", "default:iron_lump", "flowers:oxeye_daisy", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
output = "pep:grav0",
recipe = { "default:mese_crystal", "vessels:glass_bottle" }
recipe = { "mesecons:wire_00000000_off", "vessels:glass_bottle" }
})
minetest.register_craft({
type = "shapeless",
@ -410,7 +390,7 @@ if(minetest.get_modpath("flowers") ~= nil) then
minetest.register_craft({
type = "shapeless",
output = "pep:speedplus",
recipe = { "default:pine_sapling", "default:cactus", "flowers:dandelion_yellow", "default:junglegrass", "vessels:glass_bottle" }
recipe = { "default:pine_sapling", "default:cactus", "flowers:oxeye_daisy", "default:junglegrass", "vessels:glass_bottle" }
})
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 755 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 B

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

View File

@ -33,10 +33,13 @@ playereffects.last_effect_id = 0
Settings for Player Effects
]]
-- Wheather to use the HUD to expose the active effects to players (true or false)
-- Whether to use the HUD to expose the active effects to players (true or false)
playereffects.use_hud = true
-- Wheather to use autosave (true or false)
-- Whether to use save (true, false or minetest.is_singleplayer())
playereffects.save = minetest.is_singleplayer()
-- Whether to use autosave (true or false)
playereffects.use_autosave = false
-- The time interval between autosaves, in seconds (only used when use_autosave is true)
@ -45,20 +48,22 @@ playereffects.autosave_time = 10
--[=[ Load inactive_effects and last_effect_id from playereffects, if this file exists ]=]
do
local filepath = minetest.get_worldpath().."/playereffects"
local file = io.open(filepath, "r")
if file then
minetest.log("action", "[playereffects] playereffects opened.")
local string = file:read()
io.close(file)
if(string ~= nil) then
local savetable = minetest.deserialize(string)
playereffects.inactive_effects = savetable.inactive_effects
minetest.debug("[playereffects] playereffects successfully read.")
minetest.debug("[playereffects] inactive_effects = "..dump(playereffects.inactive_effects))
playereffects.last_effect_id = savetable.last_effect_id
minetest.debug("[playereffects] last_effect_id = "..dump(playereffects.last_effect_id))
if playereffects.save then
local filepath = minetest.get_worldpath().."/playereffects"
local file = io.open(filepath, "r")
if file then
minetest.log("action", "[playereffects] playereffects opened.")
local string = file:read()
io.close(file)
if(string ~= nil) then
local savetable = minetest.deserialize(string)
playereffects.inactive_effects = savetable.inactive_effects
minetest.debug("[playereffects] playereffects successfully read.")
minetest.debug("[playereffects] inactive_effects = "..dump(playereffects.inactive_effects))
playereffects.last_effect_id = savetable.last_effect_id
minetest.debug("[playereffects] last_effect_id = "..dump(playereffects.last_effect_id))
end
end
end
end
@ -391,8 +396,10 @@ minetest.register_on_leaveplayer(function(player)
end)
minetest.register_on_shutdown(function()
minetest.log("action", "[playereffects] Server shuts down. Rescuing data into playereffects")
playereffects.save_to_file()
if playereffects.save then
minetest.log("action", "[playereffects] Server shuts down. Rescuing data into playereffects")
playereffects.save_to_file()
end
end)
minetest.register_on_joinplayer(function(player)
@ -508,7 +515,7 @@ function playereffects.hud_effect(effect_type_id, player, pos, time_left, repeat
scale = { x = 1, y = 1 },
position = { x = 1, y = 0.3 },
name = "effect_icon_"..effect_type_id,
text = playereffects.effect_types[effect_type_id].icon.."^[mask:pep_glass_bottle_overlay.png",
text = playereffects.effect_types[effect_type_id].icon,
alignment = { x = -1, y=0 },
direction = 0,
offset = { x = -186, y = pos*20 },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 1.4 KiB