Complete transition & upgrade
|
@ -0,0 +1,7 @@
|
||||||
|
Bees
|
||||||
|
=====================================================================
|
||||||
|
Main: bass080
|
||||||
|
Lisc: WTFPL
|
||||||
|
Text: CC0
|
||||||
|
By Tirifto
|
||||||
|
Link: https://github.com/bas080/bees
|
|
@ -0,0 +1,62 @@
|
||||||
|
1,53c1,7
|
||||||
|
< BEES MOD V2.2
|
||||||
|
< -------------
|
||||||
|
<
|
||||||
|
< FEATURES
|
||||||
|
< --------
|
||||||
|
< 3.0
|
||||||
|
< - Pipeworks compatibility (Industrial beehive)
|
||||||
|
< - Get honey comb from full frame
|
||||||
|
<
|
||||||
|
< 2.2.1
|
||||||
|
< - removed steel dependency temporarily
|
||||||
|
< - fixed the craft for the extractor (and added alias for)
|
||||||
|
<
|
||||||
|
< 2.2
|
||||||
|
< - craft for extractor
|
||||||
|
< - extractor texture update
|
||||||
|
< - a craft for the smoker
|
||||||
|
<
|
||||||
|
< 2.1
|
||||||
|
< - bees polinate flowers nearby, causing them to multiply
|
||||||
|
< - add formspec to wild and artificial hive when using grafting tool
|
||||||
|
< - smoke, flying wax and bee particles
|
||||||
|
< - smokers to calm down the bees before opening the hive
|
||||||
|
< - a centrifuge to extract the honey and from the filled frames
|
||||||
|
< - grab eatable honeycomb from wild hives
|
||||||
|
< - craft a grafting tool to extract queen bees from wild hives
|
||||||
|
< - craft artificial hives and frames
|
||||||
|
<
|
||||||
|
< 1.0
|
||||||
|
< - spawn wild bee hives on tree leaves
|
||||||
|
< - use the queen bee to populate artificial hives
|
||||||
|
< - plant flowers near hives to increase their productivity
|
||||||
|
< - spawning bee colonies
|
||||||
|
<
|
||||||
|
< FUTURE
|
||||||
|
< ------
|
||||||
|
< - more realistic spawning of wild bee hives
|
||||||
|
<
|
||||||
|
< CONTRIBUTORS
|
||||||
|
< ------------
|
||||||
|
< - bas080
|
||||||
|
< - VanessaE (wild bee hive nodebox)
|
||||||
|
< - Neuromancer (textures for wild bee hive and inspiration for other textures)
|
||||||
|
< - Novatux (enabled pipeworks compatibility)
|
||||||
|
<
|
||||||
|
< FORUM
|
||||||
|
< -----
|
||||||
|
< https://forum.minetest.net/viewtopic.php?pid=102905
|
||||||
|
<
|
||||||
|
< LICENSE
|
||||||
|
< -------
|
||||||
|
< - codes is WTFPL
|
||||||
|
< - textures are CC BY-SA
|
||||||
|
---
|
||||||
|
> Bees
|
||||||
|
> =====================================================================
|
||||||
|
> Main: bass080
|
||||||
|
> Lisc: WTFPL
|
||||||
|
> Text: CC0
|
||||||
|
> By Tirifto
|
||||||
|
> Link: https://github.com/bas080/bees
|
After Width: | Height: | Size: 110 B |
After Width: | Height: | Size: 124 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 117 B |
After Width: | Height: | Size: 200 B |
After Width: | Height: | Size: 202 B |
After Width: | Height: | Size: 336 B |
|
@ -0,0 +1,7 @@
|
||||||
|
Craftguide
|
||||||
|
=====================================================================
|
||||||
|
Main: killbith
|
||||||
|
Lisc: GPL v3
|
||||||
|
Text: WTFPL
|
||||||
|
By Gambit
|
||||||
|
Link: https://github.com/minetest-mods/craftguide
|
|
@ -0,0 +1,23 @@
|
||||||
|
1,14c1,7
|
||||||
|
< ## ![Preview1](http://i.imgur.com/fIPNYkb.png) Crafting Guide ##
|
||||||
|
<
|
||||||
|
< #### A Crafting Guide for Minetest that doesn't suck. ####
|
||||||
|
<
|
||||||
|
< #### `craftguide` is simply the most comprehensive mod of his category, with the cleanest code. ####
|
||||||
|
< #### Consult the [Minetest Wiki](http://wiki.minetest.net/Crafting_guide) for more details and comparisons. ####
|
||||||
|
<
|
||||||
|
< #### This crafting guide is usable with a blue book named *"Crafting Guide"*. ####
|
||||||
|
<
|
||||||
|
< #### This crafting guide features two modes : Standard and Progressive. ####
|
||||||
|
< The Progressive mode is a Terraria-like system that only shows recipes you can craft from items in inventory.
|
||||||
|
< The progressive mode can be enabled with `craftguide_progressive_mode = true` in `minetest.conf`.
|
||||||
|
<
|
||||||
|
< ![Preview2](http://i.imgur.com/3q7rVSo.png)
|
||||||
|
---
|
||||||
|
> Craftguide
|
||||||
|
> =====================================================================
|
||||||
|
> Main: killbith
|
||||||
|
> Lisc: GPL v3
|
||||||
|
> Text: WTFPL
|
||||||
|
> By Gambit
|
||||||
|
> Link: https://github.com/minetest-mods/craftguide
|
|
@ -0,0 +1,7 @@
|
||||||
|
Fences
|
||||||
|
=====================================================================
|
||||||
|
Main: BlockMen
|
||||||
|
Lisc: WTFPL v2
|
||||||
|
Text: CC0
|
||||||
|
By Tirifto
|
||||||
|
Link: https://forum.minetest.net/viewtopic.php?f=11&t=5016
|
|
@ -0,0 +1,37 @@
|
||||||
|
1,27c1,7
|
||||||
|
< Minetest mod "Fences"
|
||||||
|
< =======================
|
||||||
|
< version: 1.0
|
||||||
|
<
|
||||||
|
< License of source code and textures:
|
||||||
|
< ------------------------------------
|
||||||
|
< Written 2013 by BlockMen
|
||||||
|
<
|
||||||
|
< This program is free software. It comes without any warranty, to
|
||||||
|
< the extent permitted by applicable law. You can redistribute it
|
||||||
|
< and/or modify it under the terms of the Do What The Fuck You Want
|
||||||
|
< To Public License, Version 2, as published by Sam Hocevar. See
|
||||||
|
< http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||||
|
<
|
||||||
|
<
|
||||||
|
<
|
||||||
|
<
|
||||||
|
<
|
||||||
|
< --USING the mod--
|
||||||
|
<
|
||||||
|
< This mod "overrides" the recipe for the default fence, so if you want craft a fance, it crafts THIS fence.
|
||||||
|
<
|
||||||
|
< If you want replace already placed default fences open the "init.lua" (in this directory) and change
|
||||||
|
< the first line to "local override_original = true". Then all placed default fences will be replaced with
|
||||||
|
< this fence.
|
||||||
|
<
|
||||||
|
< It is not possible to jump over the Fence or the closed Fencegate. Only exception is when you "sneak" and "jump".
|
||||||
|
\ No newline at end of file
|
||||||
|
---
|
||||||
|
> Fences
|
||||||
|
> =====================================================================
|
||||||
|
> Main: BlockMen
|
||||||
|
> Lisc: WTFPL v2
|
||||||
|
> Text: CC0
|
||||||
|
> By Tirifto
|
||||||
|
> Link: https://forum.minetest.net/viewtopic.php?f=11&t=5016
|
After Width: | Height: | Size: 116 B |
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
## Minetest Fishing Mod
|
||||||
|
|
||||||
|
### Original by Mossmanikin https://github.com/Mossmanikin/fishing
|
||||||
|
### Rewrited by Crabman77 (MFF team)
|
||||||
|
|
||||||
|
### **9 fish type**
|
||||||
|
**fish in rivers**
|
||||||
|
> - 2 small fish (fish, carp)
|
||||||
|
> - 3 predator fish (perch, catfish, Northern Pike)
|
||||||
|
|
||||||
|
**fish in sea**
|
||||||
|
> - 3 small fish (clownfish,bluewhite fish, exotic fish)
|
||||||
|
> - 1 predator fish (small shark)
|
||||||
|
|
||||||
|
|
||||||
|
3 kind of bait for small fish (corn, bread, worm)
|
||||||
|
4 kind of bait for predator fish (small fish)
|
||||||
|
2 poles, wood 30 uses and mithril 1500 uses
|
||||||
|
The baits have a variable luck(15% to 80%) changed between 30 minutes to 6 hours for a better gameplay
|
||||||
|
Baitball improves lucky bait of 20%
|
||||||
|
|
||||||
|
### **Contest Game **
|
||||||
|
Contest game can be launched by admin, duration variable 2min to 4heures
|
||||||
|
Start/End is announced in chat and sound
|
||||||
|
A ranking appears(formspec) after contest
|
||||||
|
|
||||||
|
Adjustable settings in formspec
|
||||||
|
if the unified_inventory mod is actived there is a button for classification or settings for the admin only
|
||||||
|
|
||||||
|
|
||||||
|
## **schedule**
|
||||||
|
### **Chatcommand**
|
||||||
|
**contest_show**
|
||||||
|
**contest_stop**
|
||||||
|
**contest_del number(view with contest_show)**
|
||||||
|
**contest_start duration(in seconds)**
|
||||||
|
> - contest_start 3600
|
||||||
|
|
||||||
|
**contest_add wday hour minutes duration**
|
||||||
|
> - contest_add 0 15 30 3600
|
||||||
|
> - Wday 0=all, 1=sunday, 2=Monday, ..., 7=Saturday
|
||||||
|
|
||||||
|
[demo video youtube](https://youtu.be/8rt8g3F2Gmk)
|
||||||
|
|
||||||
|
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/07/01/1507010157379539613411965.png)
|
||||||
|
|
||||||
|
####Trophy and fish type
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/09/26//1509260649029539613611795.jpg)
|
||||||
|
#### Admin can look bait chance
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/09/26//1509260648599539613611793.jpg)
|
||||||
|
### admin menu
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/09/26//1509260649019539613611794.jpg)
|
||||||
|
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157389539613411968.png)
|
||||||
|
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157379539613411966.png)
|
||||||
|
####formspec contest ranking
|
||||||
|
![fishing]( http://nsm08.casimages.com/img/2015/09/26//1509260648579539613611792.jpg)
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
-- baitball
|
||||||
|
minetest.register_craftitem("fishing:baitball", {
|
||||||
|
description = fishing_setting.func.S("Bait Ball"),
|
||||||
|
inventory_image = "fishing_baitball.png",
|
||||||
|
stack_max = 99,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "fishing:baitball 20",
|
||||||
|
recipe = {"farming:flour", "farming:corn", "bucket:bucket_water"},
|
||||||
|
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- baitball_shark
|
||||||
|
minetest.register_craftitem("fishing:baitball_shark", {
|
||||||
|
description = fishing_setting.func.S("Shark Bait Ball"),
|
||||||
|
inventory_image = "fishing_baitball_shark.png",
|
||||||
|
stack_max = 99,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "fishing:baitball_shark 20",
|
||||||
|
recipe = {"group:fishbait", "group:fishbait"}
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
--fish bait
|
||||||
|
--bait_corn
|
||||||
|
minetest.register_craftitem("fishing:bait_corn", {
|
||||||
|
description = fishing_setting.func.S("Bait Corn"),
|
||||||
|
inventory_image = "fishing_bait_corn.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
fishing_setting.baits["fishing:bait_corn"] = { ["bait"] = "fishing:bait_corn", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_corn.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
--bait_bread
|
||||||
|
minetest.register_craftitem("fishing:bait_bread", {
|
||||||
|
description = fishing_setting.func.S("Bait Bread"),
|
||||||
|
inventory_image = "fishing_bait_bread.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
fishing_setting.baits["fishing:bait_bread"] = { ["bait"] = "fishing:bait_bread", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_bread.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
--bait_worm
|
||||||
|
fishing_setting.baits["fishing:bait_worm"] = { ["bait"] = "fishing:bait_worm", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_worm.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
--shark bait
|
||||||
|
--bait_fish
|
||||||
|
fishing_setting.baits["fishing:fish_raw"] = { ["bait"] = "fishing:fish_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_fish_raw.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
fishing_setting.baits["fishing:clownfish_raw"] = { ["bait"] = "fishing:clownfish_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_clownfish_raw.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
fishing_setting.baits["fishing:bluewhite_raw"] = { ["bait"] = "fishing:bluewhite_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_bluewhite_raw.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
fishing_setting.baits["fishing:exoticfish_raw"] = { ["bait"] = "fishing:exoticfish_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_exoticfish_raw.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
-- to mob_fish modpack
|
||||||
|
if (minetest.get_modpath("mobs_fish")) then
|
||||||
|
fishing_setting.baits["mobs_fish:clownfish"] = { ["bait"] = "mobs_fish:clownfish", ["bobber"] = "fishing:bobber_shark_entity", ["hungry"] = 50 }
|
||||||
|
fishing_setting.baits["mobs_fish:tropical"] = { ["bait"] = "mobs_fish:tropical", ["bobber"] = "fishing:bobber_shark_entity", ["hungry"] = 50 }
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,230 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77's version - Bobber
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Bobber 0.1.7
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-- Contains code from: fishing (original), mobs, throwing, volcano
|
||||||
|
-- Supports: 3d_armor, animal_clownfish, animal_fish_blue_white, animal_rat, flowers_plus, mobs, seaplants
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- bobber
|
||||||
|
minetest.register_node("fishing:bobber_box", {
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
-- { left, bottom, front, right, top , back}
|
||||||
|
{-8/16, -8/16, 0, 8/16, 8/16, 0}, -- feathers
|
||||||
|
{-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tiles = {
|
||||||
|
"fishing_bobber_top.png",
|
||||||
|
"fishing_bobber_bottom.png",
|
||||||
|
"fishing_bobber.png",
|
||||||
|
"fishing_bobber.png",
|
||||||
|
"fishing_bobber.png",
|
||||||
|
"fishing_bobber.png^[transformFX"
|
||||||
|
},
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local FISHING_BOBBER_ENTITY={
|
||||||
|
physical = true,
|
||||||
|
timer = 0,
|
||||||
|
visual = "wielditem",
|
||||||
|
visual_size = {x=1/3, y=1/3, z=1/3},
|
||||||
|
textures = {"fishing:bobber_box"},
|
||||||
|
-- {left ,bottom, front, right, top , back}
|
||||||
|
collisionbox = {-2/16, -4/16, -2/16, 2/16, 2/16, 2/16},
|
||||||
|
randomtime = 50,
|
||||||
|
baitball = 0,
|
||||||
|
prize = "",
|
||||||
|
bait = "",
|
||||||
|
owner = nil,
|
||||||
|
old_pos = nil,
|
||||||
|
old_pos2 = nil,
|
||||||
|
|
||||||
|
|
||||||
|
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||||
|
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||||
|
if not puncher:is_player() then return end
|
||||||
|
local player_name = puncher:get_player_name()
|
||||||
|
if player_name ~= self.owner then return end
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("You didn't catch anything."), false)
|
||||||
|
end
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("The bait is still there."), false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- make sound and remove bobber
|
||||||
|
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
|
||||||
|
self.object:remove()
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
|
||||||
|
on_rightclick = function (self, clicker)
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
local player_name = clicker:get_player_name()
|
||||||
|
if not player_name or not self.owner then
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local inv = clicker:get_inventory()
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local item_name = item:get_name()
|
||||||
|
|
||||||
|
if string.find(item_name, "fishing:pole_") ~= nil then
|
||||||
|
if player_name ~= self.owner then return end
|
||||||
|
if self.prize ~= "" then
|
||||||
|
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then -- fish escaped
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local name = self.prize[1]..":"..self.prize[2]
|
||||||
|
local desc = self.prize[4]
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false)
|
||||||
|
end
|
||||||
|
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||||
|
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
||||||
|
if inv:room_for_item("main", {name=name, count=1, wear=wear_value, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=name, count=1, wear=wear_value, metadata=""})
|
||||||
|
else
|
||||||
|
minetest.spawn_item(clicker:getpos(), {name=name, count=1, wear=wear_value, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- weither player has fishing pole or not
|
||||||
|
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
|
||||||
|
self.object:remove()
|
||||||
|
|
||||||
|
elseif item_name == "fishing:baitball" then
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
inv:remove_item("main", "fishing:baitball")
|
||||||
|
end
|
||||||
|
self.baitball = 20
|
||||||
|
--addparticle
|
||||||
|
minetest.add_particlespawner(30, 0.5, -- for how long (?) -- Particles on splash
|
||||||
|
{x=pos.x,y=pos.y-0.0625,z=pos.z}, {x=pos.x,y=pos.y,z=pos.z}, -- position min, pos max
|
||||||
|
{x=-2,y=-0.0625,z=-2}, {x=2,y=3,z=2}, -- velocity min, vel max
|
||||||
|
{x=0,y=-9.8,z=0}, {x=0,y=-9.8,z=0},
|
||||||
|
0.3, 1.2,
|
||||||
|
0.25, 0.5, -- min size, max size
|
||||||
|
false, "fishing_particle_baitball.png")
|
||||||
|
-- add sound
|
||||||
|
minetest.sound_play("fishing_baitball", {pos = self.object:getpos(), gain = 0.2, })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
--remove if no owner, no player, owner no in bobber_view_range
|
||||||
|
if self.owner == nil then self.object:remove(); return end
|
||||||
|
--remove if not node water
|
||||||
|
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-0.5, z=pos.z})
|
||||||
|
if not node or string.find(node.name, "water_source") == nil then
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(self.owner, fishing_setting.func.S("Haha, Fishing is prohibited outside water!"))
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local player = minetest.get_player_by_name(self.owner)
|
||||||
|
if not player then self.object:remove(); return end
|
||||||
|
local p = player:getpos()
|
||||||
|
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
||||||
|
if dist > fishing_setting.settings["bobber_view_range"] then
|
||||||
|
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--rotate bobber
|
||||||
|
if math.random(1, 4) == 1 then
|
||||||
|
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
|
||||||
|
end
|
||||||
|
|
||||||
|
self.timer = self.timer + 1
|
||||||
|
if self.timer < self.randomtime then
|
||||||
|
-- if fish or others items, move bobber to simulate fish on the line
|
||||||
|
if self.prize ~= "" and math.random(1,3) == 1 then
|
||||||
|
if self.old_pos2 == true then
|
||||||
|
pos.y = pos.y-0.0280
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
self.old_pos2 = false
|
||||||
|
else
|
||||||
|
pos.y = pos.y+0.0280
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
self.old_pos2 = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--change item on line
|
||||||
|
self.timer = 0
|
||||||
|
if self.prize ~= "" and fishing_setting.have_true_fish and fishing_setting.prizes["true_fish"]["little"][self.prize[1]..":"..self.prize[2]] then
|
||||||
|
minetest.add_entity({x=pos.x, y=pos.y-1, z=pos.z}, self.prize[1]..":"..self.prize[2])
|
||||||
|
end
|
||||||
|
self.prize = ""
|
||||||
|
self.object:moveto(self.old_pos, false)
|
||||||
|
--Once the fish are not hungry :), baitball increase hungry + 20%
|
||||||
|
if math.random(1, 100) > fishing_setting.baits[self.bait]["hungry"] + self.baitball then
|
||||||
|
--Fish not hungry !(
|
||||||
|
self.randomtime = math.random(20,60)*10
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.randomtime = math.random(1,5)*10
|
||||||
|
if math.random(1, 100) <= fishing_setting.settings["fish_chance"] then
|
||||||
|
if self.water_type and self.water_type == "sea" then
|
||||||
|
self.prize = fishing_setting.prizes["sea"]["little"][math.random(1,#fishing_setting.prizes["sea"]["little"])]
|
||||||
|
else
|
||||||
|
self.prize = fishing_setting.prizes["rivers"]["little"][math.random(1,#fishing_setting.prizes["rivers"]["little"])]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- to mobs_fish modpack
|
||||||
|
if fishing_setting.have_true_fish then
|
||||||
|
local objs = minetest.get_objects_inside_radius({x=pos.x, y=pos.y-1, z=pos.z}, 1)
|
||||||
|
for _, obj in pairs(objs) do
|
||||||
|
if obj:get_luaentity() ~= nil then
|
||||||
|
local name = obj:get_luaentity().name
|
||||||
|
if fishing_setting.prizes["true_fish"]["little"][name] then
|
||||||
|
self.prize = fishing_setting.prizes["true_fish"]["little"][name]
|
||||||
|
obj:remove()
|
||||||
|
self.randomtime = math.random(3,7)*10
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif math.random(1, 100) <= 10 then
|
||||||
|
self.prize = fishing_setting.func.get_loot()
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.prize ~= "" then
|
||||||
|
pos.y = self.old_pos.y-0.1
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_entity("fishing:bobber_fish_entity", FISHING_BOBBER_ENTITY)
|
|
@ -0,0 +1,234 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77 version - Bobber Shark
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Bobber Shark 0.0.6
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- bobber shark
|
||||||
|
minetest.register_node("fishing:bobber_shark_box", {
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
-- { left, bottom, front, right, top , back}
|
||||||
|
{-8/16, -8/16, 0, 8/16, 8/16, 0}, -- feathers
|
||||||
|
{-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tiles = {
|
||||||
|
"fishing_bobber_top.png",
|
||||||
|
"fishing_bobber_bottom.png",
|
||||||
|
"fishing_bobber_shark.png",
|
||||||
|
"fishing_bobber_shark.png",
|
||||||
|
"fishing_bobber_shark.png",
|
||||||
|
"fishing_bobber_shark.png^[transformFX"
|
||||||
|
},
|
||||||
|
groups = {not_in_creative_inventory=1},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local FISHING_BOBBER_SHARK_ENTITY={
|
||||||
|
physical = true,
|
||||||
|
timer = 0,
|
||||||
|
visual = "wielditem",
|
||||||
|
visual_size = {x=1/3, y=1/3, z=1/3},
|
||||||
|
textures = {"fishing:bobber_shark_box"},
|
||||||
|
-- {left ,bottom, front, right, top , back}
|
||||||
|
collisionbox = {-3/16, -4/16, -3/16, 3/16, 4/16, 3/16},
|
||||||
|
randomtime = 50,
|
||||||
|
baitball = 0,
|
||||||
|
prize = "",
|
||||||
|
bait = "",
|
||||||
|
owner = nil,
|
||||||
|
old_pos = nil,
|
||||||
|
old_pos2 = nil,
|
||||||
|
|
||||||
|
|
||||||
|
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||||
|
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||||
|
if not puncher:is_player() then return end
|
||||||
|
local player_name = puncher:get_player_name()
|
||||||
|
if player_name ~= self.owner then return end
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("You didn't catch anything."), false)
|
||||||
|
end
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
local inv = puncher:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("The bait is still there."), false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- make sound and remove bobber
|
||||||
|
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
|
||||||
|
self.object:remove()
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
|
||||||
|
on_rightclick = function (self, clicker)
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
local player_name = clicker:get_player_name()
|
||||||
|
if not player_name or not self.owner then
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local inv = clicker:get_inventory()
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local item_name = item:get_name()
|
||||||
|
|
||||||
|
if string.find(item_name, "fishing:pole_") ~= nil then
|
||||||
|
if player_name ~= self.owner then return end
|
||||||
|
if self.prize ~= "" then
|
||||||
|
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then -- fish escaped
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local name = self.prize[1]..":"..self.prize[2]
|
||||||
|
local desc = self.prize[4]
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false)
|
||||||
|
end
|
||||||
|
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||||
|
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
||||||
|
if inv:room_for_item("main", {name=name, count=1, wear=wear_value, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=name, count=1, wear=wear_value, metadata=""})
|
||||||
|
else
|
||||||
|
minetest.spawn_item(clicker:getpos(), {name=name, count=1, wear=wear_value, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- weither player has fishing pole or not
|
||||||
|
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
|
||||||
|
self.object:remove()
|
||||||
|
|
||||||
|
elseif item_name == "fishing:baitball_shark" then
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
inv:remove_item("main", "fishing:baitball_shark")
|
||||||
|
end
|
||||||
|
self.baitball = 20
|
||||||
|
--addparticle
|
||||||
|
minetest.add_particlespawner(30, 0.5, -- for how long (?) -- Particles on splash
|
||||||
|
{x=pos.x,y=pos.y-0.0325,z=pos.z}, {x=pos.x,y=pos.y,z=pos.z}, -- position min, pos max
|
||||||
|
{x=-2,y=-0.0325,z=-2}, {x=2,y=3,z=2}, -- velocity min, vel max
|
||||||
|
{x=0,y=-3.8,z=0}, {x=0,y=-9.8,z=0},
|
||||||
|
0.3, 1.2,
|
||||||
|
0.25, 0.40, -- min size, max size
|
||||||
|
false, "fishing_particle_baitball_shark.png")
|
||||||
|
-- add sound
|
||||||
|
minetest.sound_play("fishing_baitball", {pos = self.object:getpos(), gain = 0.2, })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
|
||||||
|
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
--remove if no owner, no player, owner no in bobber_view_range
|
||||||
|
if self.owner == nil then self.object:remove(); return end
|
||||||
|
--remove if not node water
|
||||||
|
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-0.5, z=pos.z})
|
||||||
|
if not node or string.find(node.name, "water_source") == nil then
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(self.owner, fishing_setting.func.S("Haha, Fishing is prohibited outside water!"))
|
||||||
|
end
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local player = minetest.get_player_by_name(self.owner)
|
||||||
|
if not player then self.object:remove(); return end
|
||||||
|
local p = player:getpos()
|
||||||
|
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
||||||
|
if dist > fishing_setting.settings["bobber_view_range"] then
|
||||||
|
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--rotate bobber
|
||||||
|
if math.random(1, 4) == 1 then
|
||||||
|
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
|
||||||
|
end
|
||||||
|
|
||||||
|
self.timer = self.timer + 1
|
||||||
|
if self.timer < self.randomtime then
|
||||||
|
-- if fish or others items, move bobber to simulate fish on the line
|
||||||
|
if self.prize ~= "" and math.random(1,3) == 1 then
|
||||||
|
if self.old_pos2 == true then
|
||||||
|
pos.y = pos.y-0.050
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
self.old_pos2 = false
|
||||||
|
else
|
||||||
|
pos.y = pos.y+0.050
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
self.old_pos2 = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
--change item on line
|
||||||
|
self.timer = 0
|
||||||
|
if self.prize ~= "" and fishing_setting.have_true_fish and fishing_setting.prizes["true_fish"]["big"][self.prize[1]..":"..self.prize[2]] then
|
||||||
|
minetest.add_entity({x=pos.x, y=pos.y-1, z=pos.z}, self.prize[1]..":"..self.prize[2])
|
||||||
|
end
|
||||||
|
self.prize = ""
|
||||||
|
self.object:moveto(self.old_pos, false)
|
||||||
|
--Once the fish are not hungry :), baitball increase hungry + 20%
|
||||||
|
if math.random(1, 100) > fishing_setting.baits[self.bait]["hungry"] + self.baitball then
|
||||||
|
--Fish not hungry !(
|
||||||
|
self.randomtime = math.random(20,60)*10
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.randomtime = math.random(1,5)*10
|
||||||
|
local chance = math.random(1, 100)
|
||||||
|
--if 1 you catch a treasure
|
||||||
|
if fishing_setting.settings["treasure_enable"] and chance == 1 then
|
||||||
|
if math.random(1, 100) <= fishing_setting.settings["treasure_chance"] then
|
||||||
|
self.prize = fishing_setting.prizes["treasure"][math.random(1,#fishing_setting.prizes["treasure"])]
|
||||||
|
end
|
||||||
|
elseif chance <= fishing_setting.settings["fish_chance"] then
|
||||||
|
if self.water_type and self.water_type == "sea" then
|
||||||
|
self.prize = fishing_setting.prizes["sea"]["big"][math.random(1,#fishing_setting.prizes["sea"]["big"])]
|
||||||
|
else
|
||||||
|
self.prize = fishing_setting.prizes["rivers"]["big"][math.random(1,#fishing_setting.prizes["rivers"]["big"])]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- to mobs_fish modpack
|
||||||
|
if fishing_setting.have_true_fish then
|
||||||
|
local objs = minetest.get_objects_inside_radius({x=pos.x, y=pos.y-2, z=pos.z}, 3)
|
||||||
|
for _, obj in pairs(objs) do
|
||||||
|
if obj:get_luaentity() ~= nil then
|
||||||
|
local name = obj:get_luaentity().name
|
||||||
|
if fishing_setting.prizes["true_fish"]["big"][name] then
|
||||||
|
self.prize = fishing_setting.prizes["true_fish"]["big"][name]
|
||||||
|
obj:remove()
|
||||||
|
self.randomtime = math.random(3,7)*10
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif math.random(1, 100) <= 10 then
|
||||||
|
self.prize = fishing_setting.func.get_loot()
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.prize ~= "" then
|
||||||
|
pos.y = self.old_pos.y-0.140
|
||||||
|
self.object:moveto(pos, false)
|
||||||
|
minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_entity("fishing:bobber_shark_entity", FISHING_BOBBER_SHARK_ENTITY)
|
|
@ -0,0 +1,174 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77 version
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Recipes 0.0.8
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
||||||
|
-- Looked at code from:
|
||||||
|
-- Dependencies: default, farming
|
||||||
|
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing Pole
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Wood Fishing Pole
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:pole_wood",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "group:stick" },
|
||||||
|
{"", "group:stick", "farming:string" },
|
||||||
|
{"group:stick", "", "farming:string" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("moreblocks") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:pole_wood",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "group:stick" },
|
||||||
|
{"", "group:stick", "moreblocks:rope" },
|
||||||
|
{"group:stick", "", "moreblocks:rope" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("ropes") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:pole_wood",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "group:stick" },
|
||||||
|
{"", "group:stick", "ropes:rope" },
|
||||||
|
{"group:stick", "", "ropes:rope" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mithril Fishing Pole
|
||||||
|
-- Some subgames have bundled all of moreores' content in their default mod; just check for mithril
|
||||||
|
if (minetest.get_modpath("moreores") ~= nil or minetest.registered_items["default:mithril_ingot"]) and minetest.get_modpath("mobs") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:pole_perfect",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "moreores:mithril_ingot" },
|
||||||
|
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
|
||||||
|
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing bait
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
--bait corn
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:bait_corn 9",
|
||||||
|
recipe = {
|
||||||
|
{"", "farming:corn", ""},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
--bait bread
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:bait_bread 9",
|
||||||
|
recipe = {
|
||||||
|
{"", "farming:bread", ""},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Roasted Fish
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:fish_cooked",
|
||||||
|
recipe = "group:fishraw",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("mobs_fish") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:fish_cooked",
|
||||||
|
recipe = "mobs_fish:clownfish",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:fish_cooked",
|
||||||
|
recipe = "mobs_fish:tropical",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Wheat Seed
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "farming:seed_wheat",
|
||||||
|
recipe = {"farming:wheat"},
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Sushi
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
if minetest.get_modpath("flowers_plus") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "fishing:sushi",
|
||||||
|
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "flowers_plus:seaweed" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("seaplants") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "fishing:sushi",
|
||||||
|
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "seaplants:kelpgreen" },
|
||||||
|
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Roasted Shark
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:shark_cooked",
|
||||||
|
recipe = "fishing:shark_raw",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("mobs_sharks") ~= nil then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:shark_cooked",
|
||||||
|
recipe = "mobs_sharks:shark_lg",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:shark_cooked",
|
||||||
|
recipe = "mobs_sharks:shark_md",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:shark_cooked",
|
||||||
|
recipe = "mobs_sharks:shark_sm",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Roasted Pike
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "fishing:pike_cooked",
|
||||||
|
recipe = "fishing:pike_raw",
|
||||||
|
cooktime = 2,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
default
|
||||||
|
unified_inventory?
|
||||||
|
farming
|
||||||
|
moreblocks?
|
||||||
|
ropes?
|
||||||
|
moreores?
|
||||||
|
mobs?
|
||||||
|
flowers_plus?
|
||||||
|
seaplants?
|
||||||
|
mobs_fish?
|
||||||
|
mobs_sharks?
|
|
@ -0,0 +1,133 @@
|
||||||
|
-------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77 version
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Fishes 0.0.4
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fish
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:fish_raw", {
|
||||||
|
description = fishing_setting.func.S("Fish"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_fish_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------
|
||||||
|
-- Roasted Fish
|
||||||
|
-----------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:fish_cooked", {
|
||||||
|
description = fishing_setting.func.S("Roasted Fish"),
|
||||||
|
groups = {},
|
||||||
|
inventory_image = "fishing_fish_cooked.png",
|
||||||
|
on_use = minetest.item_eat(4),
|
||||||
|
})
|
||||||
|
-----------------------------------------------------
|
||||||
|
-- Sushi
|
||||||
|
-----------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:sushi", {
|
||||||
|
description = fishing_setting.func.S("Sushi (Hoso Maki)"),
|
||||||
|
groups = {},
|
||||||
|
inventory_image = "fishing_sushi.png",
|
||||||
|
on_use = minetest.item_eat(6),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- clownfish
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:clownfish_raw", {
|
||||||
|
description = fishing_setting.func.S("Clownfish"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_clownfish_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- bluewhite
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:bluewhite_raw", {
|
||||||
|
description = fishing_setting.func.S("Bluewhite"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_bluewhite_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- exoticfish
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:exoticfish_raw", {
|
||||||
|
description = fishing_setting.func.S("Exotic"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_exoticfish_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- carp
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:carp_raw", {
|
||||||
|
description = fishing_setting.func.S("Carp"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_carp_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- perch
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:perch_raw", {
|
||||||
|
description = fishing_setting.func.S("Perch"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_perch_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- catfish
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:catfish_raw", {
|
||||||
|
description = fishing_setting.func.S("Catfish"),
|
||||||
|
groups = {fishbait=1, fishraw=1},
|
||||||
|
inventory_image = "fishing_catfish_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Whatthef... it's a freakin' Shark!
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:shark_raw", {
|
||||||
|
description = fishing_setting.func.S("Shark"),
|
||||||
|
groups = {fishbait=1},
|
||||||
|
inventory_image = "fishing_shark_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------
|
||||||
|
-- Roasted Shark
|
||||||
|
-----------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:shark_cooked", {
|
||||||
|
description = fishing_setting.func.S("Roasted Shark"),
|
||||||
|
groups = {},
|
||||||
|
inventory_image = "fishing_shark_cooked.png",
|
||||||
|
on_use = minetest.item_eat(6),
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Pike
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:pike_raw", {
|
||||||
|
description = fishing_setting.func.S("Northern Pike"),
|
||||||
|
groups = {fishbait=1},
|
||||||
|
inventory_image = "fishing_pike_raw.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
})
|
||||||
|
-----------------------------------------------------
|
||||||
|
-- Roasted Pike
|
||||||
|
-----------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:pike_cooked", {
|
||||||
|
description = fishing_setting.func.S("Roasted Northern Pike"),
|
||||||
|
groups = {},
|
||||||
|
inventory_image = "fishing_pike_cooked.png",
|
||||||
|
on_use = minetest.item_eat(6),
|
||||||
|
})
|
|
@ -0,0 +1,827 @@
|
||||||
|
|
||||||
|
local S = fishing_setting.func.S
|
||||||
|
|
||||||
|
--function save settings
|
||||||
|
function fishing_setting.func.save()
|
||||||
|
local input, err = io.open(fishing_setting.file_settings, "w")
|
||||||
|
if input then
|
||||||
|
input:write(minetest.serialize(fishing_setting.settings))
|
||||||
|
input:close()
|
||||||
|
else
|
||||||
|
minetest.log("error", "open(" .. fishing_setting.file_settings .. ", 'w') failed: " .. err)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.set_settings(new_settings, settings)
|
||||||
|
if settings["message"] ~= nil then
|
||||||
|
new_settings["message"] = settings["message"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["worm_is_mob"] ~= nil then
|
||||||
|
new_settings["worm_is_mob"] = settings["worm_is_mob"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["worm_chance"] ~= nil then
|
||||||
|
new_settings["worm_chance"] = settings["worm_chance"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["new_worm_source"] ~= nil then
|
||||||
|
new_settings["new_worm_source"] = settings["new_worm_source"]
|
||||||
|
end
|
||||||
|
if settings["wear_out"] ~= nil then
|
||||||
|
new_settings["wear_out"] = settings["wear_out"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["bobber_view_range"] ~= nil then
|
||||||
|
new_settings["bobber_view_range"] = settings["bobber_view_range"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["simple_deco_fishing_pole"] ~= nil then
|
||||||
|
new_settings["simple_deco_fishing_pole"] = settings["simple_deco_fishing_pole"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["fish_chance"] ~= nil then
|
||||||
|
new_settings["fish_chance"] = settings["fish_chance"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["treasure_chance"] ~= nil then
|
||||||
|
new_settings["treasure_chance"] = settings["treasure_chance"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["shark_chance"] ~= nil then
|
||||||
|
new_settings["shark_chance"] = settings["shark_chance"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["treasure_enable"] ~= nil then
|
||||||
|
new_settings["treasure_enable"] = settings["treasure_enable"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if settings["escape_chance"] ~= nil then
|
||||||
|
new_settings["escape_chance"] = settings["escape_chance"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--function load settings from file
|
||||||
|
function fishing_setting.func.load()
|
||||||
|
local file = io.open(fishing_setting.file_settings, "r")
|
||||||
|
local settings = {}
|
||||||
|
if file then
|
||||||
|
settings = minetest.deserialize(file:read("*all"))
|
||||||
|
file:close()
|
||||||
|
if settings and type(settings) == "table" then
|
||||||
|
fishing_setting.func.set_settings(fishing_setting.settings, settings)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--function return wear tool value (old or new)
|
||||||
|
function fishing_setting.func.wear_value(wear)
|
||||||
|
local used = 0
|
||||||
|
if wear == "random" then
|
||||||
|
used = (2000*(math.random(20, 29)))
|
||||||
|
elseif wear == "randomtools" then
|
||||||
|
used = (65535/(30-(math.random(15, 29))))
|
||||||
|
end
|
||||||
|
return used
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- function return table where mods actived
|
||||||
|
function fishing_setting.func.ignore_mod(list)
|
||||||
|
local listOk = {}
|
||||||
|
for i,v in ipairs(list) do
|
||||||
|
if minetest.get_modpath(v[1]) ~= nil then
|
||||||
|
table.insert(listOk, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return listOk
|
||||||
|
end
|
||||||
|
|
||||||
|
--function random hungry by bait type
|
||||||
|
function fishing_setting.func.hungry_random()
|
||||||
|
for i,a in pairs(fishing_setting.baits) do
|
||||||
|
if string.find(i, "fishing:") ~= nil then
|
||||||
|
fishing_setting.baits[i]["hungry"] = math.random(15, 80)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- to mobs_fish modpack
|
||||||
|
if fishing_setting.baits["mobs_fish:clownfish"] then
|
||||||
|
fishing_setting.baits["mobs_fish:clownfish"]["hungry"] = fishing_setting.baits["fishing:clownfish_raw"]["hungry"]
|
||||||
|
end
|
||||||
|
if fishing_setting.baits["mobs_fish:tropical"] then
|
||||||
|
fishing_setting.baits["mobs_fish:tropical"]["hungry"] = fishing_setting.baits["fishing:exoticfish_raw"]["hungry"]
|
||||||
|
end
|
||||||
|
|
||||||
|
--change hungry after random time, min 0h30, max 6h00
|
||||||
|
minetest.after(math.random(1, 12)*1800, fishing_setting.func.hungry_random )
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.get_loot()
|
||||||
|
if #fishing_setting.prizes["stuff"] > 0 then
|
||||||
|
local c = math.random(1, fishing_setting.prizes["stuff"][#fishing_setting.prizes["stuff"]][5])
|
||||||
|
for i in pairs(fishing_setting.prizes["stuff"]) do
|
||||||
|
local min = fishing_setting.prizes["stuff"][i][5]
|
||||||
|
local chance = fishing_setting.prizes["stuff"][i][6]
|
||||||
|
local max = min + chance
|
||||||
|
if c <= max and c >= min then
|
||||||
|
return fishing_setting.prizes["stuff"][i]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Show notification when a player catches treasure
|
||||||
|
function fishing_setting.func.notify(f_name, treasure)
|
||||||
|
local title = S("Lucky %s, he caught the treasure, %s!"):format(f_name, treasure[4])
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if player_name == f_name then
|
||||||
|
minetest.chat_send_player(player_name, S("You caught the treasure, %s!"):format(treasure[4]))
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Menu: fishing configuration
|
||||||
|
fishing_setting.func.on_show_settings = function(player_name)
|
||||||
|
if not fishing_setting.tmp_setting then
|
||||||
|
fishing_setting.tmp_setting = {}
|
||||||
|
fishing_setting.func.set_settings(fishing_setting.tmp_setting, fishing_setting.settings)
|
||||||
|
end
|
||||||
|
local formspec = "size[10.8,9]label[4,0;"..S("Fishing configuration").."]"..
|
||||||
|
-- Fish chance
|
||||||
|
"label[1.6,0.5;"..S("Fish chance").."]"..
|
||||||
|
"button[0,1;1,1;cfish;-1]"..
|
||||||
|
"button[1,1;1,1;cfish;-10]"..
|
||||||
|
"label[2.1,1.2;"..tostring(fishing_setting.tmp_setting["fish_chance"]).."]"..
|
||||||
|
"button[2.7,1;1,1;cfish;+10]"..
|
||||||
|
"button[3.7,1;1,1;cfish;+1]"..
|
||||||
|
-- Shark chance
|
||||||
|
"label[1.5,2;"..S("Shark chance").."]"..
|
||||||
|
"button[0,2.5;1,1;cshark;-1]"..
|
||||||
|
"button[1,2.5;1,1;cshark;-10]"..
|
||||||
|
"label[2.1,2.7;"..tostring(fishing_setting.tmp_setting["shark_chance"]).."]"..
|
||||||
|
"button[2.7,2.5;1,1;cshark;+10]"..
|
||||||
|
"button[3.7,2.5;1,1;cshark;+1]"..
|
||||||
|
-- Treasure chance
|
||||||
|
"label[1.5,3.5;"..S("Treasure chance").."]"..
|
||||||
|
"button[0,4.;1,1;ctreasure;-1]"..
|
||||||
|
"button[1,4;1,1;ctreasure;-10]"..
|
||||||
|
"label[2.1,4.2;"..tostring(fishing_setting.tmp_setting["treasure_chance"]).."]"..
|
||||||
|
"button[2.7,4;1,1;ctreasure;+10]"..
|
||||||
|
"button[3.7,4;1,1;ctreasure;+1]"..
|
||||||
|
-- Worm chance
|
||||||
|
"label[7.5,0.5;"..S("Worm chance").."]"..
|
||||||
|
"button[6,1;1,1;cworm;-1]"..
|
||||||
|
"button[7,1;1,1;cworm;-10]"..
|
||||||
|
"label[8.1,1.2;"..tostring(fishing_setting.tmp_setting["worm_chance"]).."]"..
|
||||||
|
"button[8.7,1;1,1;cworm;+10]"..
|
||||||
|
"button[9.7,1;1,1;cworm;+1]"..
|
||||||
|
-- Escape chance
|
||||||
|
"label[7.4,2;"..S("Escape chance").."]"..
|
||||||
|
"button[6,2.5;1,1;cescape;-1]"..
|
||||||
|
"button[7,2.5;1,1;cescape;-10]"..
|
||||||
|
"label[8.1,2.7;"..tostring(fishing_setting.tmp_setting["escape_chance"]).."]"..
|
||||||
|
"button[8.7,2.5;1,1;cescape;+10]"..
|
||||||
|
"button[9.7,2.5;1,1;cescape;+1]"..
|
||||||
|
-- Bobber view range
|
||||||
|
"label[7.2,3.5;"..S("Bobber view range").."]"..
|
||||||
|
"button[7,4;1,1;bvrange;-1]"..
|
||||||
|
"label[8.1,4.2;"..tostring(fishing_setting.tmp_setting["bobber_view_range"]).."]"..
|
||||||
|
"button[8.7,4;1,1;bvrange;+1]"..
|
||||||
|
-- Messages display
|
||||||
|
"label[0,5.7;"..S("Display messages in chat").."]"..
|
||||||
|
"button[3.7,5.5;1,1;dmessages;"..tostring(fishing_setting.tmp_setting["message"]).."]"..
|
||||||
|
--poledeco
|
||||||
|
"label[0,6.5;"..S("Simple pole deco").."]"..
|
||||||
|
"button[3.7,6.3;1,1;poledeco;"..tostring(fishing_setting.tmp_setting["simple_deco_fishing_pole"]).."]"..
|
||||||
|
-- Wearout
|
||||||
|
"label[0,7.3;"..S("Poles wearout").."]"..
|
||||||
|
"button[3.7,7.1;1,1;wearout;"..tostring(fishing_setting.tmp_setting["wear_out"]).."]"..
|
||||||
|
-- TREASURE_ENABLE
|
||||||
|
"label[6,5.7;"..S("Enable treasure").."]"..
|
||||||
|
"button[9.7,5.5;1,1;treasureenable;"..tostring(fishing_setting.tmp_setting["treasure_enable"]).."]"..
|
||||||
|
-- NEW_WORM_SOURCE
|
||||||
|
"label[6,6.5;"..S("New worm source (reboot)").."]"..
|
||||||
|
"button[9.7,6.3;1,1;newworm;"..tostring(fishing_setting.tmp_setting["new_worm_source"]).."]"..
|
||||||
|
-- WORM_IS_MOB
|
||||||
|
"label[6,7.3;"..S("Worm is a mob (reboot)").."]"..
|
||||||
|
"button[9.7,7.1;1,1;wormmob;"..tostring(fishing_setting.tmp_setting["worm_is_mob"]).."]"..
|
||||||
|
"button_exit[0,8.2;1.5,1;abort;"..S("Abort").."]"..
|
||||||
|
"button_exit[9.2,8.2;1.5,1;save;"..S("OK").."]"
|
||||||
|
minetest.show_formspec(player_name, "fishing:settings", formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
local inc = function(value, field, min, max)
|
||||||
|
local inc = tonumber(field)
|
||||||
|
local v = value
|
||||||
|
if inc ~= nil then
|
||||||
|
v = value + inc
|
||||||
|
end
|
||||||
|
|
||||||
|
if v > max then
|
||||||
|
return max
|
||||||
|
end
|
||||||
|
if v < min then
|
||||||
|
return min
|
||||||
|
end
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local bool = function(field)
|
||||||
|
return field ~= "true"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if not player_name then return end
|
||||||
|
if formname == "fishing:settings" then
|
||||||
|
if fields["save"] then
|
||||||
|
fishing_setting.func.set_settings(fishing_setting.settings, fishing_setting.tmp_setting)
|
||||||
|
fishing_setting.func.save()
|
||||||
|
fishing_setting.tmp_setting = nil
|
||||||
|
return
|
||||||
|
elseif fields["quit"] or fields["abort"] then
|
||||||
|
fishing_setting.tmp_setting = nil
|
||||||
|
return
|
||||||
|
elseif fields["cfish"] then
|
||||||
|
fishing_setting.tmp_setting["fish_chance"] = inc(fishing_setting.tmp_setting["fish_chance"], fields["cfish"], 1, 100)
|
||||||
|
elseif fields["cshark"] then
|
||||||
|
fishing_setting.tmp_setting["shark_chance"] = inc(fishing_setting.tmp_setting["shark_chance"], fields["cshark"], 1, 100)
|
||||||
|
elseif fields["ctreasure"] then
|
||||||
|
fishing_setting.tmp_setting["treasure_chance"] = inc(fishing_setting.tmp_setting["treasure_chance"], fields["ctreasure"], 1, 100)
|
||||||
|
elseif fields["bvrange"] then
|
||||||
|
fishing_setting.tmp_setting["bobber_view_range"] = inc(fishing_setting.tmp_setting["bobber_view_range"], fields["bvrange"], 4, 20)
|
||||||
|
elseif fields["cworm"] then
|
||||||
|
fishing_setting.tmp_setting["worm_chance"] = inc(fishing_setting.tmp_setting["worm_chance"], fields["cworm"], 1, 100)
|
||||||
|
elseif fields["cescape"] then
|
||||||
|
fishing_setting.tmp_setting["escape_chance"] = inc(fishing_setting.tmp_setting["escape_chance"], fields["cescape"], 1, 50)
|
||||||
|
elseif fields["dmessages"] then
|
||||||
|
fishing_setting.tmp_setting["message"] = bool(fields["dmessages"])
|
||||||
|
elseif fields["poledeco"] then
|
||||||
|
fishing_setting.tmp_setting["simple_deco_fishing_pole"] = bool(fields["poledeco"])
|
||||||
|
elseif fields["wearout"] then
|
||||||
|
fishing_setting.tmp_setting["wear_out"] = bool(fields["wearout"])
|
||||||
|
elseif fields["treasureenable"] then
|
||||||
|
fishing_setting.tmp_setting["treasure_enable"] = bool(fields["treasureenable"])
|
||||||
|
elseif fields["newworm"] then
|
||||||
|
fishing_setting.tmp_setting["new_worm_source"] = bool(fields["newworm"])
|
||||||
|
elseif fields["wormmob"] then
|
||||||
|
fishing_setting.tmp_setting["worm_is_mob"] = bool(fields["wormmob"])
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
fishing_setting.func.on_show_settings(player_name)
|
||||||
|
elseif formname == "fishing:admin_conf" then
|
||||||
|
if fields["classement"] then
|
||||||
|
local formspec = fishing_setting.func.get_stat()
|
||||||
|
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
||||||
|
elseif fields["contest"] then
|
||||||
|
fishing_setting.func.on_show_settings_contest(player_name)
|
||||||
|
elseif fields["configuration"] then
|
||||||
|
fishing_setting.func.on_show_settings(player_name)
|
||||||
|
elseif fields["hungerinfo"] then
|
||||||
|
fishing_setting.func.get_hunger_info(player_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--function load settings from file
|
||||||
|
function fishing_setting.func.load_trophies()
|
||||||
|
local file = io.open(fishing_setting.file_trophies, "r")
|
||||||
|
fishing_setting.trophies = {}
|
||||||
|
if file then
|
||||||
|
fishing_setting.trophies = minetest.deserialize(file:read("*all"))
|
||||||
|
file:close()
|
||||||
|
if not fishing_setting.trophies or type(fishing_setting.trophies) ~= "table" then
|
||||||
|
fishing_setting.trophies = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fishing_setting.func.save_trophies()
|
||||||
|
local input = io.open(fishing_setting.file_trophies, "w")
|
||||||
|
if input then
|
||||||
|
input:write(minetest.serialize(fishing_setting.trophies))
|
||||||
|
input:close()
|
||||||
|
else
|
||||||
|
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file_trophies)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_shutdown(function()
|
||||||
|
minetest.log("action", "[fishing] Server shuts down. saving trophies table")
|
||||||
|
fishing_setting.func.save_trophies()
|
||||||
|
fishing_setting.func.save_contest()
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.timetostr(time)
|
||||||
|
local countdown = time
|
||||||
|
local answer = ""
|
||||||
|
if countdown >= 3600 then
|
||||||
|
local hours = math.floor(countdown / 3600)
|
||||||
|
countdown = countdown % 3600
|
||||||
|
answer = hours .. "h"
|
||||||
|
end
|
||||||
|
if countdown >= 60 then
|
||||||
|
local minutes = math.floor(countdown / 60)
|
||||||
|
countdown = countdown % 60
|
||||||
|
answer = answer .. minutes .. "m"
|
||||||
|
else
|
||||||
|
answer = answer .. "0m"
|
||||||
|
end
|
||||||
|
local seconds = countdown
|
||||||
|
answer = answer .. math.floor(seconds) .. "s"
|
||||||
|
return answer
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if fishing_setting.contest["contest"] == true then
|
||||||
|
minetest.chat_send_player(player_name, S("A fishing contest is in progress. (remaining time %s)"):format(fishing_setting.func.timetostr(fishing_setting.contest["duration"])))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.add_to_trophies(player, fish, desc)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if not player_name then return end
|
||||||
|
if string.find(fish, "_raw") ~= nil or fishing_setting.prizes["true_fish"]["little"][fish] or fishing_setting.prizes["true_fish"]["big"][fish] then
|
||||||
|
if string.find(fish, "_raw") ~= nil then
|
||||||
|
if fishing_setting.trophies[fish] == nil then
|
||||||
|
fishing_setting.trophies[fish] = {}
|
||||||
|
end
|
||||||
|
fishing_setting.trophies[fish][player_name] = (fishing_setting.trophies[fish][player_name] or 0) + 1
|
||||||
|
if fishing_setting.trophies[fish][player_name]%100 == 0 then
|
||||||
|
minetest.chat_send_player(player_name, S("You win a new trophy, you have caught %s " .. fish.."."):format(fishing_setting.trophies[fish][player_name]))
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local name = "fishing:trophy_"..fish
|
||||||
|
if inv:room_for_item("main", {name=name, count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name=name, count=1, wear=0, metadata=""})
|
||||||
|
else
|
||||||
|
minetest.spawn_item(player:getpos(), {name=name, count=1, wear=0, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
||||||
|
if fishing_setting.contest["nb_fish"] == nil then
|
||||||
|
fishing_setting.contest["nb_fish"] = {}
|
||||||
|
end
|
||||||
|
fishing_setting.contest["nb_fish"][player_name] = (fishing_setting.contest["nb_fish"][player_name] or 0) + 1
|
||||||
|
minetest.chat_send_all(S("Yeah, %s caught "..desc):format(player_name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Menu: fishing configuration/contest
|
||||||
|
fishing_setting.func.on_show_admin_menu = function(player_name)
|
||||||
|
local formspec = "size[5,5]label[1.7,0;"..S("Fishing Menu").."]"..
|
||||||
|
"button[0.5,0.5;4,1;classement;"..S("Contest rankings").."]"..
|
||||||
|
"button[0.5,1.5;4,1;contest;"..S("Contests").."]"..
|
||||||
|
"button[0.5,2.5;4,1;configuration;"..S("Configuration").."]"..
|
||||||
|
"button[0.5,3.5;4,1;hungerinfo;"..S("Hunger info").."]"..
|
||||||
|
"button_exit[1,4.5;3,1;close;"..S("Close").."]"
|
||||||
|
minetest.show_formspec(player_name, "fishing:admin_conf", formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if (minetest.get_modpath("unified_inventory")) then
|
||||||
|
unified_inventory.register_button("menu_fishing", {
|
||||||
|
type = "image",
|
||||||
|
image = "fishing_perch_raw.png",
|
||||||
|
tooltip = "Fishing Menu Configuration",
|
||||||
|
action = function(player)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if not player_name then return end
|
||||||
|
if minetest.check_player_privs(player_name, {server=true}) then
|
||||||
|
fishing_setting.func.on_show_admin_menu(player_name)
|
||||||
|
else
|
||||||
|
local formspec = fishing_setting.func.get_stat()
|
||||||
|
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--function save settings
|
||||||
|
function fishing_setting.func.save_contest()
|
||||||
|
local input = io.open(fishing_setting.file_contest, "w")
|
||||||
|
if input then
|
||||||
|
input:write(minetest.serialize(fishing_setting.contest))
|
||||||
|
input:close()
|
||||||
|
else
|
||||||
|
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file_contest)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--function load contest data from file
|
||||||
|
function fishing_setting.func.load_contest()
|
||||||
|
local file = io.open(fishing_setting.file_contest, "r")
|
||||||
|
local settings
|
||||||
|
fishing_setting.contest = {["contest"] = false, ["duration"] = 3600, ["bobber_nb"] = 4}
|
||||||
|
if file then
|
||||||
|
settings = minetest.deserialize(file:read("*all"))
|
||||||
|
file:close()
|
||||||
|
if settings ~= nil and type(settings) == "table" then
|
||||||
|
if settings["contest"] ~= nil then
|
||||||
|
fishing_setting.contest["contest"] = settings["contest"]
|
||||||
|
end
|
||||||
|
if settings["duration"] ~= nil then
|
||||||
|
fishing_setting.contest["duration"] = settings["duration"]
|
||||||
|
end
|
||||||
|
if settings["bobber_nb"] ~= nil then
|
||||||
|
fishing_setting.contest["bobber_nb"] = settings["bobber_nb"]
|
||||||
|
end
|
||||||
|
if settings["nb_fish"] ~= nil then
|
||||||
|
fishing_setting.contest["nb_fish"] = settings["nb_fish"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fishing_setting.func.start_contest(duration)
|
||||||
|
fishing_setting.contest["contest"] = true
|
||||||
|
fishing_setting.contest["warning_said"] = false
|
||||||
|
fishing_setting.contest["duration"] = duration
|
||||||
|
minetest.chat_send_all(S("Attention, Fishing contest start (duration %s)!!!"):format(duration))
|
||||||
|
minetest.sound_play("fishing_contest_start",{gain=0.8})
|
||||||
|
fishing_setting.func.save_contest()
|
||||||
|
fishing_setting.func.tick()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fishing_setting.func.end_contest()
|
||||||
|
fishing_setting.contest["contest"] = false
|
||||||
|
fishing_setting.func.save_contest()
|
||||||
|
minetest.chat_send_all(S("End of fishing contest."))
|
||||||
|
minetest.sound_play("fishing_contest_end",{gain=0.8})
|
||||||
|
fishing_setting.func.show_result()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--function load planned contest from file
|
||||||
|
function fishing_setting.func.load_planned()
|
||||||
|
local file = io.open(fishing_setting.file_planned, "r")
|
||||||
|
local settings = {}
|
||||||
|
if file then
|
||||||
|
settings = minetest.deserialize(file:read("*all"))
|
||||||
|
file:close()
|
||||||
|
if settings and type(settings) == "table" then
|
||||||
|
for i, p in pairs(settings) do
|
||||||
|
if p["wday"] ~= nil and p["hour"] ~= nil and p["min"] ~= nil and p["duration"] ~= nil then
|
||||||
|
table.insert(fishing_setting.planned, {["wday"]=p["wday"], ["hour"]=p["hour"], ["min"]=p["min"], ["duration"]=p["duration"]})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fishing_setting.func.load_planned()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.save_planned()
|
||||||
|
local input = io.open(fishing_setting.file_planned, "w")
|
||||||
|
if input then
|
||||||
|
input:write(minetest.serialize(fishing_setting.planned))
|
||||||
|
input:close()
|
||||||
|
else
|
||||||
|
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file_planned)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("contest_add", {
|
||||||
|
params = "Wday Hours Minutes duration(in sec) (ex: 1 15 40 3600)",
|
||||||
|
description = "Add contest (admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
local wday, hour, min, duration = param:match("^(%d+)%s(%d+)%s(%d+)%s(%d+)$")
|
||||||
|
if ((not wday or not tonumber(wday)) or (not hour or not tonumber(hour)) or (not min and not tonumber(min)) or (not duration or not tonumber(duration))) then
|
||||||
|
return false, "Invalid usage, see /help contest_add."
|
||||||
|
end
|
||||||
|
|
||||||
|
wday = tonumber(wday)
|
||||||
|
hour = tonumber(hour)
|
||||||
|
min = tonumber(min)
|
||||||
|
duration = tonumber(duration)
|
||||||
|
|
||||||
|
if (wday < 0 or wday > 7) then
|
||||||
|
return false, "Invalid argument wday, 0-7 (0=all 1=Sunday)."
|
||||||
|
end
|
||||||
|
|
||||||
|
if (hour < 0 or hour > 23) then
|
||||||
|
return false, "Invalid argument hour, 0-23."
|
||||||
|
end
|
||||||
|
if (min < 0 or min > 59) then
|
||||||
|
return false, "Invalid argument minutes, 0-59."
|
||||||
|
end
|
||||||
|
|
||||||
|
if duration < 600 then
|
||||||
|
duration = 600
|
||||||
|
elseif duration > 14400 then
|
||||||
|
duration = 14400
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(fishing_setting.planned, {["wday"]=wday, ["hour"]=hour, ["min"]=min, ["duration"]=duration})
|
||||||
|
fishing_setting.func.save_planned()
|
||||||
|
return true, ("new contest registered %d %d:%d duration %d."):format(wday, hour, min, duration)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("contest_del", {
|
||||||
|
params = "List number(show by contest_show command) ",
|
||||||
|
description = "Delete planned contest(admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
local i = tonumber(param)
|
||||||
|
if not i then
|
||||||
|
return false, "Invalid usage, see /help contest_del."
|
||||||
|
end
|
||||||
|
if i < 1 then
|
||||||
|
return false, "Invalid usage, see /help contest_del."
|
||||||
|
end
|
||||||
|
|
||||||
|
local c = fishing_setting.planned[i]
|
||||||
|
if not c then
|
||||||
|
return false, "Contest no found"
|
||||||
|
end
|
||||||
|
table.remove(fishing_setting.planned, i)
|
||||||
|
fishing_setting.func.save_planned()
|
||||||
|
return true, "contest deleted"
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("contest_show", {
|
||||||
|
params = "",
|
||||||
|
description = "Display planned contest(admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
local text = "Registered contest:\n"
|
||||||
|
for i, plan in pairs(fishing_setting.planned) do
|
||||||
|
text = text ..("%d) wday:%d hour:%d min:%d duration %d.\n"):format(i, plan.wday, plan.hour, plan.min, plan.duration)
|
||||||
|
end
|
||||||
|
return true, text
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("contest_start", {
|
||||||
|
params = "Duration in seconds",
|
||||||
|
description = "Start contest (admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
if fishing_setting.contest["contest"] == true then
|
||||||
|
return false, "Contest already in progress."
|
||||||
|
end
|
||||||
|
|
||||||
|
local duration = tonumber(param)
|
||||||
|
if not duration then
|
||||||
|
duration = 3600
|
||||||
|
end
|
||||||
|
fishing_setting.contest["nb_fish"] = {}
|
||||||
|
fishing_setting.func.start_contest(duration)
|
||||||
|
return true, ("Contest started, duration:%d sec."):format(duration)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("contest_stop", {
|
||||||
|
params = "",
|
||||||
|
description = "Stop contest (admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
if fishing_setting.contest["contest"] == false then
|
||||||
|
return false, "No contest in progress."
|
||||||
|
end
|
||||||
|
fishing_setting.func.end_contest()
|
||||||
|
return true, "Contest finished."
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
function fishing_setting.func.planned_tick()
|
||||||
|
if fishing_setting.contest["contest"] == nil or fishing_setting.contest["contest"] == false then
|
||||||
|
for i, plan in pairs(fishing_setting.planned) do
|
||||||
|
local wday = plan.wday
|
||||||
|
local hour = plan.hour
|
||||||
|
local min = plan.min
|
||||||
|
local duration = plan.duration
|
||||||
|
local time = os.date("*t",os.time())
|
||||||
|
if (wday == 0 or wday == time.wday) then
|
||||||
|
if time.hour == hour and time.min == min then
|
||||||
|
minetest.log("action", ("Starting fishing contest at %d:%d duration %d"):format( hour, min, duration))
|
||||||
|
fishing_setting.contest["nb_fish"] = {}
|
||||||
|
fishing_setting.func.start_contest(duration)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.after(50, fishing_setting.func.planned_tick)
|
||||||
|
end
|
||||||
|
|
||||||
|
--Menu fishing configuration
|
||||||
|
fishing_setting.func.on_show_settings_contest = function(player_name)
|
||||||
|
if not fishing_setting.tmp_setting then
|
||||||
|
fishing_setting.tmp_setting = { ["contest"] = (fishing_setting.contest["contest"] or false),
|
||||||
|
["duration"] = (math.floor(fishing_setting.contest["duration"]) or 3600),
|
||||||
|
["bobber_nb"] = (fishing_setting.contest["bobber_nb"] or 2),
|
||||||
|
["reset"] = false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
local formspec = "size[6.1,7]label[1.9,0;"..S("Fishing contest").."]"..
|
||||||
|
--Time contest
|
||||||
|
"label[2.2,0.5;"..S("Duration(in sec)").."]"..
|
||||||
|
"button[0.8,1;1,1;duration;-60]"..
|
||||||
|
"button[1.8,1;1,1;duration;-600]"..
|
||||||
|
"label[2.7,1.2;"..tostring(fishing_setting.tmp_setting["duration"]).."]"..
|
||||||
|
"button[3.5,1;1,1;duration;+600]"..
|
||||||
|
"button[4.5,1;1,1;duration;+60]"..
|
||||||
|
--bobber nb
|
||||||
|
"label[2,2;"..S("Bobber number limit").."]"..
|
||||||
|
"button[1.8,2.5;1,1;bobbernb;-1]"..
|
||||||
|
"label[2.9,2.7;"..tostring(fishing_setting.tmp_setting["bobber_nb"]).."]"..
|
||||||
|
"button[3.5,2.5;1,1;bobbernb;+1]"..
|
||||||
|
--contest enable
|
||||||
|
"label[0.8,3.8;"..S("Enable contests").."]"..
|
||||||
|
"button[4.5,3.6;1,1;contest;"..tostring(fishing_setting.tmp_setting["contest"]).."]"..
|
||||||
|
--reset
|
||||||
|
"label[0.8,5.2;"..S("Reset rankings").."]"..
|
||||||
|
"button[4.5,5;1,1;reset;"..tostring(fishing_setting.tmp_setting["reset"]).."]"..
|
||||||
|
"button_exit[0.8,6.2;1.5,1;abort;"..S("Abort").."]"..
|
||||||
|
"button_exit[4,6.2;1.5,1;save;"..S("OK").."]"
|
||||||
|
minetest.show_formspec(player_name, "fishing:contest", formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname == "fishing:contest" then
|
||||||
|
local name = player:get_player_name()
|
||||||
|
if not name then return end
|
||||||
|
if fields["save"] then
|
||||||
|
if fishing_setting.tmp_setting["reset"] == true then
|
||||||
|
fishing_setting.contest["nb_fish"] = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
local progress = (fishing_setting.contest["contest"] or false)
|
||||||
|
fishing_setting.contest["duration"] = fishing_setting.tmp_setting["duration"]
|
||||||
|
fishing_setting.contest["contest"] = fishing_setting.tmp_setting["contest"]
|
||||||
|
fishing_setting.contest["bobber_nb"] = fishing_setting.tmp_setting["bobber_nb"]
|
||||||
|
if progress == false and fishing_setting.tmp_setting["contest"] == true then
|
||||||
|
local duration = fishing_setting.func.timetostr(fishing_setting.contest["duration"])
|
||||||
|
fishing_setting.func.start_contest(duration)
|
||||||
|
elseif progress == true and fishing_setting.tmp_setting["contest"] == false then
|
||||||
|
fishing_setting.func.end_contest()
|
||||||
|
end
|
||||||
|
fishing_setting.func.save_contest()
|
||||||
|
fishing_setting.tmp_setting = nil
|
||||||
|
return
|
||||||
|
elseif fields["quit"] or fields["abort"] then
|
||||||
|
fishing_setting.tmp_setting = nil
|
||||||
|
return
|
||||||
|
elseif fields["duration"] then
|
||||||
|
fishing_setting.tmp_setting["duration"] = inc(fishing_setting.tmp_setting["duration"], fields["duration"], 120, 14400)
|
||||||
|
elseif fields["contest"] then
|
||||||
|
fishing_setting.tmp_setting["contest"] = bool(fields["contest"])
|
||||||
|
elseif fields["bobbernb"] then
|
||||||
|
fishing_setting.tmp_setting["bobber_nb"] = inc(fishing_setting.tmp_setting["bobber_nb"], fields["bobbernb"], 1, 8)
|
||||||
|
elseif fields["reset"] then
|
||||||
|
fishing_setting.tmp_setting["reset"] = bool(fields["reset"])
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
fishing_setting.func.on_show_settings_contest(name)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
function spairs(t, order)
|
||||||
|
-- collect the keys
|
||||||
|
local keys = {}
|
||||||
|
for k in pairs(t) do keys[#keys+1] = k end
|
||||||
|
-- if order function given, sort by it by passing the table and keys a, b,
|
||||||
|
-- otherwise just sort the keys
|
||||||
|
if order then
|
||||||
|
table.sort(keys, function(a,b) return order(t, a, b) end)
|
||||||
|
else
|
||||||
|
table.sort(keys)
|
||||||
|
end
|
||||||
|
-- return the iterator function
|
||||||
|
local i = 0
|
||||||
|
return function()
|
||||||
|
i = i + 1
|
||||||
|
if keys[i] then
|
||||||
|
return keys[i], t[keys[i]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.set_winners(list)
|
||||||
|
local win = {}
|
||||||
|
-- this uses an custom sorting function ordering by score descending
|
||||||
|
for k,v in spairs(list, function(t,a,b) return t[b] < t[a] end) do
|
||||||
|
table.insert(win, {["name"]=k, ["nb"]=v})
|
||||||
|
if #win >= 15 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return win
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function fishing_setting.func.get_stat()
|
||||||
|
local winners = {}
|
||||||
|
if fishing_setting.contest["nb_fish"] ~= nil then
|
||||||
|
winners = fishing_setting.func.set_winners(fishing_setting.contest["nb_fish"])
|
||||||
|
end
|
||||||
|
local formspec = {"size[6,8]label[2,0;"..S("Fishing contest rankings").."]"}
|
||||||
|
local Y = 1.1
|
||||||
|
table.insert(formspec, "label[0.5,0.5;No]")
|
||||||
|
table.insert(formspec, "label[2,0.5;Name]")
|
||||||
|
table.insert(formspec, "label[4.2,0.5;Fish Total]")
|
||||||
|
for num,n in ipairs(winners) do
|
||||||
|
table.insert(formspec, "label[0.5,"..Y..";"..tostring(num).."]") -- classement
|
||||||
|
table.insert(formspec, "label[2,"..Y..";"..n["name"].."]") -- playername
|
||||||
|
table.insert(formspec, "label[4.3,"..Y..";"..tostring(n["nb"]).."]") -- nb fish caught
|
||||||
|
Y = Y + 0.4
|
||||||
|
end
|
||||||
|
table.insert(formspec, "button_exit[2.4,7.5;1.2,1;close;"..S("Close").."]")
|
||||||
|
return table.concat(formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
function fishing_setting.func.get_hunger_info(player_name)
|
||||||
|
local formspec = "size[6,9]label[1.9,0;Fishing Info Center]"
|
||||||
|
local y = 0.8
|
||||||
|
for i, a in pairs(fishing_setting.baits) do
|
||||||
|
if string.find(i, "fishing:") ~= nil then
|
||||||
|
formspec = formspec .."item_image_button[1,"..tostring(y)..";1,1;"..tostring(i)..";"..tostring(i)..";]"..
|
||||||
|
"label[2.2,"..tostring(y+0.2)..";Chance to fish :"..tostring(a["hungry"]).."%]"
|
||||||
|
y = y+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
formspec = formspec .."button_exit[2,8.5;2,1;close;"..S("Close").."]"
|
||||||
|
minetest.show_formspec(player_name,"fishing:material_info", formspec)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("fishing_menu", {
|
||||||
|
params = "",
|
||||||
|
description = "Show fishing menu (admin only)",
|
||||||
|
privs = {server=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
fishing_setting.func.on_show_admin_menu(player_name)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("fishing_classement", {
|
||||||
|
params = "",
|
||||||
|
description = "display classement",
|
||||||
|
privs = {interact=true},
|
||||||
|
func = function(player_name, param)
|
||||||
|
if not player_name then return end
|
||||||
|
local formspec = fishing_setting.func.get_stat()
|
||||||
|
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
function fishing_setting.func.show_result()
|
||||||
|
minetest.after(3, function()
|
||||||
|
local formspec = fishing_setting.func.get_stat()
|
||||||
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
if player_name ~= nil then
|
||||||
|
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
local UPDATE_TIME = 1
|
||||||
|
function fishing_setting.func.tick()
|
||||||
|
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
||||||
|
fishing_setting.contest["duration"] = fishing_setting.contest["duration"] - UPDATE_TIME
|
||||||
|
if fishing_setting.contest["duration"] < 30 and fishing_setting.contest["warning_said"] ~= true then
|
||||||
|
minetest.chat_send_all(fishing_setting.func.S("WARNING, Fishing contest will finish in 30 seconds."))
|
||||||
|
fishing_setting.contest["warning_said"] = true
|
||||||
|
end
|
||||||
|
if fishing_setting.contest["duration"] < 0 then
|
||||||
|
fishing_setting.func.end_contest()
|
||||||
|
else
|
||||||
|
minetest.after(UPDATE_TIME, fishing_setting.func.tick)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
local title = "Fishing - Crabman77's (MFF team) version"
|
||||||
|
local version = "1.0.0"
|
||||||
|
local mname = "fishing"
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
||||||
|
-- rewrited by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
|
||||||
|
-- this version rewrited by Crabman77
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
||||||
|
-- Looked at code from: default, farming
|
||||||
|
-- Dependencies: default
|
||||||
|
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
minetest.log("action","[mod fishing] Loading...")
|
||||||
|
local path = minetest.get_modpath("fishing").."/"
|
||||||
|
|
||||||
|
fishing_setting = {}
|
||||||
|
fishing_setting.func = {}
|
||||||
|
fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode")
|
||||||
|
fishing_setting.file_settings = minetest.get_worldpath() .. "/fishing_config.txt"
|
||||||
|
fishing_setting.file_trophies = minetest.get_worldpath() .. "/fishing_trophies.txt"
|
||||||
|
fishing_setting.file_contest = minetest.get_worldpath() .. "/fishing_contest.txt"
|
||||||
|
fishing_setting.file_planned = minetest.get_worldpath() .. "/fishing_planned.txt"
|
||||||
|
fishing_setting.settings = {}
|
||||||
|
fishing_setting.contest = {}
|
||||||
|
fishing_setting.planned = {}
|
||||||
|
--for random object
|
||||||
|
random_objects = {}
|
||||||
|
fishing_setting.baits = {}
|
||||||
|
fishing_setting.hungry = {}
|
||||||
|
fishing_setting.prizes = {}
|
||||||
|
fishing_setting.trophies = {}
|
||||||
|
|
||||||
|
if (minetest.get_modpath("intllib")) then
|
||||||
|
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||||
|
fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
|
||||||
|
else
|
||||||
|
fishing_setting.func.S = function ( s ) return s end
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(path .."settings.txt")
|
||||||
|
dofile(path .."functions.lua")
|
||||||
|
|
||||||
|
--default_settings
|
||||||
|
fishing_setting.settings["message"] = MESSAGES
|
||||||
|
fishing_setting.settings["worm_is_mob"] = WORM_IS_MOB
|
||||||
|
fishing_setting.settings["worm_chance"] = WORM_CHANCE
|
||||||
|
fishing_setting.settings["new_worm_source"] = NEW_WORM_SOURCE
|
||||||
|
fishing_setting.settings["wear_out"] = WEAR_OUT
|
||||||
|
fishing_setting.settings["simple_deco_fishing_pole"] = SIMPLE_DECO_FISHING_POLE
|
||||||
|
fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
|
||||||
|
fishing_setting.settings["fish_chance"] = FISH_CHANCE
|
||||||
|
fishing_setting.settings["shark_chance"] = SHARK_CHANCE
|
||||||
|
fishing_setting.settings["treasure_chance"] = TREASURE_CHANCE
|
||||||
|
fishing_setting.settings["treasure_enable"] = TREASURE_RANDOM_ENABLE
|
||||||
|
fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
|
||||||
|
|
||||||
|
-- to mobs_fish|mobs_sharks modpack
|
||||||
|
if (minetest.get_modpath("mobs_fish") ~= nil or minetest.get_modpath("mobs_sharks") ~= nil) then
|
||||||
|
fishing_setting.have_true_fish = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- load config file if exist in worldpath
|
||||||
|
fishing_setting.func.load()
|
||||||
|
|
||||||
|
dofile(path .."worms.lua")
|
||||||
|
dofile(path .."crafting.lua")
|
||||||
|
dofile(path .."baits.lua")
|
||||||
|
dofile(path .."prizes.lua")
|
||||||
|
dofile(path .."baitball.lua")
|
||||||
|
dofile(path .."bobber.lua")
|
||||||
|
dofile(path .."bobber_shark.lua")
|
||||||
|
dofile(path .."fishes.lua")
|
||||||
|
dofile(path .."trophies.lua")
|
||||||
|
dofile(path .."poles.lua")
|
||||||
|
|
||||||
|
--random hungry bait
|
||||||
|
fishing_setting.func.hungry_random()
|
||||||
|
--load table caught fish by players
|
||||||
|
fishing_setting.func.load_trophies()
|
||||||
|
--load table contest
|
||||||
|
fishing_setting.func.load_contest()
|
||||||
|
fishing_setting.func.tick()
|
||||||
|
fishing_setting.func.planned_tick()
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
||||||
|
-----------------------------------------------------------------------------------------------
|
|
@ -0,0 +1,92 @@
|
||||||
|
# Translation original by Xanthin
|
||||||
|
# adapted for new fishing version by crabman77
|
||||||
|
|
||||||
|
### bobber.lua ###
|
||||||
|
You didn't catch anything. = Du hast nichts gefangen.
|
||||||
|
The bait is still there. =
|
||||||
|
Your fish escaped. = Dein Fisch ist entkommen.
|
||||||
|
You caught a Fish. = Du hast einen Fisch gefangen.
|
||||||
|
You caught a Clownfish. = Du hast einen Clownfisch gefangen.
|
||||||
|
You caught a Bluewhite. = Du hast einen blau-weissen Fisch gefangen.
|
||||||
|
You caught a Carp. =
|
||||||
|
You caught a Perch. =
|
||||||
|
You caught a Catfish. =
|
||||||
|
You caught a Exoticfish. =
|
||||||
|
You caught a tropical fish. =
|
||||||
|
You caught a Twig. = Du hast einen Zweig gefangen.
|
||||||
|
You caught a Rat. = Du hast eine Ratte gefangen.
|
||||||
|
You caught some Seaweed. = Du hast etwas Seetang gefangen.
|
||||||
|
You caught a Green Kelp. = Du hast etwas gruenen Kelp gefangen.
|
||||||
|
You caught a String. = Du hast eine Schnur gefangen.
|
||||||
|
|
||||||
|
### bobber_shark.lua ###
|
||||||
|
You caught a small Shark. = Du hast einen kleinen Hai gefangen.
|
||||||
|
You caught a Northern Pike. = Du hast einen Hecht gefangen.
|
||||||
|
You caught an old Fishing Pole. = Du hast eine alte Angelrute gefangen.
|
||||||
|
You caught some very old Boots. = Du hast ein Paar sehr alte Schuhe gefangen.
|
||||||
|
You caught a Gold Coin. =
|
||||||
|
You caught a very old Helmet. =
|
||||||
|
You caught a very old Shield. =
|
||||||
|
You caught a very old Sword. =
|
||||||
|
You caught a mese block. =
|
||||||
|
You caught a Nyan Cat. =
|
||||||
|
You caught a Diamond Block. =
|
||||||
|
Haha, Fishing is prohibited outside water! =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### crafting.lua ###
|
||||||
|
Bait Ball =
|
||||||
|
Shark Bait Ball =
|
||||||
|
|
||||||
|
|
||||||
|
### fishes.lua ###
|
||||||
|
Fish = Fisch
|
||||||
|
Roasted Fish = Gebratener Fisch
|
||||||
|
Sushi (Hoso Maki) = Sushi (Hoso Maki)
|
||||||
|
Clownfish = Clownfisch
|
||||||
|
Bluewhite = blau-weisse Fisch
|
||||||
|
Shark = Hai
|
||||||
|
Roasted Shark = Gebratener Hai
|
||||||
|
Northern Pike = Hecht
|
||||||
|
Roasted Northern Pike = Gebratener Hecht
|
||||||
|
|
||||||
|
|
||||||
|
### functions.lua ###
|
||||||
|
You don't have the server priviledge! =
|
||||||
|
You win a new trophy, you have caught %s fish. =
|
||||||
|
You win a new trophy, you have caught %s shark. =
|
||||||
|
You win a new trophy, you have caught %s pike. =
|
||||||
|
You win a new trophy, you have caught %s clownfish. =
|
||||||
|
You win a new trophy, you have caught %s bluewhite. =
|
||||||
|
|
||||||
|
|
||||||
|
### material.lua ###
|
||||||
|
Show information about hunger fish =
|
||||||
|
|
||||||
|
|
||||||
|
### poles.lua ###
|
||||||
|
Fishing Pole = Angelrute
|
||||||
|
Perfect Fishing Pole =
|
||||||
|
|
||||||
|
|
||||||
|
### trophies.lua ###
|
||||||
|
Fish Trophy = Fisch-Trophaee
|
||||||
|
Northern Pike Trophy = Hecht-Trophaee
|
||||||
|
Shark Trophy = Hai-Trophaee
|
||||||
|
Clownfish Trophy = Clownfisch-Trophaee
|
||||||
|
Bluewhite Trophy = Blau-weisser-Fisch-Trophaee
|
||||||
|
This Huge Fish was caught by the Famous Angler %s ! = Dieser riesige Fisch wurde vom beruehmten Angler %s gefangen!
|
||||||
|
This Huge Northern Pike was caught by the Famous Angler %s ! = Dieser riesige Hecht wurde vom beruehmten Angler %s gefangen!
|
||||||
|
This Huge Shark was caught by the Famous Angler %s ! = Dieser riesige Hai wurde vom beruehmten Angler %s gefangen!
|
||||||
|
This Huge Clownfish was caught by the Famous Angler %s ! = Dieser riesige Clownfisch wurde vom beruehmten Angler %s gefangen!
|
||||||
|
This Huge Bluewhite was caught by the Famous Angler %s ! = Dieser riesige blau-weisse Fisch wurde vom beruehmten Angler %s gefangen!
|
||||||
|
|
||||||
|
### worms.lua ###
|
||||||
|
Worm = Wurm
|
||||||
|
Dirt = Erde
|
||||||
|
Wooden Hoe = Holzhacke
|
||||||
|
Stone Hoe = Steinhacke
|
||||||
|
Steel Hoe = Stahlhacke
|
||||||
|
Bronze Hoe = Bronzehacke
|
|
@ -0,0 +1,126 @@
|
||||||
|
|
||||||
|
# Template
|
||||||
|
Bait Corn = Appats au Mais
|
||||||
|
Bait Bread = Appats au Pain
|
||||||
|
|
||||||
|
### bobber.lua ###
|
||||||
|
You didn't catch anything. = Vous n'avez rien attrape.
|
||||||
|
The bait is still there. = L'appat est toujours la.
|
||||||
|
Your fish escaped. = Le poisson s'est decroche.
|
||||||
|
You caught a Fish. = Vous avez attrape un poisson.
|
||||||
|
You caught a Clownfish. = Vous avez attrape un poisson clown.
|
||||||
|
You caught a Bluewhite. = Vous avez attrape un poisson bleu.
|
||||||
|
You caught a Carp. = Vous avez attrape une carpe.
|
||||||
|
You caught a Perch. = Vous avez attrape une perche.
|
||||||
|
You caught a Catfish. = Vous avez attrape un poisson chat.
|
||||||
|
You caught a Exoticfish. = Vous avez attrape un poisson exotic.
|
||||||
|
You caught a Tropical fish. = Vous avez attrape un poisson tropicale.
|
||||||
|
You caught a Twig. = Vous avez attrape une brindille.
|
||||||
|
You caught a Rat. = Vous avez attrape un rat.
|
||||||
|
You caught some Seaweed. = Vous avez attrape des algues.
|
||||||
|
You caught a Green Kelp. = Vous avez attrape une algue verte.
|
||||||
|
You caught a String. = Vous avez attrape une ficelle.
|
||||||
|
|
||||||
|
### bobber_shark.lua ###
|
||||||
|
You caught a small Shark. = Vous avez attrape un requin
|
||||||
|
You caught a Northern Pike. = Vous avez attrape un brochet.
|
||||||
|
You caught an old Fishing Pole. = Vous avez attrape une vielle canne a peche.
|
||||||
|
You caught some very old Boots. = Vous avez attrape de tres vieilles bottes.
|
||||||
|
You caught a Gold Coin. = Vous avez attrape une pice en or.
|
||||||
|
You caught a very old Helmet. = Vous avez attrape un casque tres vieux.
|
||||||
|
You caught a very old Shield. = Vous avez attrape un bouclier tres vieux.
|
||||||
|
You caught a very old Sword. = Vous avez attrape une epee tres ancienne.
|
||||||
|
You caught a mese block. = Vous avez attrape un bloc de mese.
|
||||||
|
You caught a Nyan Cat. = Vous avez attrape un Nyan Cat.
|
||||||
|
You caught a Diamond Block. = Vous avez attrape block de diamant.
|
||||||
|
Haha, Fishing is prohibited outside water! = Haha, pecher est interdit en dehors de l'eau!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### crafting.lua ###
|
||||||
|
Bait Ball = Amorce
|
||||||
|
Shark Bait Ball = Amorce a carnassier
|
||||||
|
|
||||||
|
|
||||||
|
### fishes.lua ###
|
||||||
|
Fish = Poisson
|
||||||
|
Roasted Fish = Poisson grille
|
||||||
|
Sushi (Hoso Maki) = Sushi (Hoso Maki)
|
||||||
|
Clownfish = Poisson clown
|
||||||
|
Bluewhite = Poisson bleu
|
||||||
|
Carp = Carpe
|
||||||
|
Perch = Perche
|
||||||
|
Catfish = Poisson Chat
|
||||||
|
Exoticfish = Poisson Exotique
|
||||||
|
Shark = Requin
|
||||||
|
Roasted Shark = Requin grille
|
||||||
|
Northern Pike = Brochet
|
||||||
|
Roasted Northern Pike = Brochet grille
|
||||||
|
|
||||||
|
|
||||||
|
### functions.lua ###
|
||||||
|
You don't have the server priviledge! = Vous n'avez pas les privileges serveur!
|
||||||
|
You win a new trophy, you have caught %s fish. = Vous gagnez un trophee, vous avez attrape %s poissons.
|
||||||
|
You win a new trophy, you have caught %s shark. = Vous gagnez un trophee, vous avez attrape %s requins.
|
||||||
|
You win a new trophy, you have caught %s pike. = Vous gagnez un trophee, vous avez attrape %s brochets.
|
||||||
|
You win a new trophy, you have caught %s clownfish. = Vous gagnez un trophee, vous avez attrape %s poissons clown.
|
||||||
|
You win a new trophy, you have caught %s bluewhite. = Vous gagnez un trophee, vous avez attrape %s poissons bleu.
|
||||||
|
You win a new trophy, you have caught %s carp. = Vous gagnez un trophee, vous avez attrape %s carpe.
|
||||||
|
You win a new trophy, you have caught %s perch. = Vous gagnez un trophee, vous avez attrape %s perche.
|
||||||
|
You win a new trophy, you have caught %s catfish. = Vous gagnez un trophee, vous avez attrape %s poissons chat.
|
||||||
|
You win a new trophy, you have caught %s exoticfish. = Vous gagnez un trophee, vous avez attrape %s poissons exotique.
|
||||||
|
Good luck to %s, He catch the treasure, %s! = %s a de la chance, Il attrappe le tresor, %s!
|
||||||
|
You catch the treasure, %s! = Vous attrappez le tresor, %s!
|
||||||
|
Yeah, %s caught a Fish. = Wouah, %s a attrappe un poisson
|
||||||
|
Yeah, %s caught a Clownfish. = Wouah, %s a attrappe un poisson clown.
|
||||||
|
Yeah, %s caught a Bluewhite. = Wouah, %s a attrappe un poisson bleu.
|
||||||
|
Yeah, %s caught a Carp. = Wouah, %s a attrappe une carpe.
|
||||||
|
Yeah, %s caught a Perch. = Wouah, %s a attrappe une perche.
|
||||||
|
Yeah, %s caught a Catfish. = Wouah, %s a attrappe un poisson cahet.
|
||||||
|
Yeah, %s caught a Exoticfish. = Wouah, %s a attrappe un poisson exotique.
|
||||||
|
Yeah, %s caught a Northern Pike. = Wouah, %s a attrappe un brochet.
|
||||||
|
Yeah, %s caught a small Shark. = Wouah, %s a attrappe un requin.
|
||||||
|
A fishing contest is in progress. (remaining time %s) = Un concours de peche est en cours. (temps restant %s)
|
||||||
|
Attention, Fishing contest start(duration %s)!!! = Attention, un concours de peche viens de commence(duree %s)!!!
|
||||||
|
WARNING, Fishing contest will finish in 30 seconds. = Attention, le concours de peche se termine dans 30 secondes
|
||||||
|
End of fishing contest. = Le concours est fini
|
||||||
|
|
||||||
|
### material.lua ###
|
||||||
|
View information about hunger fish = Afficher les informations sur la faim des poissons
|
||||||
|
|
||||||
|
|
||||||
|
### poles.lua ###
|
||||||
|
Fishing Pole = Canne a peche
|
||||||
|
Perfect Fishing Pole = Canne a peche parfaite
|
||||||
|
You don't fishing in a bottle! = Vous ne pouvez pas pecher dans une bouteille!
|
||||||
|
You don't have mores %s bobbers! = Vous ne pouvez pas avoir plus de %s flotteurs
|
||||||
|
|
||||||
|
### trophies.lua ###
|
||||||
|
Fish Trophy = Trophee poisson
|
||||||
|
Northern Pike Trophy = Trophee brochet
|
||||||
|
Shark Trophy = Trophee requin
|
||||||
|
Clownfish Trophy = Trophee poisson clown
|
||||||
|
Bluewhite Trophy = Trophee poisson bleu
|
||||||
|
Carp Trophy = Trophee carpe
|
||||||
|
Perch Trophy = Trophee perche
|
||||||
|
Catfish Trophy = Trophee poisson chat
|
||||||
|
Exoticfish Trophy = Trophee poisson exotique
|
||||||
|
This Huge Fish was caught by the Famous Angler %s ! = Cet enorme poisson a ete attrape par le celebre pecheur
|
||||||
|
This Huge Northern Pike was caught by the Famous Angler %s ! = Cet enorme brochet a ete attrape par le celebre pecheur
|
||||||
|
This Huge Shark was caught by the Famous Angler %s ! = Cet enorme requin a ete attrape par le celebre pecheur
|
||||||
|
This Huge Clownfish was caught by the Famous Angler %s ! = Cet enorme poisson clown a ete attrape par le celebre pecheur
|
||||||
|
This Huge Bluewhite was caught by the Famous Angler %s ! = Cet enorme poisson blue a ete attrape par le celebre pecheur
|
||||||
|
This Huge Carp was caught by the Famous Angler %s ! = Cet enorme carpe a ete attrape par le celebre pecheur
|
||||||
|
This Huge Perch was caught by the Famous Angler %s ! = Cet enorme perche a ete attrape par le celebre pecheur
|
||||||
|
This Huge Catfish was caught by the Famous Angler %s ! = Cet enorme poisson chat a ete attrape par le celebre pecheur
|
||||||
|
This Huge Exoticfish was caught by the Famous Angler %s ! = Cet enorme poisson exotique a ete attrape par le celebre pecheur
|
||||||
|
|
||||||
|
### worms.lua ###
|
||||||
|
Worm = ver
|
||||||
|
Dirt = terre
|
||||||
|
Wooden Hoe = Hoe en bois
|
||||||
|
Stone Hoe = Hoe en pierre
|
||||||
|
Steel Hoe = Hoe en fer
|
||||||
|
Bronze Hoe = Hoe en bronze
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
# Template
|
||||||
|
### baits.lua ###
|
||||||
|
Bait Corn =
|
||||||
|
Bait Bread =
|
||||||
|
|
||||||
|
|
||||||
|
### bobber.lua ###
|
||||||
|
You didn't catch anything. =
|
||||||
|
The bait is still there. =
|
||||||
|
Your fish escaped. =
|
||||||
|
You caught a Fish. =
|
||||||
|
You caught a Clownfish. =
|
||||||
|
You caught a Bluewhite. =
|
||||||
|
You caught a Carp. =
|
||||||
|
You caught a Perch. =
|
||||||
|
You caught a Catfish. =
|
||||||
|
You caught a Exoticfish. =
|
||||||
|
You caught a tropical fish. =
|
||||||
|
You caught a Twig. =
|
||||||
|
You caught a Rat. =
|
||||||
|
You caught some Seaweed. =
|
||||||
|
You caught a Green Kelp. =
|
||||||
|
You caught a String. =
|
||||||
|
|
||||||
|
### bobber_shark.lua ###
|
||||||
|
You caught a small Shark. =
|
||||||
|
You caught a Northern Pike. =
|
||||||
|
You caught an old Fishing Pole. =
|
||||||
|
You caught some very old Boots. =
|
||||||
|
You caught a Gold Coin. =
|
||||||
|
You caught a very old Helmet. =
|
||||||
|
You caught a very old Shield. =
|
||||||
|
You caught a very old Sword. =
|
||||||
|
You caught a mese block. =
|
||||||
|
You caught a Nyan Cat. =
|
||||||
|
You caught a Diamond Block. =
|
||||||
|
Haha, Fishing is prohibited outside water! =
|
||||||
|
|
||||||
|
|
||||||
|
### crafting.lua ###
|
||||||
|
Bait Ball =
|
||||||
|
Shark Bait Ball =
|
||||||
|
|
||||||
|
|
||||||
|
### fishes.lua ###
|
||||||
|
Fish =
|
||||||
|
Roasted Fish =
|
||||||
|
Sushi (Hoso Maki) =
|
||||||
|
Clownfish =
|
||||||
|
Bluefish =
|
||||||
|
Carp =
|
||||||
|
Perch =
|
||||||
|
Catfish =
|
||||||
|
Exoticfish =
|
||||||
|
Shark =
|
||||||
|
Roasted Shark =
|
||||||
|
Northern Pike =
|
||||||
|
Roasted Northern Pike =
|
||||||
|
|
||||||
|
|
||||||
|
### functions.lua ###
|
||||||
|
You don't have the server priviledge! =
|
||||||
|
You win a new trophy, you have caught %s fish. =
|
||||||
|
You win a new trophy, you have caught %s shark. =
|
||||||
|
You win a new trophy, you have caught %s pike. =
|
||||||
|
You win a new trophy, you have caught %s clownfish. =
|
||||||
|
You win a new trophy, you have caught %s bluewhite. =
|
||||||
|
You win a new trophy, you have caught %s carp. =
|
||||||
|
You win a new trophy, you have caught %s perch. =
|
||||||
|
You win a new trophy, you have caught %s catfish. =
|
||||||
|
You win a new trophy, you have caught %s exoticfish. =
|
||||||
|
Lucky %s, he caught the treasure, %s! =
|
||||||
|
You caught the treasure, %s!=
|
||||||
|
Yeah, %s caught a Fish. =
|
||||||
|
Yeah, %s caught a Clownfish. =
|
||||||
|
Yeah, %s caught a Bluefish. =
|
||||||
|
Yeah, %s caught a Carp. =
|
||||||
|
Yeah, %s caught a Perch. =
|
||||||
|
Yeah, %s caught a Catfish. =
|
||||||
|
Yeah, %s caught a Exoticfish. =
|
||||||
|
Yeah, %s caught a Northern Pike. =
|
||||||
|
Yeah, %s caught a small Shark. =
|
||||||
|
A fishing contest is in progress. (remaining time %s) =
|
||||||
|
Attention, Fishing contest start(duration %s)!!! =
|
||||||
|
WARNING, Fishing contest will finish in 30 seconds. =
|
||||||
|
End of fishing contest. =
|
||||||
|
Fishing configuration =
|
||||||
|
Fish chance =
|
||||||
|
Shark chance =
|
||||||
|
Treasure chance =
|
||||||
|
Worm chance =
|
||||||
|
Escape chance =
|
||||||
|
Bobber view range =
|
||||||
|
Display messages in chat =
|
||||||
|
Simple pole deco =
|
||||||
|
Poles wearout =
|
||||||
|
Enable treasure =
|
||||||
|
New worm source (reboot) =
|
||||||
|
Worm is a mob (reboot) =
|
||||||
|
Abort =
|
||||||
|
OK =
|
||||||
|
Fishing Menu =
|
||||||
|
Contest rankings =
|
||||||
|
Contests =
|
||||||
|
Configuration =
|
||||||
|
Close =
|
||||||
|
|
||||||
|
Fishing contest =
|
||||||
|
Duration(in sec) =
|
||||||
|
Bobber number limit =
|
||||||
|
Enable contests =
|
||||||
|
Reset rankings (type 'yes') =
|
||||||
|
Fishing contest rankings =
|
||||||
|
|
||||||
|
### material.lua ###
|
||||||
|
Show information about hunger fish =
|
||||||
|
|
||||||
|
|
||||||
|
### poles.lua ###
|
||||||
|
Fishing Pole =
|
||||||
|
Perfect Fishing Pole =
|
||||||
|
You don't fishing in a bottle! =
|
||||||
|
You don't have mores %s bobbers! =
|
||||||
|
|
||||||
|
### trophies.lua ###
|
||||||
|
Fish Trophy =
|
||||||
|
Northern Pike Trophy =
|
||||||
|
Shark Trophy =
|
||||||
|
Clownfish Trophy =
|
||||||
|
Bluefish Trophy =
|
||||||
|
Carp Trophy =
|
||||||
|
Perch Trophy =
|
||||||
|
Catfish Trophy =
|
||||||
|
Exoticfish Trophy =
|
||||||
|
This Huge Fish was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Northern Pike was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Shark was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Clownfish was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Bluefish was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Carp was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Perch was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Catfish was caught by the Famous Angler %s ! =
|
||||||
|
This Huge Exoticfish was caught by the Famous Angler %s ! =
|
||||||
|
|
||||||
|
### worms.lua ###
|
||||||
|
Worm =
|
||||||
|
Dirt =
|
||||||
|
Wooden Hoe =
|
||||||
|
Stone Hoe =
|
||||||
|
Steel Hoe =
|
||||||
|
Bronze Hoe =
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing Pole
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local S = fishing_setting.func.S
|
||||||
|
|
||||||
|
local function rod_wear(itemstack, user, pointed_thing, uses)
|
||||||
|
itemstack:add_wear(65535/(uses-1))
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
fishing_setting.poles = {}
|
||||||
|
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = S("Fishing Pole"),["bobber_max"] = 2 }
|
||||||
|
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = S("Perfect Fishing Pole"),["bobber_max"] = 5}
|
||||||
|
|
||||||
|
|
||||||
|
for _,pole in pairs(fishing_setting.poles) do
|
||||||
|
local bobbermax = pole["bobber_max"]
|
||||||
|
minetest.register_tool("fishing:pole_".. pole.name, {
|
||||||
|
description = pole.desc,
|
||||||
|
groups = {},
|
||||||
|
inventory_image = "fishing_pole_".. pole.name ..".png",
|
||||||
|
wield_image = "fishing_pole_".. pole.name ..".png",
|
||||||
|
stack_max = 1,
|
||||||
|
liquids_pointable = true,
|
||||||
|
|
||||||
|
on_use = function (itemstack, user, pointed_thing)
|
||||||
|
if pointed_thing and pointed_thing.under then
|
||||||
|
local pt = pointed_thing
|
||||||
|
local node = minetest.get_node(pt.under)
|
||||||
|
if not node or string.find(node.name, "water_source") == nil then return nil end
|
||||||
|
local player_name = user:get_player_name()
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
local bait = inv:get_stack("main", user:get_wield_index()+1 ):get_name()
|
||||||
|
if fishing_setting.baits[bait] == nil then return nil end
|
||||||
|
|
||||||
|
local objs = minetest.get_objects_inside_radius(pt.under, 1)
|
||||||
|
for m, obj in pairs(objs) do
|
||||||
|
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") then
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, S("Sorry, there is another bobber!"))
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--if contest then player must have only 2 boober
|
||||||
|
local bobber_nb = 0
|
||||||
|
local bobber_max
|
||||||
|
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
||||||
|
bobber_max = fishing_setting.contest["bobber_nb"]
|
||||||
|
else
|
||||||
|
bobber_max = bobbermax
|
||||||
|
end
|
||||||
|
--player has others bobbers?
|
||||||
|
for m, obj in pairs(minetest.get_objects_inside_radius(pt.under, 20)) do
|
||||||
|
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") ~= nil then
|
||||||
|
if obj:get_luaentity().owner == player_name then
|
||||||
|
bobber_nb = bobber_nb + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if bobber_nb >= bobber_max then
|
||||||
|
if fishing_setting.settings["message"] == true then
|
||||||
|
minetest.chat_send_player(player_name, S("You don't have mores %s bobbers!"):format(bobber_max))
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local nodes = 1
|
||||||
|
for _,k in pairs({ {1, 0}, {-1,0}, {0,1}, {0,-1} }) do
|
||||||
|
local node_name = minetest.get_node({x=pt.under.x+k[1], y=pt.under.y, z=pt.under.z+k[2]}).name
|
||||||
|
if node_name and string.find(node_name, "water_source") ~= nil
|
||||||
|
and minetest.get_node({x=pt.under.x+k[1], y=pt.under.y+1, z=pt.under.z+k[2]}).name == "air" then
|
||||||
|
nodes = nodes + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--if water == -3 nodes
|
||||||
|
if nodes < 2 then
|
||||||
|
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, S("You don't fishing in a bottle!")) end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local new_pos = {x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}
|
||||||
|
local ent = minetest.add_entity({interval = 1,x=new_pos.x, y=new_pos.y, z=new_pos.z}, fishing_setting.baits[bait].bobber)
|
||||||
|
if not ent then return nil end
|
||||||
|
local luaentity = ent:get_luaentity()
|
||||||
|
local node = minetest.get_node_or_nil(pt.under)
|
||||||
|
if node and node.name == "default:river_water_source" then
|
||||||
|
luaentity.water_type = "rivers"
|
||||||
|
else
|
||||||
|
luaentity.water_type = "sea"
|
||||||
|
end
|
||||||
|
luaentity.owner = player_name
|
||||||
|
luaentity.bait = bait
|
||||||
|
luaentity.old_pos = new_pos
|
||||||
|
luaentity.old_pos2 = true
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
inv:remove_item("main", bait)
|
||||||
|
end
|
||||||
|
minetest.sound_play("fishing_bobber2", {pos = new_pos, gain = 0.5})
|
||||||
|
if fishing_setting.settings["wear_out"] == true and not fishing_setting.is_creative_mode then
|
||||||
|
return rod_wear(itemstack, user, pointed_thing, pole.max_use)
|
||||||
|
else
|
||||||
|
return {name="fishing:pole_".. pole.name, count=1, wear=0, metadata=""}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if fishing_setting.settings["simple_deco_fishing_pole"] == false then return end
|
||||||
|
local pt = pointed_thing
|
||||||
|
local pt_under_name = minetest.get_node(pt.under).name
|
||||||
|
if string.find(pt_under_name, "water_") == nil then
|
||||||
|
local wear = itemstack:get_wear()
|
||||||
|
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
|
local dir = minetest.facedir_to_dir(direction)
|
||||||
|
local p = vector.add(pt.above, dir)
|
||||||
|
local n2 = minetest.get_node_or_nil(p)
|
||||||
|
local def = n2 and minetest.registered_items[n2.name]
|
||||||
|
if not def or not def.buildable_to then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
minetest.set_node(pt.above, {name="fishing:pole_".. pole.name .."_deco", param2=direction})
|
||||||
|
local meta = minetest.get_meta(pt.above)
|
||||||
|
meta:set_int("wear", wear)
|
||||||
|
if not fishing_setting.is_creative_mode then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("fishing:pole_".. pole.name .."_deco", {
|
||||||
|
description = pole.desc,
|
||||||
|
inventory_image = "fishing_pole_".. pole.name ..".png",
|
||||||
|
wield_image = "fishing_pole.png^[transformFXR270",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
tiles = {
|
||||||
|
"fishing_pole_".. pole.name .."_simple.png",
|
||||||
|
"fishing_pole_".. pole.name .."_simple.png",
|
||||||
|
"fishing_pole_".. pole.name .."_simple.png",
|
||||||
|
"fishing_pole_".. pole.name .."_simple.png^[transformFX",
|
||||||
|
},
|
||||||
|
groups = { snappy=3, flammable=2, not_in_creative_inventory=1 },
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ 0 , -1/2 , 0 , 0 , 1/2 , 1 },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_dig = function(pos, node, digger)
|
||||||
|
if digger:is_player() and digger:get_inventory() then
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local wear_out = meta:get_int("wear")
|
||||||
|
digger:get_inventory():add_item("main", {name="fishing:pole_".. pole.name, count=1, wear=wear_out, metadata=""})
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,83 @@
|
||||||
|
|
||||||
|
fishing_setting.prizes["rivers"] = {}
|
||||||
|
fishing_setting.prizes["rivers"]["little"] = {
|
||||||
|
{"fishing", "fish_raw", 0, "a Fish."},
|
||||||
|
{"fishing", "carp_raw", 0, "a Carp."},
|
||||||
|
}
|
||||||
|
|
||||||
|
fishing_setting.prizes["rivers"]["big"] = {
|
||||||
|
{"fishing", "pike_raw", 0, "a Northern Pike."},
|
||||||
|
{"fishing", "perch_raw", 0, "a Perch."},
|
||||||
|
{"fishing", "catfish_raw", 0, "a Catfish."},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fishing_setting.prizes["sea"] = {}
|
||||||
|
fishing_setting.prizes["sea"]["little"] = {
|
||||||
|
{"fishing", "clownfish_raw", 0, "a Clownfish."},
|
||||||
|
{"fishing", "bluewhite_raw", 0, "a Bluewhite."},
|
||||||
|
{"fishing", "exoticfish_raw", 0, "a Exoticfish."},
|
||||||
|
}
|
||||||
|
|
||||||
|
fishing_setting.prizes["sea"]["big"] = {
|
||||||
|
{"fishing", "shark_raw", 0, "a small Shark."},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (minetest.get_modpath("flowers_plus")) then -- exception flowers_plus register flowers:*
|
||||||
|
minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed")
|
||||||
|
end
|
||||||
|
|
||||||
|
local stuff = {
|
||||||
|
-- mod item wear message ("You caught "..) chance
|
||||||
|
{"flowers_plus", "seaweed", 0, "some Seaweed.", 10},
|
||||||
|
{"farming", "string", 0, "a String.", 5},
|
||||||
|
{"trunks", "twig_1", 0, "a Twig.", 5},
|
||||||
|
{"mobs", "rat", 0, "a Rat.", 5},
|
||||||
|
{"default", "stick", 0, "a Twig.", 5},
|
||||||
|
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 5},
|
||||||
|
{"3d_armor", "boots_steel", "random", "some very old Boots.", 2},
|
||||||
|
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 5},
|
||||||
|
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 5},
|
||||||
|
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 10},
|
||||||
|
{"3d_armor", "boots_wood", "random", "some very old Boots.", 5},
|
||||||
|
{"maptools", "gold_coin", 0, "a Gold Coin.", 1},
|
||||||
|
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 1},
|
||||||
|
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 2},
|
||||||
|
{"default", "sword_bronze", "random", "a very old Sword.", 2},
|
||||||
|
{"default", "sword_mese", "random", "a very old Sword.", 2},
|
||||||
|
{"default", "sword_nyan", "random", "a very old Sword.", 2},
|
||||||
|
}
|
||||||
|
|
||||||
|
fishing_setting.prizes["stuff"] = {}
|
||||||
|
local nrmin = 1
|
||||||
|
for i,v in ipairs(stuff) do
|
||||||
|
if minetest.get_modpath(v[1]) ~= nil and minetest.registered_items[v[1]..":"..v[2]] ~= nil then
|
||||||
|
table.insert(fishing_setting.prizes["stuff"], {v[1], v[2], v[3], v[4], nrmin, v[5]})
|
||||||
|
nrmin = nrmin + v[5]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local treasure = {
|
||||||
|
{"default", "mese", 0, "a mese block."},
|
||||||
|
{"default", "nyancat", 0, "a Nyan Cat."},
|
||||||
|
{"default", "diamondblock", 0, "a Diamond Block."},
|
||||||
|
}
|
||||||
|
fishing_setting.prizes["treasure"] = fishing_setting.func.ignore_mod(treasure)
|
||||||
|
|
||||||
|
|
||||||
|
-- to true fish mobs
|
||||||
|
fishing_setting.prizes["true_fish"] = {little = {}, big = {}}
|
||||||
|
--to mobs_fish modpack
|
||||||
|
if (minetest.get_modpath("mobs_fish")) then
|
||||||
|
fishing_setting.prizes["true_fish"]["little"]["mobs_fish:clownfish"] = {"mobs_fish", "clownfish", 0, "a Clownfish."}
|
||||||
|
fishing_setting.prizes["true_fish"]["little"]["mobs_fish:tropical"] = {"mobs_fish", "tropical", 0, "a tropical fish."}
|
||||||
|
end
|
||||||
|
--to mobs_fish modpack
|
||||||
|
if (minetest.get_modpath("mobs_sharks")) then
|
||||||
|
fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_lg"] = {"mobs_sharks", "shark_lg", 0, "a small Shark."}
|
||||||
|
fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_md"] = {"mobs_sharks", "shark_md", 0, "a small Shark."}
|
||||||
|
fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_sm"] = {"mobs_sharks", "shark_sm", 0, "a small Shark."}
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
MESSAGES = true
|
||||||
|
SIMPLE_DECO_FISHING_POLE = true
|
||||||
|
WEAR_OUT = true
|
||||||
|
BOBBER_VIEW_RANGE = 7
|
||||||
|
NEW_WORM_SOURCE = true
|
||||||
|
WORM_IS_MOB = true
|
||||||
|
WORM_CHANCE = 66
|
||||||
|
FISH_CHANCE = 60
|
||||||
|
SHARK_CHANCE = 50
|
||||||
|
TREASURE_CHANCE = 5
|
||||||
|
TREASURE_RANDOM_ENABLE = true
|
||||||
|
ESCAPE_CHANCE = 5
|
|
@ -0,0 +1,11 @@
|
||||||
|
These sounds are used for the Mod for Minetest; Fishing - Mossmanikin's version.
|
||||||
|
The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/
|
||||||
|
|
||||||
|
--"fishing_bobber1" & "fishing_bobber2" sampled from "01260 water swimming splashing 1.wav", Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/
|
||||||
|
|
||||||
|
|
||||||
|
"fishing_contest_start" resampled from "cor 9.mp3", Pierre Grandjean, https://www.freesound.org/people/Pierre%20Grandjean/sounds/125973/
|
||||||
|
|
||||||
|
"fishing_contest_end" resampled from "Trompette 8", jebb, https://www.freesound.org/people/jebb/sounds/205848/
|
||||||
|
|
||||||
|
"fishing_baitball" resampled from "dog steps around in water" , noctaro, https://www.freesound.org/people/noctaro/sounds/243574/
|
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 650 B |
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 231 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 521 B |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 782 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 629 B |
After Width: | Height: | Size: 180 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1000 B |
After Width: | Height: | Size: 465 B |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 200 B |
After Width: | Height: | Size: 208 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 211 B |
After Width: | Height: | Size: 312 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 563 B |
After Width: | Height: | Size: 654 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 727 B |
|
@ -0,0 +1,88 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77's version
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Trophies 0.0.2
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-- Contains code from: default
|
||||||
|
-- Supports: animal_clownfish, animal_fish_blue_white
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
local trophy = {
|
||||||
|
-- mod item name icon
|
||||||
|
{"fishing", "fish_raw", "Fish", "fishing_fish_raw.png"},
|
||||||
|
{"fishing", "carp_raw", "Carp", "fishing_carp_raw.png"},
|
||||||
|
{"fishing", "perch_raw", "Perch", "fishing_perch_raw.png"},
|
||||||
|
{"fishing", "catfish_raw", "Catfish", "fishing_catfish_raw.png"},
|
||||||
|
{"fishing", "pike_raw", "Northern Pike", "fishing_pike_raw.png"},
|
||||||
|
{"fishing", "clownfish_raw", "Clownfish", "fishing_clownfish_raw.png"},
|
||||||
|
{"fishing", "bluewhite_raw", "Bluewhite", "fishing_bluewhite_raw.png"},
|
||||||
|
{"fishing", "exoticfish_raw", "Exoticfish", "fishing_exoticfish_raw.png"},
|
||||||
|
{"fishing", "shark_raw", "Shark", "fishing_shark_raw.png"},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function has_trophy_privilege(meta, player)
|
||||||
|
if player:get_player_name() ~= meta:get_string("owner") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
for i in pairs(trophy) do
|
||||||
|
local mod = trophy[i][1]
|
||||||
|
local item = trophy[i][2]
|
||||||
|
local name = trophy[i][3]
|
||||||
|
local icon = trophy[i][4]
|
||||||
|
minetest.register_node("fishing:trophy_"..item, {
|
||||||
|
description = fishing_setting.func.S(name.." Trophy"),
|
||||||
|
inventory_image = "fishing_trophy_plank.png^"..icon.."^fishing_trophy_label.png",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = {
|
||||||
|
"fishing_trophy_plank.png", -- top
|
||||||
|
"fishing_trophy_plank.png", -- bottom
|
||||||
|
"fishing_trophy_plank.png", -- right
|
||||||
|
"fishing_trophy_plank.png", -- left
|
||||||
|
"fishing_trophy_plank.png", -- back
|
||||||
|
"fishing_trophy_plank.png^"..icon.."^fishing_trophy_label.png", -- front
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
walkable = false,
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
-- { left , bottom , front , right , top , back }
|
||||||
|
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name() or "")
|
||||||
|
meta:set_string("infotext", fishing_setting.func.S("This Huge "..name.." was caught by the Famous Angler %s !"):format((placer:get_player_name() or "")))
|
||||||
|
end,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("infotext", name)
|
||||||
|
meta:set_string("owner", "")
|
||||||
|
end,
|
||||||
|
can_dig = function(pos,player)
|
||||||
|
local meta = minetest.get_meta(pos);
|
||||||
|
return has_trophy_privilege(meta, player)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--[[
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "fishing:trophy_"..item,
|
||||||
|
recipe = {mod..":"..item, "default:sign_wall"},
|
||||||
|
})
|
||||||
|
--]]
|
||||||
|
end
|
|
@ -0,0 +1,259 @@
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- Fishing - crabman77's version
|
||||||
|
-- Rewrited from original Fishing - Mossmanikin's version - Worm 0.0.2
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- License (code & textures): WTFPL
|
||||||
|
-- Contains code from: fishing (original), mobs
|
||||||
|
-- Looked at code from: my_mobs
|
||||||
|
-- Dependencies: default
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- WORM ITEM
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_craftitem("fishing:bait_worm", {
|
||||||
|
description = fishing_setting.func.S("Worm"),
|
||||||
|
groups = { fishing_bait=1 },
|
||||||
|
inventory_image = "fishing_bait_worm.png",
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if not placer then -- can happen, e.g. if placed using minetest.place_node
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
local pt = pointed_thing
|
||||||
|
if not minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||||
|
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
on_drop = function(itemstack, dropper, pos)
|
||||||
|
minetest.add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity")
|
||||||
|
itemstack:take_item()
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- WORM MOB
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
minetest.register_entity("fishing:bait_worm_entity", {
|
||||||
|
hp_max = 300,
|
||||||
|
damage_over_time = 1,
|
||||||
|
collisionbox = {-3/16, -3/16, -3/16, 3/16, 3/16, 3/16},
|
||||||
|
visual = "sprite",
|
||||||
|
visual_size = {x=1/2, y=1/2},
|
||||||
|
textures = { "fishing_bait_worm.png", "fishing_bait_worm.png"},
|
||||||
|
view_range = 32,
|
||||||
|
-- Don't punch this poor creature...
|
||||||
|
on_punch = function(self, puncher)
|
||||||
|
self.object:remove()
|
||||||
|
end,
|
||||||
|
-- ...softly take it into your hand.
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if clicker:is_player() and clicker:get_inventory() then
|
||||||
|
clicker:get_inventory():add_item("main", "fishing:bait_worm")
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
-- AI :D
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
-- despawn when no player in range
|
||||||
|
local remove_entity = true
|
||||||
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
|
local p = player:getpos()
|
||||||
|
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
||||||
|
if dist < 25 then
|
||||||
|
remove_entity = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if remove_entity then
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local n = minetest.get_node({x=pos.x,y=pos.y-0.3,z=pos.z})
|
||||||
|
-- move in world
|
||||||
|
local look_whats_up = function(self)
|
||||||
|
self.object:set_hp(self.object:get_hp()-self.damage_over_time) -- creature is getting older
|
||||||
|
if n.name == "air" then -- fall when in air
|
||||||
|
self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z})
|
||||||
|
self.object:set_hp(self.object:get_hp()-75)
|
||||||
|
|
||||||
|
--if n.name == "snappy" then -- fall when leaves or similar
|
||||||
|
elseif minetest.get_item_group(n.name, "snappy") ~= 0 then
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))})
|
||||||
|
|
||||||
|
elseif string.find(n.name, "default:water") then -- sink when in water
|
||||||
|
self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z})
|
||||||
|
self.object:set_hp(self.object:get_hp()-37)
|
||||||
|
|
||||||
|
elseif minetest.get_item_group(n.name, "soil") ~= 0 then
|
||||||
|
if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then
|
||||||
|
self.object:set_hp(199)
|
||||||
|
elseif self.object:get_hp() > 200 then -- leave dirt to see whats going on
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y+0.003,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||||
|
elseif self.object:get_hp() < 199 then -- no rain here, let's get outa here
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y-0.001,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||||
|
elseif self.object:get_hp() == 0 then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
else -- check if there's dirt anywhere (not finished)
|
||||||
|
local check_group = minetest.get_item_group
|
||||||
|
local goal_01 = check_group(minetest.get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
||||||
|
local goal_02 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil")
|
||||||
|
local goal_03 = check_group(minetest.get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
||||||
|
local goal_04 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil")
|
||||||
|
|
||||||
|
local goal_1a = check_group(minetest.get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
||||||
|
local goal_2a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil")
|
||||||
|
local goal_3a = check_group(minetest.get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
||||||
|
local goal_4a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil")
|
||||||
|
-- if there's dirt nearby, go there
|
||||||
|
if goal_01 ~= 0 or goal_1a ~= 0 then
|
||||||
|
self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||||
|
elseif goal_02 ~= 0 or goal_2a ~= 0 then
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002})
|
||||||
|
elseif goal_03 ~= 0 or goal_3a ~= 0 then
|
||||||
|
self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||||
|
elseif goal_04 ~= 0 or goal_4a ~= 0 then
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002})
|
||||||
|
else -- I'm lost, no dirt
|
||||||
|
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
look_whats_up(self)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--- Bait Worm Entity
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "fishing:bait_worm 8",
|
||||||
|
recipe = {
|
||||||
|
{"default:dirt"},
|
||||||
|
{"default:dirt"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- GETTING WORMS
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
-- get worms from digging in dirt:
|
||||||
|
if fishing_setting.settings["new_worm_source"] == false then
|
||||||
|
minetest.register_node(":default:dirt", {
|
||||||
|
description = fishing_setting.func.S("Dirt"),
|
||||||
|
tiles = {"default_dirt.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=3},
|
||||||
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||||
|
if math.random(1, 100) <= fishing_setting.settings["worm_chance"] then
|
||||||
|
local tool_in_use = digger:get_wielded_item():get_name()
|
||||||
|
if tool_in_use == "" or tool_in_use == "default:dirt" then
|
||||||
|
if fishing_setting.settings["worm_is_mob"] == true then
|
||||||
|
minetest.add_entity({x = pos.x, y = pos.y+0.4, z = pos.z}, "fishing:bait_worm_entity")
|
||||||
|
else
|
||||||
|
local inv = digger:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
else
|
||||||
|
-- get worms from digging with hoes:
|
||||||
|
-- turns nodes with group soil=1 into soil
|
||||||
|
local function hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||||
|
local pt = pointed_thing
|
||||||
|
-- check if pointing at a node
|
||||||
|
if not pt or pt.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local under = minetest.get_node(pt.under)
|
||||||
|
local upos = pointed_thing.under
|
||||||
|
|
||||||
|
if minetest.is_protected(upos, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(upos, user:get_player_name())
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||||
|
local above = minetest.get_node(p)
|
||||||
|
|
||||||
|
-- return if any of the nodes is not registered
|
||||||
|
if not minetest.registered_nodes[under.name]
|
||||||
|
or not minetest.registered_nodes[above.name] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if the node above the pointed thing is air
|
||||||
|
if above.name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if pointing at dirt
|
||||||
|
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- turn the node into soil, wear out item and play sound
|
||||||
|
minetest.set_node(pt.under, {name="farming:soil"})
|
||||||
|
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})
|
||||||
|
|
||||||
|
if math.random(1, 100) < fishing_setting.settings["worm_chance"] then
|
||||||
|
if fishing_setting.settings["worm_is_mob"] == true then
|
||||||
|
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||||
|
else
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||||
|
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
local tool_name = itemstack:get_name()
|
||||||
|
itemstack:add_wear(65535/(uses-1))
|
||||||
|
if itemstack:get_wear() == 0 and minetest.get_modpath("invtweak") then
|
||||||
|
local index = user:get_wield_index()
|
||||||
|
minetest.sound_play("invtweak_tool_break", {pos = user:getpos(), gain = 0.9, max_hear_distance = 5})
|
||||||
|
minetest.after(0.20, refill, user, tool_name, index)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- didn't change the hoes, just here because hoe_on_use is local
|
||||||
|
minetest.register_tool(":farming:hoe_wood", {
|
||||||
|
description = fishing_setting.func.S("Wooden Hoe"),
|
||||||
|
inventory_image = "farming_tool_woodhoe.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
return hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
minetest.register_tool(":farming:hoe_stone", {
|
||||||
|
description = fishing_setting.func.S("Stone Hoe"),
|
||||||
|
inventory_image = "farming_tool_stonehoe.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
return hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
minetest.register_tool(":farming:hoe_steel", {
|
||||||
|
description = fishing_setting.func.S("Steel Hoe"),
|
||||||
|
inventory_image = "farming_tool_steelhoe.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
return hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
minetest.register_tool(":farming:hoe_bronze", {
|
||||||
|
description = fishing_setting.func.S("Bronze Hoe"),
|
||||||
|
inventory_image = "farming_tool_bronzehoe.png",
|
||||||
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
return hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
Intllib
|
||||||
|
=====================================================================
|
||||||
|
Main: kaeza
|
||||||
|
Lisc: Unlicense
|
||||||
|
Link: https://github.com/minetest-mods/intllib
|
|
@ -0,0 +1,50 @@
|
||||||
|
1,43c1,5
|
||||||
|
<
|
||||||
|
< # Internationalization Lib for Minetest
|
||||||
|
<
|
||||||
|
< By Diego Martínez (kaeza).
|
||||||
|
< Released under Unlicense. See `LICENSE.md` for details.
|
||||||
|
<
|
||||||
|
< This mod is an attempt at providing internationalization support for mods
|
||||||
|
< (something Minetest currently lacks).
|
||||||
|
<
|
||||||
|
< Should you have any comments/suggestions, please post them in the
|
||||||
|
< [forum topic][topic]. For bug reports, use the [bug tracker][bugtracker]
|
||||||
|
< on Github.
|
||||||
|
<
|
||||||
|
< ## How to use
|
||||||
|
<
|
||||||
|
< If you are a regular player looking for translated texts, just
|
||||||
|
< [install][installing_mods] this mod like any other one, then enable it
|
||||||
|
< in the GUI.
|
||||||
|
<
|
||||||
|
< The mod tries to detect your language, but since there's currently no
|
||||||
|
< portable way to do this, it tries several alternatives:
|
||||||
|
<
|
||||||
|
< * `language` setting in `minetest.conf`.
|
||||||
|
< * `LANGUAGE` environment variable.
|
||||||
|
< * `LANG` environment variable.
|
||||||
|
< * If all else fails, uses `en`.
|
||||||
|
<
|
||||||
|
< In any case, the end result should be the [ISO 639-1 Language Code][ISO639-1]
|
||||||
|
< of the desired language.
|
||||||
|
<
|
||||||
|
< ### Mod developers
|
||||||
|
<
|
||||||
|
< If you are a mod developer looking to add internationalization support to
|
||||||
|
< your mod, see `doc/developer.md`.
|
||||||
|
<
|
||||||
|
< ### Translators
|
||||||
|
<
|
||||||
|
< If you are a translator, see `doc/translator.md`.
|
||||||
|
<
|
||||||
|
< [topic]: https://forum.minetest.net/viewtopic.php?id=4929
|
||||||
|
< [bugtracker]: https://github.com/minetest-mods/intllib/issues
|
||||||
|
< [installing_mods]: https://wiki.minetest.net/Installing_mods
|
||||||
|
< [ISO639-1]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||||
|
---
|
||||||
|
> Intllib
|
||||||
|
> =====================================================================
|
||||||
|
> Main: kaeza
|
||||||
|
> Lisc: Unlicense
|
||||||
|
> Link: https://github.com/minetest-mods/intllib
|
|
@ -0,0 +1,6 @@
|
||||||
|
Item_drop
|
||||||
|
=====================================================================
|
||||||
|
Main: PilzAdam
|
||||||
|
Lisc: WTFPL
|
||||||
|
Audi: WTFPL
|
||||||
|
Link: https://github.com/Calinou/carbone-ng
|
|
@ -0,0 +1,50 @@
|
||||||
|
1,42c1,6
|
||||||
|
< ===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.
|
||||||
|
---
|
||||||
|
> Item_drop
|
||||||
|
> =====================================================================
|
||||||
|
> Main: PilzAdam
|
||||||
|
> Lisc: WTFPL
|
||||||
|
> Audi: WTFPL
|
||||||
|
> Link: https://github.com/Calinou/carbone-ng
|
|
@ -0,0 +1,124 @@
|
||||||
|
|
||||||
|
local S = mobs.intllib
|
||||||
|
|
||||||
|
|
||||||
|
-- Bunny by ExeterDad
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_animal:bunny", {
|
||||||
|
type = "animal",
|
||||||
|
passive = true,
|
||||||
|
reach = 1,
|
||||||
|
hp_min = 1,
|
||||||
|
hp_max = 4,
|
||||||
|
armor = 200,
|
||||||
|
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_bunny.b3d",
|
||||||
|
drawtype = "front",
|
||||||
|
textures = {
|
||||||
|
{"mobs_bunny_grey.png"},
|
||||||
|
{"mobs_bunny_brown.png"},
|
||||||
|
{"mobs_bunny_white.png"},
|
||||||
|
},
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_bunny",
|
||||||
|
},
|
||||||
|
makes_footstep_sound = false,
|
||||||
|
walk_velocity = 1,
|
||||||
|
run_velocity = 2,
|
||||||
|
runaway = true,
|
||||||
|
jump = true,
|
||||||
|
drops = {
|
||||||
|
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
|
||||||
|
},
|
||||||
|
water_damage = 1,
|
||||||
|
lava_damage = 4,
|
||||||
|
light_damage = 0,
|
||||||
|
fear_height = 2,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
stand_start = 1,
|
||||||
|
stand_end = 15,
|
||||||
|
walk_start = 16,
|
||||||
|
walk_end = 24,
|
||||||
|
punch_start = 16,
|
||||||
|
punch_end = 24,
|
||||||
|
},
|
||||||
|
follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"},
|
||||||
|
view_range = 8,
|
||||||
|
replace_rate = 10,
|
||||||
|
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
|
||||||
|
replace_with = "air",
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
|
-- feed or tame
|
||||||
|
if mobs:feed_tame(self, clicker, 4, true, true) then return end
|
||||||
|
if mobs:protect(self, clicker) then return end
|
||||||
|
if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
|
||||||
|
|
||||||
|
-- Monty Python tribute
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
|
if item:get_name() == "mobs:lava_orb" then
|
||||||
|
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
clicker:set_wielded_item(item)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.object:set_properties({
|
||||||
|
textures = {"mobs_bunny_evil.png"},
|
||||||
|
})
|
||||||
|
|
||||||
|
self.type = "monster"
|
||||||
|
self.health = 20
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Azure
|
||||||
|
if item:get_name() == "dye:blue" then
|
||||||
|
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
clicker:set_wielded_item(item)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.object:set_properties({
|
||||||
|
textures = {"mobs_bunny_azure.png"},
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_bunny_azure",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
self.health = 1
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
attack_type = "dogfight",
|
||||||
|
damage = 5,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
spawn_on = "ethereal:prairie_dirt"
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mobs_animal:bunny",
|
||||||
|
nodes = {spawn_on},
|
||||||
|
min_light = 10,
|
||||||
|
chance = 15000,
|
||||||
|
min_height = 0,
|
||||||
|
day_toggle = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0)
|
||||||
|
|
||||||
|
|
||||||
|
mobs:alias_mob("mobs:bunny", "mobs_animal:bunny") -- compatibility
|
|
@ -0,0 +1,124 @@
|
||||||
|
8d7
|
||||||
|
< stepheight = 0.6,
|
||||||
|
24c23,25
|
||||||
|
< sounds = {},
|
||||||
|
---
|
||||||
|
> sounds = {
|
||||||
|
> random = "mobs_bunny",
|
||||||
|
> },
|
||||||
|
29d29
|
||||||
|
< runaway_from = {"mobs_animal:pumba", "player"},
|
||||||
|
31d30
|
||||||
|
< jump_height = 6,
|
||||||
|
33,34c32
|
||||||
|
< {name = "mobs:rabbit_raw", chance = 1, min = 1, max = 1},
|
||||||
|
< {name = "mobs:rabbit_hide", chance = 1, min = 1, max = 1},
|
||||||
|
---
|
||||||
|
> {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
|
||||||
|
66c64
|
||||||
|
< if not mobs.is_creative(clicker:get_player_name()) then
|
||||||
|
---
|
||||||
|
> if not minetest.setting_getbool("creative_mode") then
|
||||||
|
80,81c78,80
|
||||||
|
< end,
|
||||||
|
< on_spawn = function(self)
|
||||||
|
---
|
||||||
|
>
|
||||||
|
> -- Azure
|
||||||
|
> if item:get_name() == "dye:blue" then
|
||||||
|
83c82,85
|
||||||
|
< local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
||||||
|
---
|
||||||
|
> if not minetest.setting_getbool("creative_mode") then
|
||||||
|
> item:take_item()
|
||||||
|
> clicker:set_wielded_item(item)
|
||||||
|
> end
|
||||||
|
85,100c87,94
|
||||||
|
< -- white snowy bunny
|
||||||
|
< if minetest.find_node_near(pos, 1,
|
||||||
|
< {"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||||
|
< self.base_texture = {"mobs_bunny_white.png"}
|
||||||
|
< self.object:set_properties({textures = self.base_texture})
|
||||||
|
< -- brown desert bunny
|
||||||
|
< elseif minetest.find_node_near(pos, 1,
|
||||||
|
< {"default:desert_sand", "default:desert_stone"}) then
|
||||||
|
< self.base_texture = {"mobs_bunny_brown.png"}
|
||||||
|
< self.object:set_properties({textures = self.base_texture})
|
||||||
|
< -- grey stone bunny
|
||||||
|
< elseif minetest.find_node_near(pos, 1,
|
||||||
|
< {"default:stone", "default:gravel"}) then
|
||||||
|
< self.base_texture = {"mobs_bunny_grey.png"}
|
||||||
|
< self.object:set_properties({textures = self.base_texture})
|
||||||
|
< end
|
||||||
|
---
|
||||||
|
> self.object:set_properties({
|
||||||
|
> textures = {"mobs_bunny_azure.png"},
|
||||||
|
> sounds = {
|
||||||
|
> random = "mobs_bunny_azure",
|
||||||
|
> },
|
||||||
|
> })
|
||||||
|
>
|
||||||
|
> self.health = 1
|
||||||
|
102c96,97
|
||||||
|
< return true -- run only once, false/nil runs every activation
|
||||||
|
---
|
||||||
|
> return
|
||||||
|
> end
|
||||||
|
103a99
|
||||||
|
>
|
||||||
|
118d113
|
||||||
|
< neighbors = {"group:grass"},
|
||||||
|
120,122c115,116
|
||||||
|
< chance = 5000, -- 15000
|
||||||
|
< min_height = 5,
|
||||||
|
< max_height = 200,
|
||||||
|
---
|
||||||
|
> chance = 15000,
|
||||||
|
> min_height = 0,
|
||||||
|
131,176d124
|
||||||
|
<
|
||||||
|
<
|
||||||
|
< -- raw rabbit
|
||||||
|
< minetest.register_craftitem(":mobs:rabbit_raw", {
|
||||||
|
< description = S("Raw Rabbit"),
|
||||||
|
< inventory_image = "mobs_rabbit_raw.png",
|
||||||
|
< on_use = minetest.item_eat(3),
|
||||||
|
< groups = {food_meat_raw = 1, food_rabbit_raw = 1, flammable = 2},
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< -- cooked rabbit
|
||||||
|
< minetest.register_craftitem(":mobs:rabbit_cooked", {
|
||||||
|
< description = S("Cooked Rabbit"),
|
||||||
|
< inventory_image = "mobs_rabbit_cooked.png",
|
||||||
|
< on_use = minetest.item_eat(5),
|
||||||
|
< groups = {food_meat = 1, food_rabbit = 1, flammable = 2},
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< minetest.register_craft({
|
||||||
|
< type = "cooking",
|
||||||
|
< output = "mobs:rabbit_cooked",
|
||||||
|
< recipe = "mobs:rabbit_raw",
|
||||||
|
< cooktime = 5,
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< -- rabbit hide
|
||||||
|
< minetest.register_craftitem(":mobs:rabbit_hide", {
|
||||||
|
< description = S("Rabbit Hide"),
|
||||||
|
< inventory_image = "mobs_rabbit_hide.png",
|
||||||
|
< groups = {flammable = 2},
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< minetest.register_craft({
|
||||||
|
< type = "fuel",
|
||||||
|
< recipe = "mobs:rabbit_hide",
|
||||||
|
< burntime = 2,
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< minetest.register_craft({
|
||||||
|
< output = "mobs:leather",
|
||||||
|
< type = "shapeless",
|
||||||
|
< recipe = {
|
||||||
|
< "mobs:rabbit_hide", "mobs:rabbit_hide",
|
||||||
|
< "mobs:rabbit_hide", "mobs:rabbit_hide"
|
||||||
|
< }
|
||||||
|
< })
|
|
@ -0,0 +1,175 @@
|
||||||
|
|
||||||
|
local S = mobs.intllib
|
||||||
|
|
||||||
|
|
||||||
|
-- Cow by Krupnovpavel (texture by Tirifto)
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_animal:cow", {
|
||||||
|
type = "animal",
|
||||||
|
passive = false,
|
||||||
|
attack_type = "dogfight",
|
||||||
|
reach = 2,
|
||||||
|
damage = 4,
|
||||||
|
hp_min = 5,
|
||||||
|
hp_max = 20,
|
||||||
|
armor = 200,
|
||||||
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_cow.x",
|
||||||
|
textures = {
|
||||||
|
{"mobs_cow_brown.png"},
|
||||||
|
{"mobs_cow_straciatella.png"},
|
||||||
|
{"mobs_cow_straciatella2.png"},
|
||||||
|
{"mobs_cow_meat.png"},
|
||||||
|
},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_cow",
|
||||||
|
},
|
||||||
|
walk_velocity = 1,
|
||||||
|
run_velocity = 2,
|
||||||
|
jump = true,
|
||||||
|
drops = {
|
||||||
|
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
|
||||||
|
{name = "mobs:leather", chance = 1, min = 1, max = 2},
|
||||||
|
},
|
||||||
|
water_damage = 1,
|
||||||
|
lava_damage = 5,
|
||||||
|
light_damage = 0,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
speed_run = 15,
|
||||||
|
stand_start = 0,
|
||||||
|
stand_end = 30,
|
||||||
|
walk_start = 35,
|
||||||
|
walk_end = 65,
|
||||||
|
run_start = 105,
|
||||||
|
run_end = 135,
|
||||||
|
punch_start = 70,
|
||||||
|
punch_end = 100,
|
||||||
|
},
|
||||||
|
follow = "farming:wheat",
|
||||||
|
view_range = 8,
|
||||||
|
replace_rate = 10,
|
||||||
|
-- replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
|
||||||
|
replace_what = {
|
||||||
|
{"group:grass", "air", 0},
|
||||||
|
{"default:dirt_with_grass", "default:dirt", -1}
|
||||||
|
},
|
||||||
|
replace_with = "air",
|
||||||
|
fear_height = 2,
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
|
-- feed or tame
|
||||||
|
if mobs:feed_tame(self, clicker, 8, true, true) then return end
|
||||||
|
if mobs:protect(self, clicker) then return end
|
||||||
|
if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
|
||||||
|
|
||||||
|
local tool = clicker:get_wielded_item()
|
||||||
|
local name = clicker:get_player_name()
|
||||||
|
|
||||||
|
-- milk cow with empty bucket
|
||||||
|
if tool:get_name() == "bucket:bucket_empty" then
|
||||||
|
|
||||||
|
--if self.gotten == true
|
||||||
|
if self.child == true then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.gotten == true then
|
||||||
|
minetest.chat_send_player(name,
|
||||||
|
S("Cow already milked!"))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local inv = clicker:get_inventory()
|
||||||
|
|
||||||
|
inv:remove_item("main", "bucket:bucket_empty")
|
||||||
|
|
||||||
|
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
|
||||||
|
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
||||||
|
else
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
pos.y = pos.y + 0.5
|
||||||
|
minetest.add_item(pos, {name = "mobs:bucket_milk"})
|
||||||
|
end
|
||||||
|
|
||||||
|
self.gotten = true -- milked
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
spawn_on = "ethereal:green_dirt"
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mobs_animal:cow",
|
||||||
|
nodes = {spawn_on},
|
||||||
|
min_light = 0,
|
||||||
|
max_light = 10,
|
||||||
|
chance = 15000,
|
||||||
|
min_height = 0,
|
||||||
|
max_height = 31000,
|
||||||
|
day_toggle = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mobs:register_egg("mobs_animal:cow", S("Cow"), "default_grass.png", 1)
|
||||||
|
|
||||||
|
|
||||||
|
mobs:alias_mob("mobs:cow", "mobs_animal:cow") -- compatibility
|
||||||
|
|
||||||
|
|
||||||
|
-- bucket of milk
|
||||||
|
minetest.register_craftitem(":mobs:bucket_milk", {
|
||||||
|
description = S("Bucket of Milk"),
|
||||||
|
inventory_image = "mobs_bucket_milk.png",
|
||||||
|
stack_max = 1,
|
||||||
|
on_use = minetest.item_eat(8, 'bucket:bucket_empty'),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- cheese wedge
|
||||||
|
minetest.register_craftitem(":mobs:cheese", {
|
||||||
|
description = S("Cheese"),
|
||||||
|
inventory_image = "mobs_cheese.png",
|
||||||
|
on_use = minetest.item_eat(4),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
output = "mobs:cheese",
|
||||||
|
recipe = "mobs:bucket_milk",
|
||||||
|
cooktime = 5,
|
||||||
|
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- cheese block
|
||||||
|
minetest.register_node(":mobs:cheeseblock", {
|
||||||
|
description = S("Cheese Block"),
|
||||||
|
tiles = {"mobs_cheeseblock.png"},
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {crumbly = 3},
|
||||||
|
sounds = default.node_sound_dirt_defaults()
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mobs:cheeseblock",
|
||||||
|
recipe = {
|
||||||
|
{'mobs:cheese', 'mobs:cheese', 'mobs:cheese'},
|
||||||
|
{'mobs:cheese', 'mobs:cheese', 'mobs:cheese'},
|
||||||
|
{'mobs:cheese', 'mobs:cheese', 'mobs:cheese'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mobs:cheese 9",
|
||||||
|
recipe = {
|
||||||
|
{'mobs:cheeseblock'},
|
||||||
|
}
|
||||||
|
})
|
|
@ -0,0 +1,47 @@
|
||||||
|
5c5
|
||||||
|
< -- Cow by Krupnovpavel (additional texture by JurajVajda)
|
||||||
|
---
|
||||||
|
> -- Cow by Krupnovpavel (texture by Tirifto)
|
||||||
|
16c16
|
||||||
|
< collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.2, 0.4},
|
||||||
|
---
|
||||||
|
> collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||||
|
20,21c20,23
|
||||||
|
< {"mobs_cow.png"},
|
||||||
|
< {"mobs_cow2.png"},
|
||||||
|
---
|
||||||
|
> {"mobs_cow_brown.png"},
|
||||||
|
> {"mobs_cow_straciatella.png"},
|
||||||
|
> {"mobs_cow_straciatella2.png"},
|
||||||
|
> {"mobs_cow_meat.png"},
|
||||||
|
30d31
|
||||||
|
< jump_height = 6,
|
||||||
|
91c92
|
||||||
|
< local pos = self.object:get_pos()
|
||||||
|
---
|
||||||
|
> local pos = self.object:getpos()
|
||||||
|
103a105,110
|
||||||
|
> local spawn_on = "default:dirt_with_grass"
|
||||||
|
>
|
||||||
|
> if minetest.get_modpath("ethereal") then
|
||||||
|
> spawn_on = "ethereal:green_dirt"
|
||||||
|
> end
|
||||||
|
>
|
||||||
|
106,111c113,118
|
||||||
|
< nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
|
||||||
|
< neighbors = {"group:grass"},
|
||||||
|
< min_light = 10,
|
||||||
|
< chance = 5000, -- 15000
|
||||||
|
< min_height = 5,
|
||||||
|
< max_height = 200,
|
||||||
|
---
|
||||||
|
> nodes = {spawn_on},
|
||||||
|
> min_light = 0,
|
||||||
|
> max_light = 10,
|
||||||
|
> chance = 15000,
|
||||||
|
> min_height = 0,
|
||||||
|
> max_height = 31000,
|
||||||
|
128d134
|
||||||
|
< groups = {food_milk = 1, flammable = 3},
|
||||||
|
136d141
|
||||||
|
< groups = {food_cheese = 1, flammable = 2},
|
|
@ -0,0 +1,283 @@
|
||||||
|
|
||||||
|
local S = mobs.intllib
|
||||||
|
|
||||||
|
|
||||||
|
-- Duck by JK Murray and Tirifto
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_animal:duck", {
|
||||||
|
type = "animal",
|
||||||
|
passive = true,
|
||||||
|
hp_min = 10,
|
||||||
|
hp_max = 40,
|
||||||
|
armor = 200,
|
||||||
|
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_chicken.x",
|
||||||
|
-- seems a lot of textures but this fixes the problem with the model
|
||||||
|
textures = {
|
||||||
|
{"mobs_duck_drake.png", "mobs_duck_drake.png", "mobs_duck_drake.png", "mobs_duck_drake.png",
|
||||||
|
"mobs_duck_drake.png", "mobs_duck_drake.png", "mobs_duck_drake.png", "mobs_duck_drake.png",
|
||||||
|
"mobs_duck_drake.png"},
|
||||||
|
{"mobs_duck_female.png", "mobs_duck_female.png", "mobs_duck_female.png", "mobs_duck_female.png",
|
||||||
|
"mobs_duck_female.png", "mobs_duck_female.png", "mobs_duck_female.png", "mobs_duck_female.png",
|
||||||
|
"mobs_duck_female.png"},
|
||||||
|
},
|
||||||
|
child_texture = {
|
||||||
|
{"mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png",
|
||||||
|
"mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png"},
|
||||||
|
},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_duck",
|
||||||
|
},
|
||||||
|
walk_velocity = 3,
|
||||||
|
run_velocity = 5,
|
||||||
|
runaway = true,
|
||||||
|
drops = {
|
||||||
|
{name = "mobs:duck_raw", chance = 3, min = 1, max = 2},
|
||||||
|
{name = "mobs:chicken_feather", chance = 5, min = 1, max = 3},
|
||||||
|
},
|
||||||
|
water_damage = 0,
|
||||||
|
lava_damage = 5,
|
||||||
|
light_damage = 0,
|
||||||
|
fall_damage = 0,
|
||||||
|
fall_speed = -8,
|
||||||
|
fear_height = 100,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
stand_start = 0,
|
||||||
|
stand_end = 1, -- 20
|
||||||
|
walk_start = 20,
|
||||||
|
walk_end = 40,
|
||||||
|
},
|
||||||
|
floats = 1,
|
||||||
|
follow = {"farming:wheat_seed", "farming:cotton_seed"},
|
||||||
|
view_range = 5,
|
||||||
|
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
|
if mobs:feed_tame(self, clicker, 8, true, true) then return end
|
||||||
|
if mobs:protect(self, clicker) then return end
|
||||||
|
if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
|
||||||
|
end,
|
||||||
|
|
||||||
|
do_custom = function(self, dtime)
|
||||||
|
|
||||||
|
self.egg_timer = (self.egg_timer or 0) + dtime
|
||||||
|
if self.egg_timer < 10 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.egg_timer = 0
|
||||||
|
|
||||||
|
if self.child
|
||||||
|
or math.random(1, 100) > 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
|
||||||
|
minetest.add_item(pos, "mobs:duck_egg")
|
||||||
|
|
||||||
|
minetest.sound_play("default_place_node_hard", {
|
||||||
|
pos = pos,
|
||||||
|
gain = 1.0,
|
||||||
|
max_hear_distance = 5,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local spawn_on = "default:water_source"
|
||||||
|
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
spawn_on = "ethereal:bamboo_dirt"
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mobs_animal:duck",
|
||||||
|
nodes = {spawn_on},
|
||||||
|
min_light = 5,
|
||||||
|
chance = 15000,
|
||||||
|
active_object_count = 2,
|
||||||
|
min_height = 0,
|
||||||
|
day_toggle = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mobs:register_egg("mobs_animal:duck", S("Duck"), "mobs_duck_inv.png", 0)
|
||||||
|
|
||||||
|
|
||||||
|
mobs:alias_mob("mobs:duck", "mobs_animal:duck") -- compatibility
|
||||||
|
|
||||||
|
|
||||||
|
-- duck egg entity
|
||||||
|
|
||||||
|
mobs:register_arrow("mobs_animal:duck_egg_entity", {
|
||||||
|
visual = "sprite",
|
||||||
|
visual_size = {x=.5, y=.5},
|
||||||
|
textures = {"mobs_duck_egg.png"},
|
||||||
|
velocity = 6,
|
||||||
|
|
||||||
|
hit_player = function(self, player)
|
||||||
|
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = 1},
|
||||||
|
}, nil)
|
||||||
|
end,
|
||||||
|
|
||||||
|
hit_mob = function(self, player)
|
||||||
|
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
|
||||||
|
full_punch_interval = 1.0,
|
||||||
|
damage_groups = {fleshy = 1},
|
||||||
|
}, nil)
|
||||||
|
end,
|
||||||
|
|
||||||
|
hit_node = function(self, pos, node)
|
||||||
|
|
||||||
|
if math.random(1, 10) > 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
|
local nod = minetest.get_node_or_nil(pos)
|
||||||
|
|
||||||
|
if not nod
|
||||||
|
or not minetest.registered_nodes[nod.name]
|
||||||
|
or minetest.registered_nodes[nod.name].walkable == true then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local mob = minetest.add_entity(pos, "mobs_animal:duck")
|
||||||
|
local ent2 = mob:get_luaentity()
|
||||||
|
|
||||||
|
mob:set_properties({
|
||||||
|
textures = ent2.child_texture[1],
|
||||||
|
visual_size = {
|
||||||
|
x = ent2.base_size.x / 2,
|
||||||
|
y = ent2.base_size.y / 2
|
||||||
|
},
|
||||||
|
collisionbox = {
|
||||||
|
ent2.base_colbox[1] / 2,
|
||||||
|
ent2.base_colbox[2] / 2,
|
||||||
|
ent2.base_colbox[3] / 2,
|
||||||
|
ent2.base_colbox[4] / 2,
|
||||||
|
ent2.base_colbox[5] / 2,
|
||||||
|
ent2.base_colbox[6] / 2
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
ent2.child = true
|
||||||
|
ent2.tamed = true
|
||||||
|
ent2.owner = self.playername
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- egg throwing item
|
||||||
|
|
||||||
|
local egg_GRAVITY = 9
|
||||||
|
local egg_VELOCITY = 19
|
||||||
|
|
||||||
|
-- shoot egg
|
||||||
|
local mobs_shoot_egg = function (item, player, pointed_thing)
|
||||||
|
|
||||||
|
local playerpos = player:getpos()
|
||||||
|
|
||||||
|
minetest.sound_play("default_place_node_hard", {
|
||||||
|
pos = playerpos,
|
||||||
|
gain = 1.0,
|
||||||
|
max_hear_distance = 5,
|
||||||
|
})
|
||||||
|
|
||||||
|
local obj = minetest.add_entity({
|
||||||
|
x = playerpos.x,
|
||||||
|
y = playerpos.y +1.5,
|
||||||
|
z = playerpos.z
|
||||||
|
}, "mobs_animal:duck_egg_entity")
|
||||||
|
|
||||||
|
local ent = obj:get_luaentity()
|
||||||
|
local dir = player:get_look_dir()
|
||||||
|
|
||||||
|
ent.velocity = egg_VELOCITY -- needed for api internal timing
|
||||||
|
ent.switch = 1 -- needed so that egg doesn't despawn straight away
|
||||||
|
|
||||||
|
obj:setvelocity({
|
||||||
|
x = dir.x * egg_VELOCITY,
|
||||||
|
y = dir.y * egg_VELOCITY,
|
||||||
|
z = dir.z * egg_VELOCITY
|
||||||
|
})
|
||||||
|
|
||||||
|
obj:setacceleration({
|
||||||
|
x = dir.x * -3,
|
||||||
|
y = -egg_GRAVITY,
|
||||||
|
z = dir.z * -3
|
||||||
|
})
|
||||||
|
|
||||||
|
-- pass player name to egg for chick ownership
|
||||||
|
local ent2 = obj:get_luaentity()
|
||||||
|
ent2.playername = player:get_player_name()
|
||||||
|
|
||||||
|
item:take_item()
|
||||||
|
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- egg
|
||||||
|
minetest.register_node(":mobs:duck_egg", {
|
||||||
|
description = S("Duck Egg"),
|
||||||
|
tiles = {"mobs_duck_egg.png"},
|
||||||
|
inventory_image = "mobs_duck_egg.png",
|
||||||
|
visual_scale = 0.7,
|
||||||
|
drawtype = "plantlike",
|
||||||
|
wield_image = "mobs_duck_egg.png",
|
||||||
|
paramtype = "light",
|
||||||
|
walkable = false,
|
||||||
|
is_ground_content = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
|
||||||
|
},
|
||||||
|
groups = {snappy = 2, dig_immediate = 3},
|
||||||
|
after_place_node = function(pos, placer, itemstack)
|
||||||
|
if placer:is_player() then
|
||||||
|
minetest.set_node(pos, {name = "mobs:duck_egg", param2 = 1})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_use = mobs_shoot_egg
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
recipe = "mobs:duck_egg",
|
||||||
|
output = "mobs:chicken_egg_fried",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- raw chicken
|
||||||
|
minetest.register_craftitem(":mobs:duck_raw", {
|
||||||
|
description = S("Raw Duck"),
|
||||||
|
inventory_image = "mobs_duck_raw.png",
|
||||||
|
on_use = minetest.item_eat(3),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- cooked chicken
|
||||||
|
minetest.register_craftitem(":mobs:duck_cooked", {
|
||||||
|
description = S("Cooked Duck"),
|
||||||
|
inventory_image = "mobs_duck_cooked.png",
|
||||||
|
on_use = minetest.item_eat(9),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "cooking",
|
||||||
|
recipe = "mobs:duck_raw",
|
||||||
|
output = "mobs:duck_cooked",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- feather
|
||||||
|
minetest.register_craftitem(":mobs:chicken_feather", {
|
||||||
|
description = S("Feather"),
|
||||||
|
inventory_image = "mobs_chicken_feather.png",
|
||||||
|
})
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
local path = minetest.get_modpath("mobs_animal")
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
mobs.intllib = S
|
||||||
|
|
||||||
|
-- Animals
|
||||||
|
|
||||||
|
dofile(path .. "/chicken.lua") -- JKmurray
|
||||||
|
dofile(path .. "/cow.lua") -- KrupnoPavel
|
||||||
|
dofile(path .. "/duck.lua") -- JKmurray, Tirifto
|
||||||
|
dofile(path .. "/rat.lua") -- PilzAdam
|
||||||
|
dofile(path .. "/sheep.lua") -- PilzAdam
|
||||||
|
dofile(path .. "/warthog.lua") -- KrupnoPavel
|
||||||
|
dofile(path .. "/bee.lua") -- KrupnoPavel
|
||||||
|
dofile(path .. "/bunny.lua") -- ExeterDad
|
||||||
|
dofile(path .. "/kitten.lua") -- Jordach/BFD
|
||||||
|
dofile(path .. "/penguin.lua") -- D00Med
|
||||||
|
|
||||||
|
|
||||||
|
dofile(path .. "/lucky_block.lua")
|
||||||
|
|
||||||
|
print (S("[MOD] Mobs Redo 'Animals' loaded"))
|
|
@ -0,0 +1,4 @@
|
||||||
|
12a13
|
||||||
|
> dofile(path .. "/duck.lua") -- JKmurray, Tirifto
|
||||||
|
19a21
|
||||||
|
>
|
|
@ -0,0 +1,210 @@
|
||||||
|
|
||||||
|
local S = mobs.intllib
|
||||||
|
|
||||||
|
|
||||||
|
local all_colours = {
|
||||||
|
{"black", S("Black"), "#000000b0"},
|
||||||
|
{"blue", S("Blue"), "#015dbb70"},
|
||||||
|
{"brown", S("Brown"), "#663300a0"},
|
||||||
|
{"cyan", S("Cyan"), "#01ffd870"},
|
||||||
|
{"dark_green", S("Dark Green"), "#005b0770"},
|
||||||
|
{"dark_grey", S("Dark Grey"), "#303030b0"},
|
||||||
|
{"green", S("Green"), "#61ff0170"},
|
||||||
|
{"grey", S("Grey"), "#5b5b5bb0"},
|
||||||
|
{"magenta", S("Magenta"), "#ff05bb70"},
|
||||||
|
{"orange", S("Orange"), "#ff840170"},
|
||||||
|
{"pink", S("Pink"), "#ff65b570"},
|
||||||
|
{"red", S("Red"), "#ff0000a0"},
|
||||||
|
{"violet", S("Violet"), "#2000c970"},
|
||||||
|
{"white", S("White"), "#abababc0"},
|
||||||
|
{"yellow", S("Yellow"), "#e3ff0070"},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- Sheep by PilzAdam, texture converted to minetest by AMMOnym from Summerfield pack
|
||||||
|
|
||||||
|
for _, col in ipairs(all_colours) do
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_animal:sheep_"..col[1], {
|
||||||
|
type = "monster",
|
||||||
|
passive = false,
|
||||||
|
attack_type = "dogfight",
|
||||||
|
pathfinding = true,
|
||||||
|
reach = 2,
|
||||||
|
hp_min = 8,
|
||||||
|
hp_max = 10,
|
||||||
|
armor = 200,
|
||||||
|
collisionbox = {-0.5, -1, -0.5, 0.5, 0.3, 0.5},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_sheep.b3d",
|
||||||
|
textures = {
|
||||||
|
{"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
|
||||||
|
},
|
||||||
|
gotten_texture = {"mobs_sheep_shaved.png"},
|
||||||
|
gotten_mesh = "mobs_sheep_shaved.b3d",
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_sheep",
|
||||||
|
},
|
||||||
|
walk_velocity = 1,
|
||||||
|
run_velocity = 2,
|
||||||
|
runaway = true,
|
||||||
|
jump = true,
|
||||||
|
drops = {
|
||||||
|
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
|
||||||
|
--{name = "wool:"..col[1], chance = 1, min = 1, max = 1},
|
||||||
|
},
|
||||||
|
water_damage = 1,
|
||||||
|
lava_damage = 5,
|
||||||
|
light_damage = 0,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 15,
|
||||||
|
speed_run = 15,
|
||||||
|
stand_start = 0,
|
||||||
|
stand_end = 80,
|
||||||
|
walk_start = 81,
|
||||||
|
walk_end = 100,
|
||||||
|
},
|
||||||
|
follow = {"farming:wheat_harvested", "default:grass_5"},
|
||||||
|
view_range = 8,
|
||||||
|
replace_rate = 10,
|
||||||
|
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
|
||||||
|
replace_with = "air",
|
||||||
|
replace_offset = -1,
|
||||||
|
fear_height = 3,
|
||||||
|
--[[
|
||||||
|
on_replace = function(self, pos, oldnode, newnode)
|
||||||
|
print ("---- replaced") ; return false -- false to keep node, true to replace
|
||||||
|
end,
|
||||||
|
]]
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
|
--are we feeding?
|
||||||
|
if mobs:feed_tame(self, clicker, 8, true, true) then
|
||||||
|
|
||||||
|
--if full grow fuzz
|
||||||
|
if self.gotten == false then
|
||||||
|
|
||||||
|
self.object:set_properties({
|
||||||
|
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
|
||||||
|
mesh = "mobs_sheep.b3d",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
local itemname = item:get_name()
|
||||||
|
|
||||||
|
--are we giving a haircut>
|
||||||
|
if itemname == "mobs:shears" then
|
||||||
|
|
||||||
|
if self.gotten ~= false
|
||||||
|
or self.child ~= false
|
||||||
|
or not minetest.get_modpath("wool") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.gotten = true -- shaved
|
||||||
|
|
||||||
|
local obj = minetest.add_item(
|
||||||
|
self.object:getpos(),
|
||||||
|
ItemStack( "wool:" .. col[1] .. " " .. math.random(1, 3) )
|
||||||
|
)
|
||||||
|
|
||||||
|
if obj then
|
||||||
|
|
||||||
|
obj:setvelocity({
|
||||||
|
x = math.random(-1, 1),
|
||||||
|
y = 5,
|
||||||
|
z = math.random(-1, 1)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
item:add_wear(650) -- 100 uses
|
||||||
|
|
||||||
|
clicker:set_wielded_item(item)
|
||||||
|
|
||||||
|
self.object:set_properties({
|
||||||
|
textures = {"mobs_sheep_shaved.png"},
|
||||||
|
mesh = "mobs_sheep_shaved.b3d",
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = clicker:get_player_name()
|
||||||
|
|
||||||
|
--are we coloring?
|
||||||
|
if itemname:find("dye:") then
|
||||||
|
|
||||||
|
if self.gotten == false
|
||||||
|
and self.child == false
|
||||||
|
and self.tamed == true
|
||||||
|
and name == self.owner then
|
||||||
|
|
||||||
|
local colr = string.split(itemname, ":")[2]
|
||||||
|
|
||||||
|
for _,c in pairs(all_colours) do
|
||||||
|
|
||||||
|
if c[1] == colr then
|
||||||
|
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
|
||||||
|
self.object:remove()
|
||||||
|
|
||||||
|
local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr)
|
||||||
|
local ent = mob:get_luaentity()
|
||||||
|
|
||||||
|
ent.owner = name
|
||||||
|
ent.tamed = true
|
||||||
|
|
||||||
|
-- take item
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
clicker:set_wielded_item(item)
|
||||||
|
end
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- protect mod with mobs:protector item
|
||||||
|
if mobs:protect(self, clicker) then return end
|
||||||
|
|
||||||
|
--are we capturing?
|
||||||
|
if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
mobs:register_egg("mobs_animal:sheep_"..col[1], col[2] .. " " .. S("Sheep"), "wool_"..col[1]..".png", 1)
|
||||||
|
|
||||||
|
-- compatibility
|
||||||
|
mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
|
if minetest.get_modpath("ethereal") then
|
||||||
|
spawn_on = "ethereal:green_dirt"
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mobs_animal:sheep_white",
|
||||||
|
nodes = {spawn_on},
|
||||||
|
min_light = 10,
|
||||||
|
chance = 15000,
|
||||||
|
min_height = 0,
|
||||||
|
max_height = 31000,
|
||||||
|
day_toggle = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") -- compatibility
|
|
@ -0,0 +1,87 @@
|
||||||
|
29,31c29,33
|
||||||
|
< stepheight = 0.6,
|
||||||
|
< type = "animal",
|
||||||
|
< passive = true,
|
||||||
|
---
|
||||||
|
> type = "monster",
|
||||||
|
> passive = false,
|
||||||
|
> attack_type = "dogfight",
|
||||||
|
> pathfinding = true,
|
||||||
|
> reach = 2,
|
||||||
|
51d52
|
||||||
|
< jump_height = 6,
|
||||||
|
53c54
|
||||||
|
< {name = "mobs:mutton_raw", chance = 1, min = 1, max = 2},
|
||||||
|
---
|
||||||
|
> {name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
|
||||||
|
67c68
|
||||||
|
< follow = {"farming:wheat", "default:grass_5"},
|
||||||
|
---
|
||||||
|
> follow = {"farming:wheat_harvested", "default:grass_5"},
|
||||||
|
98d98
|
||||||
|
< local name = clicker:get_player_name()
|
||||||
|
105d104
|
||||||
|
< or name ~= self.owner
|
||||||
|
113c112
|
||||||
|
< self.object:get_pos(),
|
||||||
|
---
|
||||||
|
> self.object:getpos(),
|
||||||
|
137a137,138
|
||||||
|
> local name = clicker:get_player_name()
|
||||||
|
>
|
||||||
|
152c153
|
||||||
|
< local pos = self.object:get_pos()
|
||||||
|
---
|
||||||
|
> local pos = self.object:getpos()
|
||||||
|
163c164
|
||||||
|
< if not mobs.is_creative(clicker:get_player_name()) then
|
||||||
|
---
|
||||||
|
> if not minetest.setting_getbool("creative_mode") then
|
||||||
|
184c185
|
||||||
|
< mobs:register_egg("mobs_animal:sheep_"..col[1], S("@1 Sheep", col[2]), "wool_"..col[1]..".png", 1)
|
||||||
|
---
|
||||||
|
> mobs:register_egg("mobs_animal:sheep_"..col[1], col[2] .. " " .. S("Sheep"), "wool_"..col[1]..".png", 1)
|
||||||
|
191a193,198
|
||||||
|
> local spawn_on = "default:dirt_with_grass"
|
||||||
|
>
|
||||||
|
> if minetest.get_modpath("ethereal") then
|
||||||
|
> spawn_on = "ethereal:green_dirt"
|
||||||
|
> end
|
||||||
|
>
|
||||||
|
194,195c201
|
||||||
|
< nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
|
||||||
|
< neighbors = {"group:grass"},
|
||||||
|
---
|
||||||
|
> nodes = {spawn_on},
|
||||||
|
197c203
|
||||||
|
< chance = 5000, -- 15000
|
||||||
|
---
|
||||||
|
> chance = 15000,
|
||||||
|
199c205
|
||||||
|
< max_height = 200,
|
||||||
|
---
|
||||||
|
> max_height = 31000,
|
||||||
|
205,227d210
|
||||||
|
<
|
||||||
|
< -- raw mutton
|
||||||
|
< minetest.register_craftitem(":mobs:mutton_raw", {
|
||||||
|
< description = S("Raw Mutton"),
|
||||||
|
< inventory_image = "mobs_mutton_raw.png",
|
||||||
|
< on_use = minetest.item_eat(2),
|
||||||
|
< groups = {food_meat_raw = 1, food_mutton_raw = 1, flammable = 2},
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< -- cooked mutton
|
||||||
|
< minetest.register_craftitem(":mobs:mutton_cooked", {
|
||||||
|
< description = S("Cooked Mutton"),
|
||||||
|
< inventory_image = "mobs_mutton_cooked.png",
|
||||||
|
< on_use = minetest.item_eat(6),
|
||||||
|
< groups = {food_meat = 1, food_mutton = 1, flammable = 2},
|
||||||
|
< })
|
||||||
|
<
|
||||||
|
< minetest.register_craft({
|
||||||
|
< type = "cooking",
|
||||||
|
< output = "mobs:mutton_cooked",
|
||||||
|
< recipe = "mobs:mutton_raw",
|
||||||
|
< cooktime = 5,
|
||||||
|
< })
|