Browse Source

Make handling animalmaterials cleaner using a separate file.

master
poikilos 3 years ago
parent
commit
b90550750f
  1. 412
      Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/init.lua
  2. 257
      Bucket_Game-branches/distinguish_meats-vs-211114a.patch
  3. 208
      Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua
  4. 84
      Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials_aliases.lua
  5. 426
      Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/init.lua

412
Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/init.lua

@ -0,0 +1,412 @@
codermobs = {}
mobs_param = {}
codermobs.modname = minetest.get_current_modname()
codermobs.modpath = ocutil.get_modpath (codermobs.modname)
local modname = codermobs.modname
local nm = modname
local mp = codermobs.modpath
local lua_exists = function (basename)
return ocutil.lua_exists (modname, basename)
end
local lua_missing = function (basename)
return ocutil.lua_missing (modname, basename)
end
local enable_moontest =
minetest.setting_getbool ("enable_moon" ) or
minetest.setting_getbool ("enable_moontest" )
-- ===================================================================
codermobs.log_mob_loaded = ocutil.any_bool_setting ({
"logmob" ,
"log_mob" ,
"logmobloaded" ,
"log_mob_loaded" ,
})
-- ===================================================================
codermobs.model_exists = function (m3dfile)
return ocutil.model_exists (modname, m3dfile)
end
local model_exists = codermobs.model_exists
-- ===================================================================
codermobs.model_missing = function (m3dfile)
return ocutil.model_missing (modname, m3dfile)
end
local model_missing = codermobs.model_missing
-- ===================================================================
codermobs.mob_exists = function (basename)
local model_1 = "codermobs_" .. basename .. ".b3d"
local model_2 = "codermobs_" .. basename .. ".x"
local both_missing = model_missing (model_1) and
model_missing (model_2)
if lua_missing (basename) or both_missing then
return false
end
return true
end
local mob_exists = codermobs.mob_exists
-- ===================================================================
codermobs.textu_exists = function (imgfile)
return ocutil.mod_texture_exists (modname, imgfile)
end
local textu_exists = codermobs.textu_exists
-- ===================================================================
-- These must come first.
dofile (mp .. "/globals.lua" )
dofile (mp .. "/util.lua" )
-- This is an object as opposed to a mob
if lua_exists ("animal_materials" ) then
dofile (mp .. "/animal_materials.lua" )
end
-- This is an object as opposed to a mob
if lua_exists ("vombie_flame" ) then
dofile (mp .. "/vombie_flame.lua" )
end
-- ===================================================================
-- Hen, Rooster, and Baby Chick should be loaded in that order.
-- Filenames are a special case for this mob
if lua_exists ("hen" ) then
dofile (mp .. "/hen.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("rooster" ) then
dofile (mp .. "/rooster.lua" )
end
if mob_exists ("baby_chick" ) then
dofile (mp .. "/baby_chick.lua" )
end
-- ===================================================================
if mob_exists ("duck_walking" ) then
dofile (mp .. "/duck_walking.lua" )
end
if mob_exists ("baby" ) then
dofile (mp .. "/baby.lua" )
end
if mob_exists ("badger" ) then
dofile (mp .. "/badger.lua" )
end
if mob_exists ("bat" ) then
dofile (mp .. "/bat.lua" )
end
if mob_exists ("bear" ) then
dofile (mp .. "/bear.lua" )
end
if mob_exists ("bee" ) then
dofile (mp .. "/bee.lua" )
end
if mob_exists ("beetle" ) then
dofile (mp .. "/beetle.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("bird" ) then
dofile (mp .. "/bird.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("bom" ) and
model_exists ("codermobs_bom.b3d" ) then
dofile (mp .. "/bom.lua" )
end
if mob_exists ("fox" ) then
dofile (mp .. "/fox.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("icebom" ) and
model_exists ("codermobs_bom.b3d" ) then
dofile (mp .. "/icebom.lua" )
end
if mob_exists ("bug" ) then
dofile (mp .. "/bug.lua" )
end
if mob_exists ("bunny" ) then
dofile (mp .. "/bunny.lua" )
end
if mob_exists ("butterfly" ) then
dofile (mp .. "/butterfly.lua" )
end
if mob_exists ("cacodemon" ) then
dofile (mp .. "/cacodemon.lua" )
end
if mob_exists ("camel" ) then
dofile (mp .. "/camel.lua" )
end
if mob_exists ("car" ) then
dofile (mp .. "/car.lua" )
end
if mob_exists ("caveman" ) then
dofile (mp .. "/caveman.lua" )
end
if mob_exists ("cow" ) then
dofile (mp .. "/cow.lua" )
end
if mob_exists ("cyberdemon" ) then
dofile (mp .. "/cyberdemon.lua" )
end
if mob_exists ("deer" ) then
dofile (mp .. "/deer.lua" )
end
if mob_exists ("denny" ) then
dofile (mp .. "/denny.lua" )
end
if mob_exists ("digibug" ) then
dofile (mp .. "/digibug.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("dirt_monster" ) then
dofile (mp .. "/dirt_monster.lua" )
end
if mob_exists ("dog" ) then
dofile (mp .. "/dog.lua" )
end
if mob_exists ("elephant" ) then
dofile (mp .. "/elephant.lua" )
end
if mob_exists ("elk" ) then
dofile (mp .. "/elk.lua" )
end
if mob_exists ("farhorse" ) then
dofile (mp .. "/farhorse.lua" )
end
if mob_exists ("flying_pig" ) then
dofile (mp .. "/flying_pig.lua" )
end
if mob_exists ("ghost" ) then
dofile (mp .. "/ghost.lua" )
end
if mob_exists ("goat" ) then
dofile (mp .. "/goat.lua" )
end
if mob_exists ("hedgehog" ) then
dofile (mp .. "/hedgehog.lua" )
end
if mob_exists ("hippo" ) then
dofile (mp .. "/hippo.lua" )
end
if mob_exists ("hotdog" ) then
dofile (mp .. "/hotdog.lua" )
end
if mob_exists ("jeraf" ) then
dofile (mp .. "/jeraf.lua" )
end
if mob_exists ("kangaroo" ) then
dofile (mp .. "/kangaroo.lua" )
end
if mob_exists ("kitten" ) then
dofile (mp .. "/kitten.lua" )
end
if mob_exists ("lava_flan" ) then
dofile (mp .. "/lava_flan.lua" )
end
if mob_exists ("lawyer" ) then
dofile (mp .. "/lawyer.lua" )
end
if mob_exists ("letterg" ) then
dofile (mp .. "/letterg.lua" )
end
if mob_exists ("lostsoul" ) then
dofile (mp .. "/lostsoul.lua" )
end
if mob_exists ("lott_spider" ) then
dofile (mp .. "/lott_spider.lua" )
end
if mob_exists ("mammoth" ) then
dofile (mp .. "/mammoth.lua" )
end
if mob_exists ("mcpig" ) then
dofile (mp .. "/mcpig.lua" )
end
if mob_exists ("mdskeleton" ) then
dofile (mp .. "/mdskeleton.lua" )
end
if mob_exists ("oerkki" ) then
dofile (mp .. "/oerkki.lua" )
end
if mob_exists ("oldlady" ) then
dofile (mp .. "/oldlady.lua" )
end
if mob_exists ("ostrich" ) then
dofile (mp .. "/ostrich.lua" )
end
if mob_exists ("owl" ) then
dofile (mp .. "/owl.lua" )
end
if mob_exists ("panda" ) then
dofile (mp .. "/panda.lua" )
end
if mob_exists ("penguin" ) then
dofile (mp .. "/penguin.lua" )
end
if mob_exists ("plane" ) then
dofile (mp .. "/plane.lua" )
end
if mob_exists ("polar_bear" ) then
dofile (mp .. "/polar_bear.lua" )
end
if mob_exists ("rat" ) then
dofile (mp .. "/rat.lua" )
end
if mob_exists ("rat_better" ) then
dofile (mp .. "/rat_better.lua" )
end
if mob_exists ("robotted" ) then
dofile (mp .. "/robotted.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("santa" ) and
textu_exists ("codermobs_santa.png" ) then
dofile (mp .. "/santa.lua" )
end
if mob_exists ("sheep" ) then
dofile (mp .. "/sheep.lua" )
end
if mob_exists ("silverfish" ) then
dofile (mp .. "/silverfish.lua" )
end
if mob_exists ("snail" ) then
dofile (mp .. "/snail.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("snake_garter" ) and
model_exists ("codermobs_snake.x" ) then
dofile (mp .. "/snake_garter.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("snake_ice" ) and
model_exists ("codermobs_snake.x" ) then
dofile (mp .. "/snake_ice.lua" )
end
if mob_exists ("snowman" ) then
dofile (mp .. "/snowman.lua" )
end
if mob_exists ("tiger" ) then
dofile (mp .. "/tiger.lua" )
end
if mob_exists ("tree_monster" ) then
dofile (mp .. "/tree_monster.lua" )
end
if mob_exists ("trex" ) then
dofile (mp .. "/trex.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("vombie" ) then
dofile (mp .. "/vombie.lua" )
end
if mob_exists ("warthog" ) then
dofile (mp .. "/warthog.lua" )
end
if mob_exists ("wolf" ) then
dofile (mp .. "/wolf.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("zebra" ) then
dofile (mp .. "/zebra.lua" )
end
-- Moon Cow should be defined after regular cow.
--
if enable_moontest and mob_exists ("cow") then
dofile (mp .. "/mooncow.lua" )
end
-- This is an object as opposed to a mob
if lua_exists ("dungeon_spawner" ) then
dofile (mp .. "/dungeon_spawner.lua" )
end
-- ===================================================================
-- End of file.

257
Bucket_Game-branches/distinguish_meats-vs-211114a.patch

@ -41,7 +41,7 @@ Only in Bucket_Game-branches/distinguish_meats-vs-211114a/mods/coderfood/unified
Only in Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs: animal_materials_aliases.lua Only in Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs: animal_materials_aliases.lua
diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua
--- Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua 2021-11-15 13:20:43.119691199 -0500 --- Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua 2021-11-15 13:20:43.119691199 -0500
+++ Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua 2021-11-19 10:27:04.584132215 -0500 +++ Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua 2021-11-19 11:02:16.784185408 -0500
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
S = function ( s ) return s end S = function ( s ) return s end
end end
@ -51,7 +51,7 @@ diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/
local version = "0.1.3" local version = "0.1.3"
animal_materialsdata = {} animal_materialsdata = {}
@@ -103,101 +103,203 @@ @@ -103,49 +103,64 @@
-- =================================================================== -- ===================================================================
-- meat -- meat
@ -98,17 +98,11 @@ diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/
+local dep_pork_raw = nil +local dep_pork_raw = nil
+if minetest.registered_items["mobs:pork_raw"] then +if minetest.registered_items["mobs:pork_raw"] then
+ dep_pork_raw = "mobs:pork_raw" + dep_pork_raw = "mobs:pork_raw"
+elseif minetest.registered_items["animalmaterials:meat_pork"] then
+ dep_pork_raw = "animalmaterials:meat_pork"
+end +end
-minetest.register_craftitem(":animal_materials:meat_chicken", { -minetest.register_craftitem(":animal_materials:meat_chicken", {
- description = S("Chicken (raw)"), - description = S("Chicken (raw)"),
- image = "animal_materials_meat_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(1),
- groups = { meat=1, eatable=1 },
- stack_max=25
-})
+if not dep_pork_raw then +if not dep_pork_raw then
+ minetest.register_craftitem(":animal_materials:meat_pork", { + minetest.register_craftitem(":animal_materials:meat_pork", {
+ description = S("Raw Pork"), + description = S("Raw Pork"),
@ -117,88 +111,52 @@ diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/
+ groups = { meat=1, eatable=1 }, + groups = { meat=1, eatable=1 },
+ stack_max=25 + stack_max=25
+ }) + })
+
-minetest.register_craftitem(":animal_materials:meat_lamb", {
- description = S("Lamb (raw)"),
- image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(1),
- groups = { meat=1, eatable=1 },
- stack_max=25
-})
+ minetest.register_alias("animal_materials:pork_raw", "animal_materials:meat_pork") + minetest.register_alias("animal_materials:pork_raw", "animal_materials:meat_pork")
+else +else
+ minetest.register_alias("animal_materials:pork_raw", dep_pork_raw) + minetest.register_alias("animal_materials:pork_raw", dep_pork_raw)
+ minetest.register_alias("animal_materials:meat_pork", dep_pork_raw) + minetest.register_alias("animal_materials:meat_pork", dep_pork_raw)
+end +end
+
+minetest.register_craftitem(":animal_materials:meat_beef", {
+ description = S("Raw Beef"),
+ image = "codermobs_beef_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
-minetest.register_craftitem(":animal_materials:meat_venison", { minetest.register_craftitem(":animal_materials:meat_lamb", {
- description = S("Venison (raw)"), - description = S("Lamb (raw)"),
- image = "animal_materials_meat_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(1), + description = S("Raw Lamb"),
- groups = { meat=1, eatable=1 }, + image = "codermobs_lamb_raw.png",
- stack_max=25 on_use = minetest.item_eat(1),
-}) groups = { meat=1, eatable=1 },
+local dep_beef_raw = nil stack_max=25
+if minetest.registered_items["animalmaterials:meat_beef"] then })
+ dep_beef_raw = "animalmaterials:meat_beef"
+end
+if not dep_beef_raw then
+ minetest.register_craftitem(":animal_materials:meat_beef", {
+ description = S("Raw Beef"),
+ image = "codermobs_beef_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animal_materials:meat_beef", dep_beef_raw)
+end
-minetest.register_craftitem(":animal_materials:meat_undead", {
- description = S("Meat (not quite dead)"),
- image = "animal_materials_meat_undead_raw.png",
- on_use = minetest.item_eat(-2),
- groups = { meat=1, eatable=1 },
- stack_max=5
-})
+local dep_chicken_raw = nil
+if minetest.registered_items["animalmaterials:meat_chicken"] then
+ dep_chicken_raw = "animalmaterials:meat_chicken"
+end
-minetest.register_craftitem(":animal_materials:meat_toxic", { minetest.register_craftitem(":animal_materials:meat_venison", {
- description = S("Toxic Meat"), - description = S("Venison (raw)"),
- image = "animal_materials_meat_toxic_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(-5), + description = S("Raw Venison"),
- groups = { meat=1, eatable=1 }, + image = "codermobs_venison_raw.png",
- stack_max=5 on_use = minetest.item_eat(1),
-}) groups = { meat=1, eatable=1 },
+if not dep_chicken_raw then stack_max=25
+ minetest.register_craftitem(":animal_materials:meat_chicken", { @@ -168,32 +183,27 @@
+ description = S("Raw Chicken"), })
+ image = "codermobs_chicken_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animalmaterials:meat_chicken", dep_chicken_raw)
+ -- ^ The alias is only necessary for older versions of bucket_game--
+ -- as long as new ones always use the latter craftitem everywhere else,
+ -- they don't need the alias for any other reason.
+end
-minetest.register_craftitem(":animal_materials:meat_ostrich", { minetest.register_craftitem(":animal_materials:meat_ostrich", {
- description = S("Ostrich Meat"), - description = S("Ostrich Meat"),
- image = "animal_materials_meat_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(3), + description = S("Raw Ostrich"),
+ image = "animal_materials_ostrich_meat_raw.png",
on_use = minetest.item_eat(3),
- groups = { meat=1, eatable=1 }, - groups = { meat=1, eatable=1 },
- stack_max=5 + groups = { food_meat_raw = 1, meat=1, eatable=1 },
-}) stack_max=5
+local dep_lamb_raw = nil })
+if minetest.registered_items["animalmaterials:meat_lamb"] then
+ dep_lamb_raw = "animalmaterials:meat_lamb"
+end
-minetest.register_craftitem(":animal_materials:pork_raw", { -minetest.register_craftitem(":animal_materials:pork_raw", {
- description = S("Pork"), - description = S("Pork"),
@ -207,139 +165,28 @@ diff -ru Bucket_Game-base/distinguish_meats-vs-211114a/mods/codermobs/codermobs/
- groups = { meat=1, eatable=1 }, - groups = { meat=1, eatable=1 },
- stack_max=5 - stack_max=5
-}) -})
+if not dep_lamb_raw then +-- animal_materials:pork_raw is an alias now (to fix an upstream dup in
+ minetest.register_craftitem(":animal_materials:meat_lamb", { +-- animalmaterials)--see register_alias further up.
+ description = S("Raw Lamb"),
+ image = "codermobs_lamb_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animal_materials:meat_lamb", dep_lamb_raw)
+end
-minetest.register_craftitem(":animal_materials:fish_bluewhite", { minetest.register_craftitem(":animal_materials:fish_bluewhite", {
- description = S("Fish (bluewhite)"), - description = S("Fish (bluewhite)"),
- image = "animal_materials_meat_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(1), + description = S("Raw Fish (cichlid)"),
- groups = { meat=1, eatable=1 }, + image = "animal_materials_bluewhite_raw.png",
- stack_max=25 on_use = minetest.item_eat(1),
-}) groups = { meat=1, eatable=1 },
+local dep_venison_raw = nil stack_max=25
+if minetest.registered_items["animalmaterials:meat_venison"] then })
+ dep_venison_raw = "animalmaterials:meat_venison"
+end
-minetest.register_craftitem(":animal_materials:fish_clownfish", { minetest.register_craftitem(":animal_materials:fish_clownfish", {
- description = S("Fish (clownfish)"), - description = S("Fish (clownfish)"),
- image = "animal_materials_meat_raw.png", - image = "animal_materials_meat_raw.png",
- on_use = minetest.item_eat(1), + description = S("Raw Fish (clownfish)"),
- groups = { meat=1, eatable=1 }, + image = "animal_materials_clownfish_raw.png",
- stack_max=25 on_use = minetest.item_eat(1),
-}) groups = { meat=1, eatable=1 },
+if not dep_venison_raw then stack_max=25
+ minetest.register_craftitem(":animal_materials:meat_venison", { @@ -229,7 +239,7 @@
+ description = S("Raw Venison"),
+ image = "codermobs_venison_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animal_materials:meat_venison", dep_venison_raw)
+end
+
+local dep_undead_raw = nil
+if minetest.registered_items["animalmaterials:meat_undead"] then
+ dep_undead_raw = "animalmaterials:meat_undead"
+end
+
+if not dep_undead_raw then
+ minetest.register_craftitem(":animal_materials:meat_undead", {
+ description = S("Meat (not quite dead)"),
+ image = "animal_materials_meat_undead_raw.png",
+ on_use = minetest.item_eat(-2),
+ groups = { meat=1, eatable=1 },
+ stack_max=5
+ })
+else
+ minetest.register_alias("animal_materials:meat_undead", dep_undead_raw)
+end
+
+
+local dep_toxic_raw = nil
+if minetest.registered_items["animalmaterials:meat_toxic"] then
+ dep_toxic_raw = "animalmaterials:meat_toxic"
+end
+
+if not dep_toxic_raw then
+ minetest.register_craftitem(":animal_materials:meat_toxic", {
+ description = S("Toxic Meat"),
+ image = "animal_materials_meat_toxic_raw.png",
+ on_use = minetest.item_eat(-5),
+ groups = { meat=1, eatable=1 },
+ stack_max=5
+ })
+else
+ minetest.register_alias("animal_materials:meat_toxic", dep_toxic_raw)
+end
+
+local dep_ostrich_raw = nil
+if minetest.registered_items["animalmaterials:meat_ostrich"] then
+ dep_ostrich_raw = "animalmaterials:meat_ostrich"
+end
+
+if not dep_ostrich_raw then
+ minetest.register_craftitem(":animal_materials:meat_ostrich", {
+ description = S("Raw Ostrich"),
+ image = "animal_materials_ostrich_meat_raw.png",
+ on_use = minetest.item_eat(3),
+ groups = { food_meat_raw = 1, meat=1, eatable=1 },
+ stack_max=5
+ })
+else
+ minetest.register_alias("animal_materials:meat_ostrich", dep_ostrich_raw)
+end
+
+
+local dep_bluewhite_raw = nil
+if minetest.registered_items["animalmaterials:fish_bluewhite"] then
+ dep_bluewhite_raw = "animalmaterials:fish_bluewhite"
+end
+
+if not dep_bluewhite_raw then
+ minetest.register_craftitem(":animal_materials:fish_bluewhite", {
+ description = S("Raw Fish (cichlid)"),
+ image = "animal_materials_bluewhite_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animal_materials:fish_bluewhite", dep_bluewhite_raw)
+end
+
+local dep_clownfish_raw = nil
+if minetest.registered_items["animalmaterials:fish_clownfish"] then
+ dep_clownfish_raw = "animalmaterials:fish_clownfish"
+end
+
+if not dep_clownfish_raw then
+ minetest.register_craftitem(":animal_materials:fish_clownfish", {
+ description = S("Raw Fish (clownfish)"),
+ image = "animal_materials_clownfish_raw.png",
+ on_use = minetest.item_eat(1),
+ groups = { meat=1, eatable=1 },
+ stack_max=25
+ })
+else
+ minetest.register_alias("animal_materials:fish_clownfish", dep_clownfish_raw)
+end
-- ===================================================================
-- feather
@@ -229,7 +331,7 @@
}) })
minetest.register_craftitem(":animal_materials:egg_big", { minetest.register_craftitem(":animal_materials:egg_big", {

208
Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials.lua

@ -125,8 +125,6 @@ end
local dep_pork_raw = nil local dep_pork_raw = nil
if minetest.registered_items["mobs:pork_raw"] then if minetest.registered_items["mobs:pork_raw"] then
dep_pork_raw = "mobs:pork_raw" dep_pork_raw = "mobs:pork_raw"
elseif minetest.registered_items["animalmaterials:meat_pork"] then
dep_pork_raw = "animalmaterials:meat_pork"
end end
if not dep_pork_raw then if not dep_pork_raw then
@ -144,162 +142,72 @@ else
minetest.register_alias("animal_materials:meat_pork", dep_pork_raw) minetest.register_alias("animal_materials:meat_pork", dep_pork_raw)
end end
local dep_beef_raw = nil minetest.register_craftitem(":animal_materials:meat_beef", {
if minetest.registered_items["animalmaterials:meat_beef"] then description = S("Raw Beef"),
dep_beef_raw = "animalmaterials:meat_beef" image = "codermobs_beef_raw.png",
end on_use = minetest.item_eat(1),
if not dep_beef_raw then groups = { meat=1, eatable=1 },
minetest.register_craftitem(":animal_materials:meat_beef", { stack_max=25
description = S("Raw Beef"), })
image = "codermobs_beef_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
else
minetest.register_alias("animal_materials:meat_beef", dep_beef_raw)
end
local dep_chicken_raw = nil
if minetest.registered_items["animalmaterials:meat_chicken"] then
dep_chicken_raw = "animalmaterials:meat_chicken"
end
if not dep_chicken_raw then
minetest.register_craftitem(":animal_materials:meat_chicken", {
description = S("Raw Chicken"),
image = "codermobs_chicken_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
else
minetest.register_alias("animalmaterials:meat_chicken", dep_chicken_raw)
-- ^ The alias is only necessary for older versions of bucket_game--
-- as long as new ones always use the latter craftitem everywhere else,
-- they don't need the alias for any other reason.
end
local dep_lamb_raw = nil
if minetest.registered_items["animalmaterials:meat_lamb"] then
dep_lamb_raw = "animalmaterials:meat_lamb"
end
if not dep_lamb_raw then
minetest.register_craftitem(":animal_materials:meat_lamb", {
description = S("Raw Lamb"),
image = "codermobs_lamb_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
else
minetest.register_alias("animal_materials:meat_lamb", dep_lamb_raw)
end
local dep_venison_raw = nil
if minetest.registered_items["animalmaterials:meat_venison"] then
dep_venison_raw = "animalmaterials:meat_venison"
end
if not dep_venison_raw then
minetest.register_craftitem(":animal_materials:meat_venison", {
description = S("Raw Venison"),
image = "codermobs_venison_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
else
minetest.register_alias("animal_materials:meat_venison", dep_venison_raw)
end
local dep_undead_raw = nil
if minetest.registered_items["animalmaterials:meat_undead"] then
dep_undead_raw = "animalmaterials:meat_undead"
end
if not dep_undead_raw then
minetest.register_craftitem(":animal_materials:meat_undead", {
description = S("Meat (not quite dead)"),
image = "animal_materials_meat_undead_raw.png",
on_use = minetest.item_eat(-2),
groups = { meat=1, eatable=1 },
stack_max=5
})
else
minetest.register_alias("animal_materials:meat_undead", dep_undead_raw)
end
local dep_toxic_raw = nil
if minetest.registered_items["animalmaterials:meat_toxic"] then
dep_toxic_raw = "animalmaterials:meat_toxic"
end
if not dep_toxic_raw then minetest.register_craftitem(":animal_materials:meat_lamb", {
minetest.register_craftitem(":animal_materials:meat_toxic", { description = S("Raw Lamb"),
description = S("Toxic Meat"), image = "codermobs_lamb_raw.png",
image = "animal_materials_meat_toxic_raw.png", on_use = minetest.item_eat(1),
on_use = minetest.item_eat(-5), groups = { meat=1, eatable=1 },
groups = { meat=1, eatable=1 }, stack_max=25
stack_max=5 })
})
else
minetest.register_alias("animal_materials:meat_toxic", dep_toxic_raw)
end
local dep_ostrich_raw = nil minetest.register_craftitem(":animal_materials:meat_venison", {
if minetest.registered_items["animalmaterials:meat_ostrich"] then description = S("Raw Venison"),
dep_ostrich_raw = "animalmaterials:meat_ostrich" image = "codermobs_venison_raw.png",
end on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
if not dep_ostrich_raw then minetest.register_craftitem(":animal_materials:meat_undead", {
minetest.register_craftitem(":animal_materials:meat_ostrich", { description = S("Meat (not quite dead)"),
description = S("Raw Ostrich"), image = "animal_materials_meat_undead_raw.png",
image = "animal_materials_ostrich_meat_raw.png", on_use = minetest.item_eat(-2),
on_use = minetest.item_eat(3), groups = { meat=1, eatable=1 },
groups = { food_meat_raw = 1, meat=1, eatable=1 }, stack_max=5
stack_max=5 })
})
else
minetest.register_alias("animal_materials:meat_ostrich", dep_ostrich_raw)
end
minetest.register_craftitem(":animal_materials:meat_toxic", {
description = S("Toxic Meat"),
image = "animal_materials_meat_toxic_raw.png",
on_use = minetest.item_eat(-5),
groups = { meat=1, eatable=1 },
stack_max=5
})
local dep_bluewhite_raw = nil minetest.register_craftitem(":animal_materials:meat_ostrich", {
if minetest.registered_items["animalmaterials:fish_bluewhite"] then description = S("Raw Ostrich"),
dep_bluewhite_raw = "animalmaterials:fish_bluewhite" image = "animal_materials_ostrich_meat_raw.png",
end on_use = minetest.item_eat(3),
groups = { food_meat_raw = 1, meat=1, eatable=1 },
stack_max=5
})
if not dep_bluewhite_raw then -- animal_materials:pork_raw is an alias now (to fix an upstream dup in
minetest.register_craftitem(":animal_materials:fish_bluewhite", { -- animalmaterials)--see register_alias further up.
description = S("Raw Fish (cichlid)"),
image = "animal_materials_bluewhite_raw.png",
on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
else
minetest.register_alias("animal_materials:fish_bluewhite", dep_bluewhite_raw)
end
local dep_clownfish_raw = nil minetest.register_craftitem(":animal_materials:fish_bluewhite", {
if minetest.registered_items["animalmaterials:fish_clownfish"] then description = S("Raw Fish (cichlid)"),
dep_clownfish_raw = "animalmaterials:fish_clownfish" image = "animal_materials_bluewhite_raw.png",
end on_use = minetest.item_eat(1),
groups = { meat=1, eatable=1 },
stack_max=25
})
if not dep_clownfish_raw then minetest.register_craftitem(":animal_materials:fish_clownfish", {
minetest.register_craftitem(":animal_materials:fish_clownfish", { description = S("Raw Fish (clownfish)"),
description = S("Raw Fish (clownfish)"), image = "animal_materials_clownfish_raw.png",
image = "animal_materials_clownfish_raw.png", on_use = minetest.item_eat(1),
on_use = minetest.item_eat(1), groups = { meat=1, eatable=1 },
groups = { meat=1, eatable=1 }, stack_max=25
stack_max=25 })
})
else
minetest.register_alias("animal_materials:fish_clownfish", dep_clownfish_raw)
end
-- =================================================================== -- ===================================================================
-- feather -- feather

84
Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/animal_materials_aliases.lua

@ -0,0 +1,84 @@
-- ===================================================================
-- Code and media license.
--
-- You may copy, use, modify or do nearly anything but remove this
-- copyright notice. Of course, you're not allowed to pretend you've
-- created or written the Sapier or Poikilos pieces.
--
-- CC-BY-SA 3.0. Attribution: Sapier and Poikilos.
-- ===================================================================
-- Poikilos' distinguish_meats-vs-211114a patch adds this file and
-- conditionally uses it instead of animal_materials.lua in case a
-- user added the animalmaterials mod. This file will add aliases
-- in that case.
--
-- These aliases are only necessary for worlds that had been running
-- older versions of bucket_game. Newer worlds don't need them as
-- long as all code in new versions of bucket_game always use the
-- animalmaterial namespace in all cases (To see if that is done,
-- see [issue #517](https://github.com/poikilos/EnlivenMinetest/issues/517) )
--
-- -Poikilos
core.log("action","MOD: codermobs is loading animal_materials aliases (to use detected animalmaterials)...")
minetest.register_alias("animal_materials:sword_deamondeath", "animalmaterials:sword_deamondeath")
minetest.register_alias("animal_materials:scissors", "animalmaterials:scissors")
minetest.register_alias("animal_materials:lasso", "animalmaterials:lasso")
minetest.register_alias("animal_materials:net", "animalmaterials:net")
minetest.register_alias("animal_materials:saddle", "animalmaterials:saddle")
minetest.register_alias("animal_materials:contract", "animalmaterials:contract")
local dep_meat_raw = nil
if minetest.registered_items["mobs:meat"] then
dep_meat_raw = "mobs:meat"
elseif minetest.registered_items["animalmaterials:meat_raw"] then
dep_meat_raw = "animalmaterials:meat_raw"
end
if not dep_meat_raw then
minetest.register_alias("animal_materials:meat_raw", "animalmaterials:meat_raw")
else
minetest.register_alias("animal_materials:meat_raw", dep_meat_raw)
end
local dep_pork_raw = nil
if minetest.registered_items["mobs:pork_raw"] then
dep_pork_raw = "mobs:pork_raw"
elseif minetest.registered_items["animalmaterials:meat_pork"] then
dep_pork_raw = "animalmaterials:meat_pork"
end
if not dep_pork_raw then
minetest.register_alias("animal_materials:pork_raw", "animalmaterials:meat_pork")
minetest.register_alias("animal_materials:meat_pork", "animalmaterials:meat_pork")
else
minetest.register_alias("animal_materials:pork_raw", dep_pork_raw)
minetest.register_alias("animal_materials:meat_pork", dep_pork_raw)
end
minetest.register_alias("animal_materials:meat_beef", "animalmaterials:meat_beef")
minetest.register_alias("animalmaterials:meat_chicken", "animalmaterials:meat_chicken")
minetest.register_alias("animal_materials:meat_lamb", "animalmaterials:meat_lamb")
minetest.register_alias("animal_materials:meat_venison", "animalmaterials:meat_venison")
minetest.register_alias("animal_materials:meat_undead", "animalmaterials:meat_undead")
minetest.register_alias("animal_materials:meat_toxic", "animalmaterials:meat_toxic")
minetest.register_alias("animal_materials:meat_ostrich", "animalmaterials:meat_ostrich")
minetest.register_alias("animal_materials:fish_bluewhite", "animalmaterials:fish_bluewhite")
minetest.register_alias("animal_materials:fish_clownfish", "animalmaterials:fish_clownfish")
minetest.register_alias("animal_materials:feather", "animalmaterials:feather")
minetest.register_alias("animal_materials:milk", "animalmaterials:milk")
minetest.register_alias("animal_materials:egg", "animalmaterials:egg")
minetest.register_alias("animal_materials:egg_big", "animalmaterials:egg_big")
minetest.register_alias("animal_materials:bone", "animalmaterials:")
minetest.register_alias("animal_materials:fur", "animalmaterials:")
minetest.register_alias("animal_materials:fur_deer", "animalmaterials:")
minetest.register_alias("animal_materials:coat_cattle", "animalmaterials:")
minetest.register_alias("animal_materials:antlers", "animalmaterials:deer_horns")
minetest.register_alias("animal_materials:ivory", "animalmaterials:ivory")
minetest.register_alias("animal_materials:scale_golden", "animalmaterials:scale_golden")
minetest.register_alias("animal_materials:scale_white", "animalmaterials:scale_white")
minetest.register_alias("animal_materials:scale_gray", "animalmaterials:scale_gray")
minetest.register_alias("animal_materials:scale_blue", "animalmaterials:scale_blue")

426
Bucket_Game-branches/distinguish_meats-vs-211114a/mods/codermobs/codermobs/init.lua

@ -0,0 +1,426 @@
codermobs = {}
mobs_param = {}
codermobs.modname = minetest.get_current_modname()
codermobs.modpath = ocutil.get_modpath (codermobs.modname)
local modname = codermobs.modname
local nm = modname
local mp = codermobs.modpath
local lua_exists = function (basename)
return ocutil.lua_exists (modname, basename)
end
local lua_missing = function (basename)
return ocutil.lua_missing (modname, basename)
end
local enable_moontest =
minetest.setting_getbool ("enable_moon" ) or
minetest.setting_getbool ("enable_moontest" )
-- ===================================================================
codermobs.log_mob_loaded = ocutil.any_bool_setting ({
"logmob" ,
"log_mob" ,
"logmobloaded" ,
"log_mob_loaded" ,
})
-- ===================================================================
codermobs.model_exists = function (m3dfile)
return ocutil.model_exists (modname, m3dfile)
end
local model_exists = codermobs.model_exists
-- ===================================================================
codermobs.model_missing = function (m3dfile)
return ocutil.model_missing (modname, m3dfile)
end
local model_missing = codermobs.model_missing
-- ===================================================================
codermobs.mob_exists = function (basename)
local model_1 = "codermobs_" .. basename .. ".b3d"
local model_2 = "codermobs_" .. basename .. ".x"
local both_missing = model_missing (model_1) and
model_missing (model_2)
if lua_missing (basename) or both_missing then
return false
end
return true
end
local mob_exists = codermobs.mob_exists
-- ===================================================================
codermobs.textu_exists = function (imgfile)
return ocutil.mod_texture_exists (modname, imgfile)
end
local textu_exists = codermobs.textu_exists
-- ===================================================================
-- These must come first.
dofile (mp .. "/globals.lua" )
dofile (mp .. "/util.lua" )
-- This is an object as opposed to a mob
if not minetest.get_modpath("animalmaterials") then
-- ^ another way is: if not minetest.registered_items["animalmaterials:meat_raw"] then
if lua_exists ("animal_materials" ) then
dofile (mp .. "/animal_materials.lua" )
end
else
-- Someone added the animalmaterials mod in this case,
-- so only create aliases:
if lua_exists ("animal_materials" ) then
-- ^ check for the main file only, since OldCoder may
-- have added that condition further up in order to
-- exclude the animal_materials namespace in
-- differently-packaged copies of bucket_game.
-- -Poikilos (distinguish_meats-vs-211114a patch)
dofile (mp .. "/animal_materials_aliases.lua" )
end
end
-- This is an object as opposed to a mob
if lua_exists ("vombie_flame" ) then
dofile (mp .. "/vombie_flame.lua" )
end
-- ===================================================================
-- Hen, Rooster, and Baby Chick should be loaded in that order.
-- Filenames are a special case for this mob
if lua_exists ("hen" ) then
dofile (mp .. "/hen.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("rooster" ) then
dofile (mp .. "/rooster.lua" )
end
if mob_exists ("baby_chick" ) then
dofile (mp .. "/baby_chick.lua" )
end
-- ===================================================================
if mob_exists ("duck_walking" ) then
dofile (mp .. "/duck_walking.lua" )
end
if mob_exists ("baby" ) then
dofile (mp .. "/baby.lua" )
end
if mob_exists ("badger" ) then
dofile (mp .. "/badger.lua" )
end
if mob_exists ("bat" ) then
dofile (mp .. "/bat.lua" )
end
if mob_exists ("bear" ) then
dofile (mp .. "/bear.lua" )
end
if mob_exists ("bee" ) then
dofile (mp .. "/bee.lua" )
end
if mob_exists ("beetle" ) then
dofile (mp .. "/beetle.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("bird" ) then
dofile (mp .. "/bird.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("bom" ) and
model_exists ("codermobs_bom.b3d" ) then
dofile (mp .. "/bom.lua" )
end
if mob_exists ("fox" ) then
dofile (mp .. "/fox.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("icebom" ) and
model_exists ("codermobs_bom.b3d" ) then
dofile (mp .. "/icebom.lua" )
end
if mob_exists ("bug" ) then
dofile (mp .. "/bug.lua" )
end
if mob_exists ("bunny" ) then
dofile (mp .. "/bunny.lua" )
end
if mob_exists ("butterfly" ) then
dofile (mp .. "/butterfly.lua" )
end
if mob_exists ("cacodemon" ) then
dofile (mp .. "/cacodemon.lua" )
end
if mob_exists ("camel" ) then
dofile (mp .. "/camel.lua" )
end
if mob_exists ("car" ) then
dofile (mp .. "/car.lua" )
end
if mob_exists ("caveman" ) then
dofile (mp .. "/caveman.lua" )
end
if mob_exists ("cow" ) then
dofile (mp .. "/cow.lua" )
end
if mob_exists ("cyberdemon" ) then
dofile (mp .. "/cyberdemon.lua" )
end
if mob_exists ("deer" ) then
dofile (mp .. "/deer.lua" )
end
if mob_exists ("denny" ) then
dofile (mp .. "/denny.lua" )
end
if mob_exists ("digibug" ) then
dofile (mp .. "/digibug.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("dirt_monster" ) then
dofile (mp .. "/dirt_monster.lua" )
end
if mob_exists ("dog" ) then
dofile (mp .. "/dog.lua" )
end
if mob_exists ("elephant" ) then
dofile (mp .. "/elephant.lua" )
end
if mob_exists ("elk" ) then
dofile (mp .. "/elk.lua" )
end
if mob_exists ("farhorse" ) then
dofile (mp .. "/farhorse.lua" )
end
if mob_exists ("flying_pig" ) then
dofile (mp .. "/flying_pig.lua" )
end
if mob_exists ("ghost" ) then
dofile (mp .. "/ghost.lua" )
end
if mob_exists ("goat" ) then
dofile (mp .. "/goat.lua" )
end
if mob_exists ("hedgehog" ) then
dofile (mp .. "/hedgehog.lua" )
end
if mob_exists ("hippo" ) then
dofile (mp .. "/hippo.lua" )
end
if mob_exists ("hotdog" ) then
dofile (mp .. "/hotdog.lua" )
end
if mob_exists ("jeraf" ) then
dofile (mp .. "/jeraf.lua" )
end
if mob_exists ("kangaroo" ) then
dofile (mp .. "/kangaroo.lua" )
end
if mob_exists ("kitten" ) then
dofile (mp .. "/kitten.lua" )
end
if mob_exists ("lava_flan" ) then
dofile (mp .. "/lava_flan.lua" )
end
if mob_exists ("lawyer" ) then
dofile (mp .. "/lawyer.lua" )
end
if mob_exists ("letterg" ) then
dofile (mp .. "/letterg.lua" )
end
if mob_exists ("lostsoul" ) then
dofile (mp .. "/lostsoul.lua" )
end
if mob_exists ("lott_spider" ) then
dofile (mp .. "/lott_spider.lua" )
end
if mob_exists ("mammoth" ) then
dofile (mp .. "/mammoth.lua" )
end
if mob_exists ("mcpig" ) then
dofile (mp .. "/mcpig.lua" )
end
if mob_exists ("mdskeleton" ) then
dofile (mp .. "/mdskeleton.lua" )
end
if mob_exists ("oerkki" ) then
dofile (mp .. "/oerkki.lua" )
end
if mob_exists ("oldlady" ) then
dofile (mp .. "/oldlady.lua" )
end
if mob_exists ("ostrich" ) then
dofile (mp .. "/ostrich.lua" )
end
if mob_exists ("owl" ) then
dofile (mp .. "/owl.lua" )
end
if mob_exists ("panda" ) then
dofile (mp .. "/panda.lua" )
end
if mob_exists ("penguin" ) then
dofile (mp .. "/penguin.lua" )
end
if mob_exists ("plane" ) then
dofile (mp .. "/plane.lua" )
end
if mob_exists ("polar_bear" ) then
dofile (mp .. "/polar_bear.lua" )
end
if mob_exists ("rat" ) then
dofile (mp .. "/rat.lua" )
end
if mob_exists ("rat_better" ) then
dofile (mp .. "/rat_better.lua" )
end
if mob_exists ("robotted" ) then
dofile (mp .. "/robotted.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("santa" ) and
textu_exists ("codermobs_santa.png" ) then
dofile (mp .. "/santa.lua" )
end
if mob_exists ("sheep" ) then
dofile (mp .. "/sheep.lua" )
end
if mob_exists ("silverfish" ) then
dofile (mp .. "/silverfish.lua" )
end
if mob_exists ("snail" ) then
dofile (mp .. "/snail.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("snake_garter" ) and
model_exists ("codermobs_snake.x" ) then
dofile (mp .. "/snake_garter.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("snake_ice" ) and
model_exists ("codermobs_snake.x" ) then
dofile (mp .. "/snake_ice.lua" )
end
if mob_exists ("snowman" ) then
dofile (mp .. "/snowman.lua" )
end
if mob_exists ("tiger" ) then
dofile (mp .. "/tiger.lua" )
end
if mob_exists ("tree_monster" ) then
dofile (mp .. "/tree_monster.lua" )
end
if mob_exists ("trex" ) then
dofile (mp .. "/trex.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("vombie" ) then
dofile (mp .. "/vombie.lua" )
end
if mob_exists ("warthog" ) then
dofile (mp .. "/warthog.lua" )
end
if mob_exists ("wolf" ) then
dofile (mp .. "/wolf.lua" )
end
-- Filenames are a special case for this mob
if lua_exists ("zebra" ) then
dofile (mp .. "/zebra.lua" )
end
-- Moon Cow should be defined after regular cow.
--
if enable_moontest and mob_exists ("cow") then
dofile (mp .. "/mooncow.lua" )
end
-- This is an object as opposed to a mob
if lua_exists ("dungeon_spawner" ) then
dofile (mp .. "/dungeon_spawner.lua" )
end
-- ===================================================================
-- End of file.
Loading…
Cancel
Save