]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in fishing
authoroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 20 May 2020 18:50:10 +0000 (14:50 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Wed, 20 May 2020 18:50:10 +0000 (14:50 -0400)
21 files changed:
README.md
mods/fishing/init.lua
mods/fishing/models/lure.b3d [deleted file]
mods/fishing/models/lure.blend [deleted file]
mods/fishing/models/lure.blend1 [deleted file]
mods/fishing/models/lure.png [deleted file]
mods/fishing/sounds/attributes.txt [new file with mode: 0644]
mods/fishing/sounds/line_break.1.ogg [new file with mode: 0644]
mods/fishing/sounds/line_break.2.ogg [new file with mode: 0644]
mods/fishing/textures/attributes
mods/fishing/textures/fish.png [new file with mode: 0644]
mods/fishing/textures/fish_cooked.png [new file with mode: 0644]
mods/fishing/textures/lure.png [new file with mode: 0644]
mods/fishing/textures/mcl_fishing_bobber.png [deleted file]
mods/fishing/textures/mcl_fishing_clownfish_raw.png [deleted file]
mods/fishing/textures/mcl_fishing_fish_cooked.png [deleted file]
mods/fishing/textures/mcl_fishing_fish_raw.png [deleted file]
mods/fishing/textures/mcl_fishing_pufferfish_raw.png [deleted file]
mods/fishing/textures/mcl_fishing_salmon_cooked.png [deleted file]
mods/fishing/textures/mcl_fishing_salmon_raw.png [deleted file]
mods/mob/items.lua

index 3e7e867bee250291e6e46d618853e333188c50ae..7bc6c3fd2563443a65e6dfffb1361ab9241ec600 100644 (file)
--- a/README.md
+++ b/README.md
@@ -126,7 +126,11 @@ enable_mod_channels = true
 - Added in 22i's slime model
 - Exploding mobs now instantly dissapear when detonated
 - Added in gunpowder and tnt is now made from it
-- Added in prototype spider
+- Added in spider
+- Improved mob jumping
+- Added in string
+- Added in fishing - Fishing poles are made from sticks and string
+- Fixed raw porkchops not being edible
 ---
 
 
index 2463441772f7337f2f98e59025cbe2491689a9bd..014af90aa8696db513b5338eb27b6e12de2f293d 100644 (file)
        end,
        
        on_secondary_use = function(itemstack, user, pointed_thing)
-               if not players_fishing[name] then
+               local name = user:get_player_name()
+               if not players_fishing[name] or not players_fishing[name]:get_luaentity() then
                        local pos = user:get_pos()
             local anchor = table.copy(pos)
                        pos.y = pos.y + 1.625
                        --minetest.sound_play("gun_shot",{object=user, pitch = math.random(80,100)/100})
                        local dir = user:get_look_dir()
                        local force = vector.multiply(dir,20)
-                       local name = user:get_player_name()
                        local obj = minetest.add_entity(pos,"fishing:lure")
                        if obj then
                                minetest.sound_play("woosh",{pos=pos})
        end,
 })
 
