From b50676c0b5ab2b15b6b78883808dac5410ce1e3c Mon Sep 17 00:00:00 2001 From: "A. Demant" Date: Thu, 22 Nov 2018 05:11:53 +0100 Subject: [PATCH] slimemonster -> new config --- init.lua | 1 + mobs.txt | 15 +-- read_mobs_config.lua | 144 +++++++++++++++++++++++ textures/minerdream_slime_green_side.png | Bin 0 -> 161 bytes textures/minerdream_slime_green_top.png | Bin 0 -> 157 bytes 5 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 read_mobs_config.lua create mode 100644 textures/minerdream_slime_green_side.png create mode 100644 textures/minerdream_slime_green_top.png diff --git a/init.lua b/init.lua index edf34ea..0c7d610 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,7 @@ dofile(minerdream.path .. "/armor.lua") dofile(minerdream.path .. "/treasure.lua") dofile(minerdream.path .. "/experiments.lua") --dofile(minerdream.path .. "/mobs.lua") +dofile(minerdream.path .. "/read_mobs_config.lua") dofile(minerdream.path .. "/awards.lua") --print(dump(minerdream.items)) diff --git a/mobs.txt b/mobs.txt index a909944..dced3da 100644 --- a/mobs.txt +++ b/mobs.txt @@ -1,7 +1,8 @@ -name,attack_type,reach,damage,hp_min,hp_max,armor,collisionbox,walk_velocity,run_velocity,walk_chance,fall_speed,jump_chance,jump_height,stepheight,view_range,slimeball,egg,slimering,water_damage,lava_damage,light_damage -slime_green,dogfight,2,1,5,5,100,0.3,2,2,0,-50,30,6,1.1,16,1,100,200,0,8,0 -slime_blue,dogfight,2,2,8,8,100,0.45,2,2,0,-50,30,6,1.1,16,1,100,175,0,8,0 -slime_red,dogfight,2,3,12,12,100,0.6,3,3,0,-50,30,7,1.1,16,1,100,150,0,8,0 -slime_yellow,dogfight,2,4,20,20,100,0.75,3,3,0,-50,30,7,1.1,16,1,100,125,0,8,0 -slime_purple,dogfight,2,6,35,35,100,0.9,4,4,0,-50,30,8,1.1,16,1,100,100,0,8,0 -slime_brown,dogfight,3.5,8,50,50,100,1.05,4,4,0,-50,30,9,1.2,16,1,100,75,0,8,0 +name,attack_type,reach,damage,hp_min,hp_max,armor,collisionbox,walk_velocity,run_velocity,walk_chance,fall_speed,jump_chance,jump_height,stepheight,view_range,slimeball,egg,slimering,water_damage,lava_damage,light_damage,maxlight,chance,max_height +default,dogfight,2,,,,100,,,,0,-50,30,,1.1,16,1,100,,0,8,0,10,, +green,,,1,5,5,,0.3,2,2,,,,6,,,,,200,,,,,1000,0 +blue,,,2,8,8,,0.45,2,2,,,,6,,,,,175,,,,,1250,-50 +red,,,3,12,12,,0.6,3,3,,,,7,,,,,150,,,,,1500,-100 +yellow,,,4,20,20,,0.75,3,3,,,,7,,,,,125,,,,,1750,-250 +purple,,,6,35,35,,0.9,4,4,,,,8,,,,,100,,,,,2000,-500 +brown,,3.5,8,50,50,,1.05,4,4,,,,9,1.2,,,,75,,,,,2000,-1200 diff --git a/read_mobs_config.lua b/read_mobs_config.lua new file mode 100644 index 0000000..679e0b4 --- /dev/null +++ b/read_mobs_config.lua @@ -0,0 +1,144 @@ + +local has_value = minerdream.has_value +local mob_cols={ + col_num={"reach","damage","hp_min", + "hp_max","armor","walk_velocity","run_velocity","walk_chance", + "fall_speed","jump_chance","jump_height","stepheight","floats", + "view_range","water_damage","lava_damage","light_damage","slimeball", + "egg","slimering","maxlight","chance","max_height","collisionbox"}, +-- as_numeric=1, +} +local mob_definition = minerdream.import_csv(minerdream.path.."/mobs.txt",mob_cols) +--print(dump2(tool_definition)) + +local mob_default = { + type = "monster", + passive = false, + attack_type = "dogfight", + reach = 2, + damage = 1, + hp_min = 5, + hp_max = 5, + armor = 100, + collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.3, 0.3}, + visual = "wielditem", + makes_footstep_sound = true, + walk_velocity = 2, + run_velocity = 2, + walk_chance = 0, + fall_speed = -50, + jump_chance = 30, + jump_height = 6, + stepheight = 1.1, + floats = 0, + view_range = 16, + water_damage = 0, + lava_damage = 8, + light_damage = 0, + animation = { + speed_normal = 15, + speed_run = 15, + stand_start = 0, + stand_end = 14, + walk_start = 15, + walk_end = 38, + run_start = 40, + run_end = 63, + punch_start = 40, + punch_end = 63, + }, + } + +if mob_definition["default"] ~= nil then + tmobd=table.copy(mob_definition["default"]) + for _,column in pairs({"attack_type","reach","damage","hp_min", + "hp_max","armor","walk_velocity","run_velocity","walk_chance", + "fall_speed","jump_chance","jump_height","stepheight","floats", + "view_range","water_damage","lava_damage","light_damage","slimeball", + "egg","slimering","maxlight","chance","max_height"}) do + if tmobd[column] ~= nil then + mob_default[column]=tmobd[column] + end + end + if tmobd["collisionbox"] ~= nil then + local cb=tmobd["collisionbox"] + mob_default["collisionbox"] = {-1*cb, -1*cb, -1*cb, cb, cb, cb} + end +end + +for i,tdef in pairs(mob_definition) do + if (i ~= "default") then + local mdef=table.copy(mob_default) + for _,column in pairs({"attack_type","reach","damage","hp_min", + "hp_max","armor","walk_velocity","run_velocity","walk_chance", + "fall_speed","jump_chance","jump_height","stepheight","floats", + "view_range","water_damage","lava_damage","light_damage","slimeball", + "egg","slimering","maxlight","chance","max_height"}) do + if tdef[column] ~= nil then + mdef[column]=tdef[column] + end + end + if tdef["collisionbox"] ~= nil then + local cb=tdef["collisionbox"] + mdef["collisionbox"] = {-1*cb, -1*cb, -1*cb, cb, cb, cb} + end + mdef.textures = { + {"minerdream:slime_"..i}, + } + mdef.blood_texture = "minerdream_slimeball_"..i..".png" + mdef,drops = { + {name = "minerdream:slimeball_"..i, chance = mdef.slimeball, min = 1, max = 3}, + {name = "minerdream:slime_"..i.."_egg", chance = mdef.egg, min = 1, max = 1}, + {name = "minerdream:accessory_slimering", chance = mdef.slimering, min = 1, max = 1}, + } + + mobs:register_mob("minerdream:slime_"..i, mdef) + mobs:spawn({ + name = "minerdream:slime_"..i, + nodes = {"default:stone"}, + max_light = mdef.maxlight, + chance = mdef.chance, + max_height = mdef.max_height, + }) + + minetest.register_craftitem("minerdream:slime_"..i.."_egg", { + description = i.." slime spawnegg", + inventory_image = "minerdream_egg_"..i.."slime.png", + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.above then + minetest.env:add_entity(pointed_thing.above, "minerdream:slime_"..i) + itemstack:take_item() + end + return itemstack + end, + }) + minetest.register_node("minerdream:slime_"..i, { + tiles = { + "minerdream_slime_"..i.."_top.png", + "minerdream_slime_"..i.."_top.png", + "minerdream_slime_"..i.."_side.png", + "minerdream_slime_"..i.."_side.png", + "minerdream_slime_"..i.."_side.png", + "minerdream_slime_"..i.."_side.png" + }, + drawtype = "nodebox", + wield_scale = {x=0.4,y=0.4,z=0.4}, + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.3125, -0.5, -0.3125, 0.3125, 0.3125, 0.3125}, -- NodeBox1 + {-0.375, -0.5, -0.3125, 0.375, 0.25, 0.3125}, -- NodeBox2 + {-0.3125, -0.5, -0.375, 0.3125, 0.25, 0.375}, -- NodeBox3 + {-0.3125, -0.4375, -0.4375, 0.3125, 0.125, 0.4375}, -- NodeBox4 + {-0.375, -0.4375, -0.375, 0.375, 0.125, 0.375}, -- NodeBox5 + {-0.4375, -0.4375, -0.3125, 0.4375, 0.125, 0.3125}, -- NodeBox6 + {-0.25, -0.375, -0.5, 0.25, 0, 0.5}, -- NodeBox7 + {-0.5, -0.375, -0.25, 0.5, 0, 0.25}, -- NodeBox8 + } + } + }) + + end +end + diff --git a/textures/minerdream_slime_green_side.png b/textures/minerdream_slime_green_side.png new file mode 100644 index 0000000000000000000000000000000000000000..4f958b10e3aab0edd840a70a3b0e110e18b631a9 GIT binary patch literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPE^4e$wZ{r~^JR0D&`W(M8+3`V~h zBL3@_{|}A3JM%wKfxD-RV@L&KQc?p`4v$0oBS!`Yk){9>#_RSfW*_dAZ+^9y=RshD zb404m^pgsmJj;19_uaEQ&Ew#uav;x$c}Bo$KBk~q^)J|uI?A;#;&EpI8p+`4>gTe~ HDWM4fh?q5T literal 0 HcmV?d00001 diff --git a/textures/minerdream_slime_green_top.png b/textures/minerdream_slime_green_top.png new file mode 100644 index 0000000000000000000000000000000000000000..ef2dcef36d619013948350c0427e8d0d5e4fb2f6 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|DV{ElAr*|tKl)jgNJ(r^6fxyF zu`1Lo*;S)T;zG#ld+yFJsw50TrT@Aq_}KD9gu4H^&aSkkszG9R7LTol)P>OL|M^*! zQfy}cnTua8jA2expZGd+QuEX;9m=|y6K4MK@Vm$0=Mv^KyMBrR&^`uFS3j3^P6