From 38040e148e355b7a2099e2158119192d7d8252a4 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 28 Aug 2017 15:34:35 -0700 Subject: [PATCH] Create local items for drops --- depends.txt | 1 - init.lua | 19 ++++++++++++++++--- items.lua | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 items.lua diff --git a/depends.txt b/depends.txt index 5281ea6..28d1b53 100644 --- a/depends.txt +++ b/depends.txt @@ -1,4 +1,3 @@ -animalmaterials default ethereal mobs diff --git a/init.lua b/init.lua index 2b522ed..b1b1b39 100644 --- a/init.lua +++ b/init.lua @@ -31,6 +31,10 @@ else S = function ( s ) return s end end + +local modname = core.get_current_modname() +local modpath = core.get_modpath(modname) + local version = '0.2.0' local variant = 'mobs_redo' local variant_version = '0.1' @@ -40,12 +44,21 @@ core.log('action','MOD: mob_shark loading ...') local mobname = 'mobs:shark' +local scripts = { + 'items', +} + +for index, script in ipairs(scripts) do + dofile(modpath .. '/' .. script .. '.lua') +end + + --local shark_collisionbox = {-0.75, -0.5, -0.75, 0.75, 0.5, 0.75} local shark_collisionbox = {-0.38, -0.25, -0.38, 0.38, 0.25, 0.38} local shark_drop = { - {name='animalmaterials:fish_shark', chance=1, min=3, max=3}, - {name='animalmaterials:shark_tooth', chance=4, min=1, max=3}, -- FIXME: Original 'chance' value was 0.01 - {name='animalmaterials:shark_skin', chance=4, min=1, max=1}, --FIXME: Original 'chance' value was 0.01 + {name='mobs:shark_meat_raw', chance=1, min=3, max=3}, + {name='mobs:shark_tooth', chance=4, min=1, max=3}, -- FIXME: Original 'chance' value was 0.01 + {name='mobs:shark_skin', chance=4, min=1, max=1}, -- FIXME: Original 'chance' value was 0.01 } mobs:register_mob(':' .. mobname, { diff --git a/items.lua b/items.lua new file mode 100644 index 0000000..aed2f59 --- /dev/null +++ b/items.lua @@ -0,0 +1,39 @@ +-- Items for mob_shark mod + + +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if core.global_exists('intllib') then + dofile(core.get_modpath('intllib') .. '/intllib.lua') + if intllib.make_gettext_pair then + -- New method using gettext. + S = intllib.make_gettext_pair(core.get_current_modname()) + else + -- Old method using text files. + S = intllib.Getter(core.get_current_modname()) + end +else + S = function ( s ) return s end +end + + +core.register_craftitem('mobs:shark_meat_raw', { + description = S('Raw Shark Meat'), + inventory_image = 'mobs_shark_meat_raw.png', +}) +core.register_alias('mobs:shark_meat', 'mobs:shark_meat_raw') + +core.register_craftitem('mobs:shark_meat_cooked', { + description = S('Cooked Shark Meat'), + inventory_image = 'mobs_shark_meat_cooked.png', +}) + +core.register_craftitem('mobs:shark_tooth', { + description = S('Shark Tooth'), + inventory_image = 'mobs_shark_tooth.png', +}) + +core.register_craftitem('mobs:shark_skin', { + description = S('Shark Skin'), + inventory_image = 'mobs_shark_skin.png', +})