increase bob throw range, add worm time bonus, add lucky block
This commit is contained in:
parent
afc1f94430
commit
97f8f0c373
@ -6,7 +6,7 @@ Ethereal Mapgen mod for Minetest (works on all except v6)
|
|||||||
- https://forum.minetest.net/viewtopic.php?f=11&t=14638
|
- https://forum.minetest.net/viewtopic.php?f=11&t=14638
|
||||||
|
|
||||||
## Lucky Blocks
|
## Lucky Blocks
|
||||||
46
|
47
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
@ -19,6 +19,7 @@ Ethereal Mapgen mod for Minetest (works on all except v6)
|
|||||||
- Added smaller redwood trees, to grow large variety 2 saplings required
|
- Added smaller redwood trees, to grow large variety 2 saplings required
|
||||||
- Added Flight Potion (etherium dust arch, fire dust middle, empty bottle bottom)
|
- Added Flight Potion (etherium dust arch, fire dust middle, empty bottle bottom)
|
||||||
- Added new Fishing mechanics (inspired by Rootyjr's on mineclone2)
|
- Added new Fishing mechanics (inspired by Rootyjr's on mineclone2)
|
||||||
|
- Added fishing api to add new items- ethereal.add_item(fish, junk, bonus)
|
||||||
|
|
||||||
### 1.27
|
### 1.27
|
||||||
|
|
||||||
|
48
fishing.lua
48
fishing.lua
@ -25,13 +25,15 @@ local junk_items = {
|
|||||||
"default:stick",
|
"default:stick",
|
||||||
"farming:string",
|
"farming:string",
|
||||||
"ethereal:bamboo",
|
"ethereal:bamboo",
|
||||||
|
"default:papyrus",
|
||||||
"dye:black"
|
"dye:black"
|
||||||
}
|
}
|
||||||
|
|
||||||
local bonus_items = {
|
local bonus_items = {
|
||||||
"mobs:nametag",
|
"mobs:nametag",
|
||||||
"mobs:saddle",
|
"mobs:saddle",
|
||||||
"flowers:waterlily"
|
"flowers:waterlily",
|
||||||
|
"default:book"
|
||||||
}
|
}
|
||||||
|
|
||||||
local default_item = "default:dirt"
|
local default_item = "default:dirt"
|
||||||
@ -62,9 +64,7 @@ minetest.register_entity("ethereal:prebob_entity", {
|
|||||||
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
physical = false,
|
physical = false,
|
||||||
|
|
||||||
lastpos = {},
|
lastpos = {},
|
||||||
fisher = nil,
|
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
|
|
||||||
@ -78,7 +78,9 @@ minetest.register_entity("ethereal:prebob_entity", {
|
|||||||
|
|
||||||
-- remove if we hit something hard
|
-- remove if we hit something hard
|
||||||
if def and def.walkable then
|
if def and def.walkable then
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -87,10 +89,21 @@ minetest.register_entity("ethereal:prebob_entity", {
|
|||||||
|
|
||||||
--print("---water")
|
--print("---water")
|
||||||
|
|
||||||
|
-- do we have worms for bait, if so take one
|
||||||
|
local player = self.fisher and minetest.get_player_by_name(self.fisher)
|
||||||
|
local inv = player and player:get_inventory()
|
||||||
|
local bait = 0
|
||||||
|
|
||||||
|
if inv and inv:contains_item("main", "ethereal:worm") then
|
||||||
|
inv:remove_item("main", "ethereal:worm")
|
||||||
|
bait = 20
|
||||||
|
end
|
||||||
|
|
||||||
local obj = minetest.add_entity(self.lastpos, "ethereal:bob_entity")
|
local obj = minetest.add_entity(self.lastpos, "ethereal:bob_entity")
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
|
|
||||||
ent.player = self.fisher
|
ent.fisher = self.fisher
|
||||||
|
ent.bait = bait
|
||||||
|
|
||||||
minetest.sound_play("default_water_footstep", {
|
minetest.sound_play("default_water_footstep", {
|
||||||
pos = self.lastpos, gain = 0.1}, true)
|
pos = self.lastpos, gain = 0.1}, true)
|
||||||
@ -119,9 +132,9 @@ local use_rod = function(itemstack, player, pointed_thing)
|
|||||||
ent = objs[n]:get_luaentity()
|
ent = objs[n]:get_luaentity()
|
||||||
|
|
||||||
if ent
|
if ent
|
||||||
and ent.player
|
and ent.fisher
|
||||||
and (ent.name == "ethereal:prebob_entity" or ent.name == "ethereal:bob_entity")
|
and (ent.name == "ethereal:prebob_entity" or ent.name == "ethereal:bob_entity")
|
||||||
and player:get_player_name() == ent.player then
|
and player:get_player_name() == ent.fisher then
|
||||||
|
|
||||||
found = false
|
found = false
|
||||||
|
|
||||||
@ -195,7 +208,7 @@ local use_rod = function(itemstack, player, pointed_thing)
|
|||||||
-- place actual bob
|
-- place actual bob
|
||||||
local obj = minetest.add_entity(pos, "ethereal:prebob_entity")
|
local obj = minetest.add_entity(pos, "ethereal:prebob_entity")
|
||||||
|
|
||||||
obj:set_velocity({x = dir.x * 5, y = dir.y * 5, z = dir.z * 5})
|
obj:set_velocity({x = dir.x * 8, y = dir.y * 8, z = dir.z * 8})
|
||||||
obj:set_acceleration({x = dir.x * -3, y = -9.8, z = dir.z * -3})
|
obj:set_acceleration({x = dir.x * -3, y = -9.8, z = dir.z * -3})
|
||||||
obj:get_luaentity().fisher = player and player:get_player_name()
|
obj:get_luaentity().fisher = player and player:get_player_name()
|
||||||
end
|
end
|
||||||
@ -210,25 +223,23 @@ minetest.register_entity("ethereal:bob_entity", {
|
|||||||
physical = false,
|
physical = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
static_save = false,
|
static_save = false,
|
||||||
|
|
||||||
lastpos = {},
|
lastpos = {},
|
||||||
timer = 0,
|
timer = 0,
|
||||||
patience = nil,
|
patience = nil,
|
||||||
old_y = nil,
|
old_y = nil,
|
||||||
bob = false,
|
bob = false,
|
||||||
player = nil,
|
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
|
|
||||||
-- we need a name
|
-- we need a name
|
||||||
if self.player == nil or self.player == "" then
|
if self.fisher == nil or self.fisher == "" then
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local player = minetest.get_player_by_name(self.player)
|
local player = minetest.get_player_by_name(self.fisher)
|
||||||
|
|
||||||
-- we need an actual person
|
-- we need an actual person
|
||||||
if not player then
|
if not player then
|
||||||
@ -247,8 +258,7 @@ minetest.register_entity("ethereal:bob_entity", {
|
|||||||
local wield = player:get_wielded_item()
|
local wield = player:get_wielded_item()
|
||||||
|
|
||||||
-- we also need a rod to fish with
|
-- we also need a rod to fish with
|
||||||
if not wield
|
if not wield or wield:get_name() ~= "ethereal:fishing_rod" then
|
||||||
or minetest.get_item_group(wield:get_name(), "ethereal_rod") <= 0 then
|
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
@ -299,9 +309,11 @@ minetest.register_entity("ethereal:bob_entity", {
|
|||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- choose random time to wait
|
-- choose random time to wait (minus bait time for worm)
|
||||||
if not self.patience or self.patience <= 0 then
|
if not self.patience or self.patience <= 0 then
|
||||||
self.patience = random(10, 45)
|
|
||||||
|
self.patience = random(10, (45 - self.bait))
|
||||||
|
self.bait = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add particles if bobber bobbing
|
-- add particles if bobber bobbing
|
||||||
@ -355,6 +367,7 @@ minetest.register_entity("ethereal:bob_entity", {
|
|||||||
local remove_bob = function(player)
|
local remove_bob = function(player)
|
||||||
|
|
||||||
local objs = minetest.get_objects_inside_radius(player:get_pos(), 25)
|
local objs = minetest.get_objects_inside_radius(player:get_pos(), 25)
|
||||||
|
local name = player:get_player_name()
|
||||||
local ent
|
local ent
|
||||||
|
|
||||||
for n = 1, #objs do
|
for n = 1, #objs do
|
||||||
@ -365,7 +378,8 @@ local remove_bob = function(player)
|
|||||||
and (ent.name == "ethereal:prebob_entity"
|
and (ent.name == "ethereal:prebob_entity"
|
||||||
or ent.name == "ethereal:bob_entity") then
|
or ent.name == "ethereal:bob_entity") then
|
||||||
|
|
||||||
if ent.player or ent.fisher then
|
-- only remove players own bob
|
||||||
|
if ent.fisher and ent.fisher == name then
|
||||||
ent.object:remove()
|
ent.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -388,7 +402,7 @@ end)
|
|||||||
-- fishing rod
|
-- fishing rod
|
||||||
minetest.register_tool("ethereal:fishing_rod", {
|
minetest.register_tool("ethereal:fishing_rod", {
|
||||||
description = S("Fishing Rod (USE to cast and again when the time is right)"),
|
description = S("Fishing Rod (USE to cast and again when the time is right)"),
|
||||||
groups = {tool = 1, ethereal_rod = 1},
|
groups = {tool = 1},
|
||||||
inventory_image = "ethereal_fishing_rod.png",
|
inventory_image = "ethereal_fishing_rod.png",
|
||||||
wield_image = "ethereal_fishing_rod.png^[transformFX",
|
wield_image = "ethereal_fishing_rod.png^[transformFX",
|
||||||
wield_scale = {x = 1.5, y = 1.5, z = 1},
|
wield_scale = {x = 1.5, y = 1.5, z = 1},
|
||||||
|
@ -73,6 +73,21 @@ lucky_block:add_blocks({
|
|||||||
{"flo", 5, {"ethereal:blue_marble_tile"}, 2},
|
{"flo", 5, {"ethereal:blue_marble_tile"}, 2},
|
||||||
{"dro", {"ethereal:blue_marble", "ethereal:blue_marble_tile"}, 8},
|
{"dro", {"ethereal:blue_marble", "ethereal:blue_marble_tile"}, 8},
|
||||||
{"dro", {"ethereal:etherium_ore"}, 5},
|
{"dro", {"ethereal:etherium_ore"}, 5},
|
||||||
|
{"nod", "default:chest", 0, {
|
||||||
|
{name = "ethereal:fish_bluefin", max = 7},
|
||||||
|
{name = "ethereal:fish_blueram", max = 7},
|
||||||
|
{name = "ethereal:fish_catfish", max = 7},
|
||||||
|
{name = "ethereal:fish_clownfish", max = 7},
|
||||||
|
{name = "ethereal:fish_pike", max = 7},
|
||||||
|
{name = "ethereal:fish_flathead", max = 7},
|
||||||
|
{name = "ethereal:fish_plaice", max = 7},
|
||||||
|
{name = "ethereal:fish_pufferfish", max = 5},
|
||||||
|
{name = "ethereal:fish_redsnapper", max = 7},
|
||||||
|
{name = "ethereal:fish_salmon", max = 7},
|
||||||
|
{name = "ethereal:fish_chichlid", max = 7},
|
||||||
|
{name = "ethereal:fishing_rod", max = 1},
|
||||||
|
{name = "ethereal:worm", max = 10},
|
||||||
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("3d_armor") then
|
if minetest.get_modpath("3d_armor") then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user