From aabf5bd7057576e52b3782fe5a87c712ec4c781d Mon Sep 17 00:00:00 2001 From: thunderdog1138 Date: Mon, 20 Jul 2020 17:26:12 +0000 Subject: [PATCH] Upload files to 'mods/mobs_npc' --- mods/mobs_npc/depends.txt | 4 ++ mods/mobs_npc/description.txt | 1 + mods/mobs_npc/igor.lua | 118 ++++++++++++++++++++++++++++++++++ mods/mobs_npc/init.lua | 33 ++++++++++ mods/mobs_npc/license.txt | 21 ++++++ 5 files changed, 177 insertions(+) create mode 100644 mods/mobs_npc/depends.txt create mode 100644 mods/mobs_npc/description.txt create mode 100644 mods/mobs_npc/igor.lua create mode 100644 mods/mobs_npc/init.lua create mode 100644 mods/mobs_npc/license.txt diff --git a/mods/mobs_npc/depends.txt b/mods/mobs_npc/depends.txt new file mode 100644 index 00000000..58b4e627 --- /dev/null +++ b/mods/mobs_npc/depends.txt @@ -0,0 +1,4 @@ +default +mobs +intllib? +lucky_block? diff --git a/mods/mobs_npc/description.txt b/mods/mobs_npc/description.txt new file mode 100644 index 00000000..3936b7f2 --- /dev/null +++ b/mods/mobs_npc/description.txt @@ -0,0 +1 @@ +Adds simple NPC and Trader. diff --git a/mods/mobs_npc/igor.lua b/mods/mobs_npc/igor.lua new file mode 100644 index 00000000..387194bc --- /dev/null +++ b/mods/mobs_npc/igor.lua @@ -0,0 +1,118 @@ + +local S = mobs.intllib + +-- Igor by TenPlus1 + +mobs.igor_drops = { + "vessels:glass_bottle", "mobs:meat_raw", "default:sword_steel", + "farming:bread", "bucket:bucket_water" +} + +mobs:register_mob("mobs_npc:igor", { + type = "npc", + passive = false, + damage = 5, + attack_type = "dogfight", + owner_loyal = true, + pathfinding = true, + reach = 2, + attacks_monsters = true, + hp_min = 20, + hp_max = 30, + armor = 100, + collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35}, + visual = "mesh", + mesh = "mobs_character.b3d", + textures = { + {"mobs_igor.png"}, -- skin by ruby32199 + {"mobs_igor2.png"}, + {"mobs_igor3.png"}, + {"mobs_igor4.png"}, + {"mobs_igor5.png"}, + {"mobs_igor6.png"}, + {"mobs_igor7.png"}, + {"mobs_igor8.png"}, + }, + makes_footstep_sound = true, + sounds = {}, + walk_velocity = 1, + run_velocity = 2, + stepheight = 1.1, + fear_height = 2, + jump = true, + drops = { + {name = "mobs:meat_raw", chance = 1, min = 1, max = 2}, + {name = "default:gold_lump", chance = 3, min = 1, max = 1}, + }, + water_damage = 1, + lava_damage = 3, + light_damage = 0, + follow = {"mobs:meat_raw", "default:diamond"}, + view_range = 15, + owner = "", + order = "follow", + -- model animation + animation = { + speed_normal = 30, + speed_run = 30, + stand_start = 0, + stand_end = 79, + walk_start = 168, + walk_end = 187, + run_start = 168, + run_end = 187, + punch_start = 200, + punch_end = 219, + }, + -- right clicking with raw meat will give Igor more health + on_rightclick = function(self, clicker) + + -- feed to heal npc + if mobs:feed_tame(self, clicker, 8, false, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, nil, 5, 80, false, nil) then return end + + local item = clicker:get_wielded_item() + local name = clicker:get_player_name() + + -- right clicking with gold lump drops random item from mobs.npc_drops + if item:get_name() == "default:gold_lump" then + + if not mobs.is_creative(name) then + item:take_item() + clicker:set_wielded_item(item) + end + + local pos = self.object:get_pos() + + pos.y = pos.y + 0.5 + + local drops = self.igor_drops or mobs.igor_drops + + minetest.add_item(pos, { + name = drops[math.random(1, #drops)] + }) + + minetest.chat_send_player(name, S("NPC dropped you an item for gold!")) + + return + end + + -- if owner switch between follow and stand + if self.owner and self.owner == name then + + if self.order == "follow" then + self.order = "stand" + minetest.chat_send_player(name, S("NPC stands still.")) + else + self.order = "follow" + minetest.chat_send_player(name, S("NPC will follow you.")) + end + end + end, +}) +-- register spawn egg +mobs:register_egg("mobs_npc:igor", S("Igor"), "mobs_meat_raw.png", 1) + +-- compatibility +mobs:alias_mob("mobs:igor", "mobs_npc:igor") diff --git a/mods/mobs_npc/init.lua b/mods/mobs_npc/init.lua new file mode 100644 index 00000000..31459673 --- /dev/null +++ b/mods/mobs_npc/init.lua @@ -0,0 +1,33 @@ + +local path = minetest.get_modpath("mobs_npc") + +-- Intllib +local S +if minetest.get_modpath("intllib") then + S = intllib.Getter() +else + S = function(s, a, ...) + if a == nil then + return s + end + a = {a, ...} + return s:gsub("(@?)@(%(?)(%d+)(%)?)", + function(e, o, n, c) + if e == ""then + return a[tonumber(n)] .. (o == "" and c or "") + else + return "@" .. o .. n .. c + end + end) + end +end +mobs.intllib = S + +-- NPC +dofile(path .. "/npc.lua") -- TenPlus1 +dofile(path .. "/trader.lua") +dofile(path .. "/igor.lua") + +dofile(path .. "/lucky_block.lua") + +print (S("[MOD] Mobs Redo NPCs loaded")) diff --git a/mods/mobs_npc/license.txt b/mods/mobs_npc/license.txt new file mode 100644 index 00000000..fec6f6aa --- /dev/null +++ b/mods/mobs_npc/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 TenPlus1 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.