+minetest.register_craft({
+       output = "fishing:pole",
+       recipe = {
+               {"",          "",           "main:stick"},
+               {"",          "main:stick", "mob:string"},
+               {"main:stick","",           "mob:string"},
+       }
+})
+
 
 local lure = {}
 lure.initial_properties = {
        physical = false,
        collide_with_objects = false,
        collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
-       visual = "mesh",
-       visual_size = {x = 1, y = 1},
-       mesh = "lure.b3d",
-       textures = {
-               "lure.png"
-       },
+       visual = "sprite",
+       visual_size = {x = 0.25, y = 0.25},
+       textures = {"lure.png"},
        is_visible = true,
        pointable = false,
        --glow = -1,
@@ -54,6 +60,7 @@ lure.on_activate = function(self)
 end
 lure.in_water = false
 lure.interplayer = nil
+lure.catch_timer = 0
 lure.on_step = function(self, dtime)
        local pos = self.object:get_pos()
        local node = minetest.get_node(pos).name
@@ -68,10 +75,11 @@ lure.on_step = function(self, dtime)
         local newp = table.copy(pos)
         newp.y = newp.y - 0.1
         local node = minetest.get_node(newp).name
-        if node ~= "air" and node ~= "main:water" and node ~= "main:waterflow" then
+               if node ~= "air" and node ~= "main:water" and node ~= "main:waterflow" then
             if self.player then
-                players_fishing[self.player] = nil
-            end
+                               players_fishing[self.player] = nil
+                       end
+                       minetest.sound_play("line_break",{pos=pos,gain=0.3})
             self.object:remove()
         end
        end
@@ -80,27 +88,37 @@ lure.on_step = function(self, dtime)
                        local p = minetest.get_player_by_name(self.player)
                        if p:get_player_control().RMB then
                 local pos2 = p:get_pos()
-                               local vel = vector.direction(pos,pos2)
+                               local vel = vector.direction(vector.new(pos.x,0,pos.z),vector.new(pos2.x,0,pos2.z))
                                self.object:set_velocity(vector.multiply(vel,2))
-                if math.random() > 0.97 then
-                   local obj = minetest.add_item(pos, "main:dirt")
-                   if obj then
-                       local distance = vector.distance(pos,pos2)
-                       local dir = vector.direction(pos,pos2)
-                       local force = vector.multiply(dir,distance)
-                       force.y = 6
-                       obj:set_velocity(force)
-                   end
-                   players_fishing[self.player] = nil
-                   self.object:remove()
+
+
+                               self.catch_timer = self.catch_timer + dtime
+
+                               if self.catch_timer >= 0.5 then
+                                       print("trying")
+                                       self.catch_timer = 0
+                                       if math.random() > 0.96 then
+                                               local obj = minetest.add_item(pos, "fishing:fish")
+                                               if obj then
+                                                       local distance = vector.distance(pos,pos2)
+                                                       local dir = vector.direction(pos,pos2)
+                                                       local force = vector.multiply(dir,distance)
+                                                       force.y = 6
+                                                       obj:set_velocity(force)
+                                                       minetest.sound_play("splash",{pos=obj:get_pos(),gain=0.25})
+                                               end
+                                               players_fishing[self.player] = nil
+                                               self.object:remove()
+                                       end
                 end
                        else
                                self.object:set_velocity(vector.new(0,0,0))
                        end
             if p then
                 local pos2 = p:get_pos()
-                if vector.distance(pos, pos2) < 1 then
-                    players_fishing[self.player] = nil
+                if vector.distance(vector.new(pos.x,0,pos.z),vector.new(pos2.x,0,pos2.z)) < 1 then
+                                       players_fishing[self.player] = nil
+                                       minetest.sound_play("line_break",{pos=pos,gain=0.3,pitch=0.5})
                     self.object:remove()
                 end
             end
@@ -111,3 +129,20 @@ lure.on_step = function(self, dtime)
        end
 end
 minetest.register_entity("fishing:lure", lure)
+
+minetest.register_craft({
+       type = "cooking",
+       output = "fishing:fish_cooked",
+       recipe = "fishing:fish",
+})
+
+minetest.register_craftitem("fishing:fish", {
+       description = "Raw Fish",
+       inventory_image = "fish.png",
+       groups = {satiation=1,hunger=2},
+})
+minetest.register_craftitem("fishing:fish_cooked", {
+       description = "Cooked Fish",
+       inventory_image = "fish_cooked.png",
+       groups = {satiation=3,hunger=5},
+})
\ No newline at end of file
diff --git a/mods/fishing/models/lure.b3d b/mods/fishing/models/lure.b3d
deleted file mode 100644 (file)
index d4b4f4a..0000000
Binary files a/mods/fishing/models/lure.b3d and /dev/null differ
diff --git a/mods/fishing/models/lure.blend b/mods/fishing/models/lure.blend
deleted file mode 100644 (file)
index 64a4cfe..0000000
Binary files a/mods/fishing/models/lure.blend and /dev/null differ
diff --git a/mods/fishing/models/lure.blend1 b/mods/fishing/models/lure.blend1
deleted file mode 100644 (file)
index 09343a9..0000000
Binary files a/mods/fishing/models/lure.blend1 and /dev/null differ
diff --git a/mods/fishing/models/lure.png b/mods/fishing/models/lure.png
deleted file mode 100644 (file)
index 1b9e364..0000000
Binary files a/mods/fishing/models/lure.png and /dev/null differ
diff --git a/mods/fishing/sounds/attributes.txt b/mods/fishing/sounds/attributes.txt
new file mode 100644 (file)
index 0000000..89a914c
--- /dev/null
@@ -0,0 +1 @@
+line_break - https://freesound.org/people/DSA98/sounds/393156/ Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)
\ No newline at end of file
diff --git a/mods/fishing/sounds/line_break.1.ogg b/mods/fishing/sounds/line_break.1.ogg
new file mode 100644 (file)
index 0000000..76419ab
Binary files /dev/null and b/mods/fishing/sounds/line_break.1.ogg differ
diff --git a/mods/fishing/sounds/line_break.2.ogg b/mods/fishing/sounds/line_break.2.ogg
new file mode 100644 (file)
index 0000000..fbc90d5
Binary files /dev/null and b/mods/fishing/sounds/line_break.2.ogg differ
index 891c0cdca7c26735c890c385fdd790b9627077a3..746099addc1ca2c2e1db5326289d0b3a6580d61a 100644 (file)
@@ -1 +1 @@
- Regular fish - Mineclone 2
+fish,lure,fishing_rod - Mineclone 2
\ No newline at end of file
diff --git a/mods/fishing/textures/fish.png b/mods/fishing/textures/fish.png
new file mode 100644 (file)
index 0000000..eeac24b
Binary files /dev/null and b/mods/fishing/textures/fish.png differ
diff --git a/mods/fishing/textures/fish_cooked.png b/mods/fishing/textures/fish_cooked.png
new file mode 100644 (file)
index 0000000..8bede67
Binary files /dev/null and b/mods/fishing/textures/fish_cooked.png differ
diff --git a/mods/fishing/textures/lure.png b/mods/fishing/textures/lure.png
new file mode 100644 (file)
index 0000000..0c93fd4
Binary files /dev/null and b/mods/fishing/textures/lure.png differ
diff --git a/mods/fishing/textures/mcl_fishing_bobber.png b/mods/fishing/textures/mcl_fishing_bobber.png
deleted file mode 100755 (executable)
index 0c93fd4..0000000
Binary files a/mods/fishing/textures/mcl_fishing_bobber.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_clownfish_raw.png b/mods/fishing/textures/mcl_fishing_clownfish_raw.png
deleted file mode 100755 (executable)
index 5681bd6..0000000
Binary files a/mods/fishing/textures/mcl_fishing_clownfish_raw.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_fish_cooked.png b/mods/fishing/textures/mcl_fishing_fish_cooked.png
deleted file mode 100755 (executable)
index 8bede67..0000000
Binary files a/mods/fishing/textures/mcl_fishing_fish_cooked.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_fish_raw.png b/mods/fishing/textures/mcl_fishing_fish_raw.png
deleted file mode 100755 (executable)
index eeac24b..0000000
Binary files a/mods/fishing/textures/mcl_fishing_fish_raw.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_pufferfish_raw.png b/mods/fishing/textures/mcl_fishing_pufferfish_raw.png
deleted file mode 100755 (executable)
index 1d6b7aa..0000000
Binary files a/mods/fishing/textures/mcl_fishing_pufferfish_raw.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_salmon_cooked.png b/mods/fishing/textures/mcl_fishing_salmon_cooked.png
deleted file mode 100755 (executable)
index 08d64a2..0000000
Binary files a/mods/fishing/textures/mcl_fishing_salmon_cooked.png and /dev/null differ
diff --git a/mods/fishing/textures/mcl_fishing_salmon_raw.png b/mods/fishing/textures/mcl_fishing_salmon_raw.png
deleted file mode 100755 (executable)
index 4c9cb77..0000000
Binary files a/mods/fishing/textures/mcl_fishing_salmon_raw.png and /dev/null differ
index f6d743fa52465ae089bbc0d935b26e3d2a6ba2fe..72e6577076ee7834c0eacd39334d2fbe1185d80a 100644 (file)
@@ -2,7 +2,7 @@
 minetest.register_craftitem("mob:raw_porkchop", {
        description = "Raw Porkchop",
        inventory_image = "raw_porkchop.png",
-       health = 2,
+       groups = {satiation=1,hunger=2},
 })
 minetest.register_craftitem("mob:cooked_porkchop", {
        description = "Cooked Porkchop",
@@ -27,5 +27,4 @@ minetest.register_craft({
        type = "cooking",
        output = "mob:cooked_porkchop",
        recipe = "mob:raw_porkchop",
-       groups = {satiation=6,hunger=7},
 })