mcl_dream/init.lua

1305 lines
36 KiB
Lua

local S = minetest.get_translator(minetest.get_current_modname())
--###################
--################### DREAM
--###################
local drops_common = {
{name = "mcl_core:diamond",
chance = 1,
min = 1,
max = 3,
looting = "common",},
}
local drops_dream = table.copy(drops_common)
table.insert(drops_dream, {
name = "mcl_dream:dream_channel_block",
chance = 15,
min = 1,
max = 1,
})
local dream = {
description = S("Dream"),
type = "monster",
spawn_class = "hostile",
hp_min = 20,
hp_max = 20,
xp_min = 5,
xp_max = 5,
breath_max = -1,
armor = {undead = 90, fleshy = 90},
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.69, 0.7},
visual = "mesh",
mesh = "mcl_dream_dream.b3d",
textures = {
{
"mcl_dream_dream.png",
}
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
walk_velocity = 15,
run_velocity = 15,
damage = 10,
reach = 2,
fear_height = 4,
pathfinding = 1,
jump = true,
jump_height = 4,
drops = drops_dream,
animation = {
speed_normal = 25, speed_run = 50,
stand_start = 40, stand_end = 80,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
view_range = 16,
attack_type = "dogfight",
harmed_by_heal = true,
}
mcl_mobs:register_mob("mcl_dream:dream", dream)
-- Spawning
mcl_mobs:spawn_specific(
"mcl_dream:dream",
"overworld",
"ground",
{
"FlowerForest_underground",
"JungleEdge_underground",
"StoneBeach_underground",
"MesaBryce_underground",
"Mesa_underground",
"RoofedForest_underground",
"Jungle_underground",
"Swampland_underground",
"MushroomIsland_underground",
"BirchForest_underground",
"Plains_underground",
"MesaPlateauF_underground",
"ExtremeHills_underground",
"MegaSpruceTaiga_underground",
"BirchForestM_underground",
"SavannaM_underground",
"MesaPlateauFM_underground",
"Desert_underground",
"Savanna_underground",
"Forest_underground",
"SunflowerPlains_underground",
"ColdTaiga_underground",
"IcePlains_underground",
"IcePlainsSpikes_underground",
"MegaTaiga_underground",
"Taiga_underground",
"ExtremeHills+_underground",
"JungleM_underground",
"ExtremeHillsM_underground",
"JungleEdgeM_underground",
"Mesa",
"FlowerForest",
"Swampland",
"Taiga",
"ExtremeHills",
"Jungle",
"Savanna",
"BirchForest",
"MegaSpruceTaiga",
"MegaTaiga",
"ExtremeHills+",
"Forest",
"Plains",
"ColdTaiga",
"MushroomIsland",
"IcePlainsSpikes",
"SunflowerPlains",
"IcePlains",
"RoofedForest",
"ExtremeHills+_snowtop",
"MesaPlateauFM_grasstop",
"JungleEdgeM",
"ExtremeHillsM",
"JungleM",
"BirchForestM",
"MesaPlateauF",
"MesaPlateauFM",
"MesaPlateauF_grasstop",
"MesaBryce",
"JungleEdge",
"SavannaM",
"FlowerForest_beach",
"Forest_beach",
"StoneBeach",
"ColdTaiga_beach_water",
"Taiga_beach",
"Savanna_beach",
"Plains_beach",
"ExtremeHills_beach",
"ColdTaiga_beach",
"Swampland_shore",
"MushroomIslandShore",
"JungleM_shore",
"Jungle_shore",
"MesaPlateauFM_sandlevel",
"MesaPlateauF_sandlevel",
"MesaBryce_sandlevel",
"Mesa_sandlevel",
},
0,
minetest.LIGHT_MAX+1,
30,
15000,
3,
mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max)
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream", S("Dream"), "", 0)
minetest.register_craft({
output = "mcl_dream:pick",
recipe = {
{"mcl_dream:dream_ingot", "mcl_dream:dream_ingot", "mcl_dream:dream_ingot"},
{"", "mcl_core:stick", ""},
{"", "mcl_core:stick", ""},
}
})
minetest.register_craft({
output = "mcl_dream:sword",
recipe = {
{"", "mcl_dream:dream_ingot", ""},
{"", "mcl_dream:dream_ingot", ""},
{"", "mcl_core:stick", ""},
}
})
-- Registering tools
minetest.register_tool("mcl_dream:pick", {
description = S("Dream Pickaxe"),
_doc_items_longdesc = pickaxe_longdesc,
inventory_image = "mcl_dream_dream_pick.png",
wield_scale = wield_scale,
groups = { tool=1, pickaxe=1, dig_speed_class=8, enchantability=10 },
tool_capabilities = {
-- 1/1.2
full_punch_interval = 0.83333333,
max_drop_level=5,
damage_groups = {fleshy=6},
punch_attack_uses = 898,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_dream:dream_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
pickaxey = { speed = 8, level = 5, uses = 3000 }
},
_mcl_upgradable = true,
_mcl_upgrade_item = "mcl_tools:pick_netherite"
})
minetest.register_tool("mcl_dream:sword", {
description = S("Dream Sword"),
_doc_items_longdesc = sword_longdesc,
inventory_image = "mcl_dream_dream_sword.png",
wield_scale = wield_scale,
groups = { weapon=1, sword=1, dig_speed_class=6, enchantability=10 },
tool_capabilities = {
full_punch_interval = 0.625,
max_drop_level=5,
damage_groups = {fleshy=15},
punch_attack_uses = 1796,
},
sound = { breaks = "default_tool_breaks" },
_repair_material = "mcl_dream:dream_ingot",
_mcl_toollike_wield = true,
_mcl_diggroups = {
swordy = { speed = 8, level = 5, uses = 1796 },
swordy_cobweb = { speed = 8, level = 5, uses = 3000 }
},
_mcl_upgradable = true,
_mcl_upgrade_item = "mcl_tools:sword_netherite"
})
minetest.register_craftitem("mcl_dream:dream_ingot",{
description = S("Dream Ingot"),
_doc_items_longdesc = S("Dream Ingot"),
inventory_image = "mcl_dream_dream_ingot.png",
stack_max = 64,
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_dream:dream_totem",{
description = S("Dream Totem"),
_doc_items_longdesc = S("Dream Totem"),
inventory_image = "mcl_dream_dream_totem.png",
stack_max = 64,
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_dream:dream_totem_2",{
description = S("Dream Totem"),
_doc_items_longdesc = S("Dream Totem"),
inventory_image = "mcl_dream_dream_totem_2.png",
stack_max = 64,
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_dream:dream_totem_3",{
description = S("Dream Totem"),
_doc_items_longdesc = S("Dream Totem"),
inventory_image = "mcl_dream_dream_totem_3.png",
stack_max = 64,
groups = { craftitem = 1 },
})
minetest.register_craftitem("mcl_dream:dream_totem_4",{
description = S("Dream Totem"),
_doc_items_longdesc = S("Dream Totem"),
inventory_image = "mcl_dream_dream_totem_4.png",
stack_max = 64,
groups = { craftitem = 1 },
})
local S = minetest.get_translator(minetest.get_current_modname())
local hud_totem = {}
minetest.register_on_leaveplayer(function(player)
hud_totem[player] = nil
end)
minetest.register_craftitem("mcl_dream:technoblade_totem", {
description = S("Technoblade Totem (RIP Techoblade)"),
_tt_help = minetest.colorize(mcl_colors.GREEN, S("Protects you from death while wielding it")),
_doc_items_longdesc = S("A totem of undying is a rare artifact which may safe you from certain death."),
_doc_items_usagehelp = S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."),
inventory_image = "mcl_dream_technoblade_totem.png",
wield_image = "mcl_dream_technoblade_totem.png",
stack_max = 1,
groups = {combat_item = 1, offhand_item = 1},
})
minetest.register_alias("mobs_mc:technoblade_totem", "mcl_dream:technoblade_totem")
local particle_colors = {"98BF22", "C49E09", "337D0B", "B0B021", "1E9200"} -- TODO: real MC colors
-- Save the player from death when holding totem of undying in hand
mcl_damage.register_modifier(function(obj, damage, reason)
if obj:is_player() and not reason.bypasses_totem then
local hp = obj:get_hp()
if hp - damage <= 0 then
local wield = obj:get_wielded_item()
local in_offhand = false
if not (wield:get_name() == "mcl_dream:technoblade_totem") then
local inv = obj:get_inventory()
if inv then
wield = obj:get_inventory():get_stack("offhand", 1)
in_offhand = true
end
end
if wield:get_name() == "mcl_dream:technoblade_totem" then
local ppos = obj:get_pos()
local pnname = minetest.get_node(ppos).name
if obj:get_breath() < 11 then
obj:set_breath(10)
end
if not minetest.is_creative_enabled(obj:get_player_name()) then
wield:take_item()
if in_offhand then
obj:get_inventory():set_stack("offhand", 1, wield)
mcl_inventory.update_inventory_formspec(obj)
else
obj:set_wielded_item(wield)
end
end
awards.unlock(obj:get_player_name(), "mcl:postMortal")
-- Effects
minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true)
for i = 1, 4 do
for c = 1, #particle_colors do
minetest.add_particlespawner({
amount = math.floor(100 / (4 * #particle_colors)),
time = 1,
minpos = vector.offset(ppos, 0, -1, 0),
maxpos = vector.offset(ppos, 0, 1, 0),
minvel = vector.new(-1.5, 0, -1.5),
maxvel = vector.new(1.5, 1.5, 1.5),
minacc = vector.new(0, -0.1, 0),
maxacc = vector.new(0, -1, 0),
minexptime = 1,
maxexptime = 3,
minsize = 1,
maxsize = 2,
collisiondetection = true,
collision_removal = true,
object_collision = false,
vertical = false,
texture = "mcl_particles_totem" .. i .. ".png^[colorize:#" .. particle_colors[c],
glow = 10,
})
end
end
-- Big totem overlay
if not hud_totem[obj] then
hud_totem[obj] = obj:hud_add({
hud_elem_type = "image",
text = "mcl_dream_technoblade_totem.png",
position = {x = 0.5, y = 1},
scale = {x = 17, y = 17},
offset = {x = 0, y = -178},
z_index = 100,
})
minetest.after(3, function()
if obj:is_player() then
obj:hud_remove(hud_totem[obj])
hud_totem[obj] = nil
end
end)
end
-- Set HP to exactly 1
return hp - 1
end
end
end
end, 1000)
minetest.register_node("mcl_dream:dream_ore", {
description = S("Dream Ore"),
_doc_items_longdesc = S("Ore Dream Block"),
tiles = {"mcl_dream_dream_ore.png"},
is_ground_content = false,
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {pickaxey=1, building_block = 1, xp=1},
drop = "mcl_dream:dream_ingot",
on_rotate = on_rotate,
_mcl_silk_touch_drop = true,
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
})
minetest.register_node("mcl_dream:dream_channel_block", {
description = S("Dream Channel Block"),
_doc_items_longdesc = S("Obtain 3 of this block and spawn The Dream Error."),
tiles = {"mcl_dream_dream_channel_block.png"},
is_ground_content = false,
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {pickaxey=1, building_block = 1, xp=1},
on_rotate = on_rotate,
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
})
minetest.register_node("mcl_dream:dream_block", {
description = S("Dream Block"),
_doc_items_longdesc = S("Obtain 4 of this block and spawn The Dream Error."),
tiles = {"mcl_dream_dream_block.png"},
is_ground_content = false,
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {pickaxey=1, building_block = 1, xp=1},
on_rotate = on_rotate,
_mcl_blast_resistance = 3,
_mcl_hardness = 3,
})
--
-- Dream Ore Mapgen
--
minetest.register_ore({
ore_type = "blob",
ore = "mcl_dream:dream_ore",
wherein = { "mcl_core:stone", "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite"},
clust_scarcity = 10*10*10,
clust_num_ores = 58,
clust_size = 7,
y_min = layer_min,
y_max = layer_max,
noise_params = {
offset = 0,
scale = 1,
spread = {x=250, y=250, z=250},
seed = 12345,
octaves = 3,
persist = 0.6,
lacunarity = 2,
flags = "defaults",
}
})
minetest.register_craftitem("mcl_dream:apple_dream_enchanted", {
description = S("Enchanted Dream Apple"),
_doc_items_longdesc = S("Dream apples are precious food items which can be eaten."),
wield_image = "mcl_dream_apple_dream_enchanted.png",
inventory_image = "mcl_dream_apple_dream_enchanted.png",
stack_max = 64,
on_place = minetest.item_eat(30),
on_secondary_use = minetest.item_eat(30),
groups = { food = 2, eatable = 1, can_eat_when_full = 1 },
_mcl_saturation = 30,
})
minetest.register_craft({
output = "mcl_dream:dream_block 4",
recipe = {
{"mcl_dream:dream_totem", "mcl_dream:dream_totem_2"},
{"mcl_dream:dream_totem_3", "mcl_dream:dream_totem_4"},
}
})
minetest.register_craft({
output = "mcl_dream:apple_dream_enchanted",
recipe = {
{"mcl_dream:dream_ingot", "mcl_dream:dream_ingot", "mcl_dream:dream_ingot"},
{"mcl_dream:dream_ingot", "mcl_core:apple", "mcl_dream:dream_ingot"},
{"mcl_dream:dream_ingot", "mcl_dream:dream_ingot", "mcl_dream:dream_ingot"},
}
})
--###################
--################### The Dream Error
--###################
local drops_common = {
{name = "mcl_nether:netheriteblock",
chance = 1,
min = 1,
max = 1,
looting = "common",},
{name = "mcl_dream:technoblade_totem",
chance = 1,
min = 1,
max = 1,
looting = "common",},
}
local dream_error = {
description = S("Dream_error"),
type = "monster",
spawn_class = "hostile",
hp_min = 500,
hp_max = 500,
xp_min = 50,
xp_max = 50,
breath_max = -1,
armor = {undead = 90, fleshy = 90},
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.69, 0.7},
visual = "mesh",
mesh = "mobs_mc_zombie.b3d",
textures = {
{
"mcl_dream_dream_error.png",
}
},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
walk_velocity = 8,
run_velocity = 8,
damage = 30,
reach = 2,
fear_height = 4,
pathfinding = 1,
jump = true,
do_custom = function(self)
if self.health < (self.hp_max / 2) then
self.base_texture = "mcl_dream_dream_error.png"
self.fly = false
self.object:set_properties({textures={self.base_texture}})
self.armor = {undead = 80, fleshy = 80}
end
mcl_bossbars.update_boss(self.object, "The Dream Error", "green")
end,
jump_height = 4,
drops = drops_common,
animation = {
speed_normal = 25, speed_run = 50,
stand_start = 40, stand_end = 80,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
view_range = 16,
attack_type = "dogfight",
harmed_by_heal = true,
}
mcl_mobs:register_mob("mcl_dream:dream_error", dream_error)
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream_error", S("The Dream Error"), "mcl_dream_dream_error.png", 0)
minetest.register_craft({
output = "mcl_dream:dream_error",
recipe = {
{"mcl_dream:dream_channel_block", "mcl_dream:dream_channel_block", "mcl_dream:dream_channel_block"},
{"mcl_dream:dream_block", "mcl_dream:dream_block", "mcl_dream:dream_block"},
{"", "mcl_dream:dream_block", ""},
}
})
local mod_target = minetest.get_modpath("mcl_target")
--###################
--################### DREAM BLAZE
--###################
mcl_mobs:register_mob("mcl_dream:dream_blaze", {
description = S("Dream Blaze"),
type = "monster",
spawn_class = "hostile",
hp_min = 20,
hp_max = 20,
xp_min = 10,
xp_max = 10,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.79, 0.3},
rotate = -180,
visual = "mesh",
mesh = "mobs_mc_blaze.b3d",
textures = {
{"mcl_dream_dream_blaze.png"},
},
armor = { fleshy = 100, snowball_vulnerable = 100, water_vulnerable = 100 },
visual_size = {x=3, y=3},
sounds = {
random = "mobs_mc_blaze_breath",
death = "mobs_mc_blaze_died",
damage = "mobs_mc_blaze_hurt",
distance = 16,
},
walk_velocity = .8,
run_velocity = 1.6,
damage = 6,
reach = 2,
pathfinding = 1,
drops = {
{name = "mcl_dream:apple_dream_enchanted",
chance = 1,
min = 0,
max = 1,
looting = "common",},
},
animation = {
stand_speed = 25,
stand_start = 0,
stand_end = 100,
walk_speed = 25,
walk_start = 0,
walk_end = 100,
run_speed = 50,
run_start = 0,
run_end = 100,
},
lava_damage = 0,
fire_damage = 0,
fall_damage = 0,
fall_speed = -2.25,
light_damage = 0,
view_range = 16,
attack_type = "dogshoot",
arrow = "mcl_dream:blaze_fireball",
shoot_interval = 3.5,
shoot_offset = 1.0,
passive = false,
jump = true,
jump_height = 4,
fly = true,
makes_footstep_sound = false,
fear_height = 0,
glow = 14,
fire_resistant = true,
do_custom = function(self)
if self.state == "attack" and self.attack:get_pos() and vector.distance(self.object:get_pos(), self.attack:get_pos()) < 1.2 then
mcl_burning.set_on_fire(self.attack, 5)
end
local pos = self.object:get_pos()
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#2c2c2c:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#424242:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
minetest.add_particle({
pos = {x=pos.x+math.random(-0.7,0.7)*math.random()/2,y=pos.y+math.random(0.7,1.2),z=pos.z+math.random(-0.7,0.7)*math.random()/2},
velocity = {x=0, y=math.random(1,1), z=0},
expirationtime = math.random(),
size = math.random(1, 4),
collisiondetection = true,
vertical = false,
texture = "mcl_particles_smoke_anim.png^[colorize:#0f0f0f:255",
animation = {
type = "vertical_frames",
aspect_w = 8,
aspect_h = 8,
length = 2.05,
},
})
end,
})
-- (Dream) Blaze fireball
mcl_mobs:register_arrow("mcl_dream:blaze_fireball", {
visual = "sprite",
visual_size = {x = 0.3, y = 0.3},
textures = {"mcl_fire_fire_charge.png"},
velocity = 15,
_is_fireball = true,
-- Direct hit, no fire... just plenty of pain
hit_player = function(self, player)
mcl_burning.set_on_fire(player, 5)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 5},
}, nil)
end,
hit_mob = function(self, mob)
mcl_burning.set_on_fire(mob, 5)
mob:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 5},
}, nil)
end,
hit_object = function(self, object)
local lua = object:get_luaentity()
if lua then
if lua.name == "mcl_minecarts:tnt_minecart" then
lua:on_activate_by_rail(2)
end
end
end,
-- Node hit, make fire
hit_node = function(self, pos, node)
if node == "air" then
minetest.set_node(pos, {name = "mcl_fire:fire"})
else
if self._shot_from_dispenser and mod_target and node == "mcl_target:target_off" then
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
end
local v = vector.normalize(self.object:get_velocity())
local crashpos = vector.subtract(pos, v)
local crashnode = minetest.get_node(crashpos)
local cndef = minetest.registered_nodes[crashnode.name]
-- Set fire if node is air, or a replacable flammable node (e.g. a plant)
if crashnode.name == "air" or
(cndef and cndef.buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then
minetest.set_node(crashpos, {name = "mcl_fire:fire"})
end
end
end
})
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream_blaze", S("Dream Blaze"), "mobs_mc_spawn_icon_blaze.png", 0)
--###################
--################### DREAM CREEPER
--###################
mcl_mobs:register_mob("mcl_dream:dream_creeper", {
type = "monster",
spawn_class = "hostile",
hp_min = 20,
hp_max = 20,
xp_min = 5,
xp_max = 5,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.69, 0.3},
pathfinding = 1,
visual = "mesh",
mesh = "mobs_mc_creeper.b3d",
textures = {
{"mcl_dream_dream_creeper.png",
"mobs_mc_empty.png"},
},
visual_size = {x=3, y=3},
sounds = {
attack = "tnt_ignite",
death = "mobs_mc_creeper_death",
damage = "mobs_mc_creeper_hurt",
fuse = "tnt_ignite",
explode = "tnt_explode",
distance = 16,
},
makes_footstep_sound = true,
walk_velocity = 1.05,
run_velocity = 2.1,
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode",
--hssssssssssss
explosion_strength = 3,
explosion_radius = 3.5,
explosion_damage_radius = 3.5,
explosiontimer_reset_radius = 6,
reach = 3,
explosion_timer = 1.5,
allow_fuse_reset = true,
stop_to_explode = true,
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
-- TODO: Make creeper flash after doing this as well.
-- TODO: Test and debug this code.
on_rightclick = function(self, clicker)
if self._forced_explosion_countdown_timer ~= nil then
return
end
local item = clicker:get_wielded_item()
if item:get_name() == "mcl_fire:flint_and_steel" then
if not minetest.is_creative_enabled(clicker:get_player_name()) then
-- Wear tool
local wdef = item:get_definition()
item:add_wear(1000)
-- Tool break sound
if item:get_count() == 0 and wdef.sound and wdef.sound.breaks then
minetest.sound_play(wdef.sound.breaks, {pos = clicker:get_pos(), gain = 0.5}, true)
end
clicker:set_wielded_item(item)
end
self._forced_explosion_countdown_timer = self.explosion_timer
minetest.sound_play(self.sounds.attack, {pos = self.object:get_pos(), gain = 1, max_hear_distance = 16}, true)
end
end,
do_custom = function(self, dtime)
if self._forced_explosion_countdown_timer ~= nil then
self._forced_explosion_countdown_timer = self._forced_explosion_countdown_timer - dtime
if self._forced_explosion_countdown_timer <= 0 then
mcl_mobs:boom(self, mcl_util.get_object_center(self.object), self.explosion_strength)
end
end
end,
on_die = function(self, pos, cmi_cause)
-- Drop a random music disc when killed by skeleton or stray
if cmi_cause and cmi_cause.type == "punch" then
local luaentity = cmi_cause.puncher and cmi_cause.puncher:get_luaentity()
if luaentity and luaentity.name:find("arrow") then
local shooter_luaentity = luaentity._shooter and luaentity._shooter:get_luaentity()
if shooter_luaentity and (shooter_luaentity.name == "mobs_mc:skeleton" or shooter_luaentity.name == "mobs_mc:stray") then
minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, "mcl_jukebox:record_" .. math.random(9))
end
end
end
end,
maxdrops = 2,
drops = {
{name = "mcl_mobitems:gunpowder",
chance = 1,
min = 0,
max = 2,
looting = "common",},
},
animation = {
speed_normal = 24,
speed_run = 48,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 110,
hurt_end = 139,
death_start = 140,
death_end = 189,
look_start = 50,
look_end = 108,
},
floats = 1,
fear_height = 4,
view_range = 16,
})
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream_creeper", S("Dream Creeper"), "mobs_mc_spawn_icon_creeper.png", 0)
--###################
--################### DREAM SPIDER
--###################
local dream_spider = {
description = S("Dream Spider"),
type = "monster",
spawn_class = "hostile",
passive = false,
docile_by_day = true,
attack_type = "dogfight",
pathfinding = 1,
damage = 2,
reach = 2,
hp_min = 16,
hp_max = 16,
xp_min = 5,
xp_max = 5,
armor = {fleshy = 100, arthropod = 100},
collisionbox = {-0.7, -0.01, -0.7, 0.7, 0.89, 0.7},
visual = "mesh",
mesh = "mobs_mc_spider.b3d",
textures = {
{"mcl_dream_dream_spider.png"},
},
visual_size = {x=3, y=3},
makes_footstep_sound = false,
sounds = {
random = "mobs_mc_spider_random",
attack = "mobs_mc_spider_attack",
damage = "mobs_mc_spider_hurt",
death = "mobs_mc_spider_death",
-- TODO: sounds: walk
distance = 16,
},
walk_velocity = 1.3,
run_velocity = 2.8,
jump = true,
jump_height = 4,
view_range = 16,
floats = 1,
drops = {
{name = "mcl_mobitems:string", chance = 1, min = 0, max = 2, looting = "common"},
{name = "mcl_mobitems:spider_eye", chance = 3, min = 1, max = 1, looting = "common", looting_chance_function = function(lvl)
return 1 - 2 / (lvl + 3)
end},
},
specific_attack = { "player", "mobs_mc:iron_golem" },
fear_height = 4,
animation = {
stand_speed = 10,
walk_speed = 25,
run_speed = 50,
stand_start = 20,
stand_end = 40,
walk_start = 0,
walk_end = 20,
run_start = 0,
run_end = 20,
},
}
mcl_mobs:register_mob("mcl_dream:dream_spider", dream_spider)
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream_spider", S("Dream Spider"), "mobs_mc_spawn_icon_spider.png", 0)
--###################
--################### DREAM GHAST
--###################
mcl_mobs:register_mob("mcl_dream:dream_ghast", {
description = S("Dream Ghast"),
type = "monster",
spawn_class = "hostile",
pathfinding = 1,
group_attack = true,
hp_min = 10,
hp_max = 10,
xp_min = 5,
xp_max = 5,
collisionbox = {-2, 5, -2, 2, 9, 2},
visual = "mesh",
mesh = "mobs_mc_ghast.b3d",
textures = {
{"mcl_dream_dream_ghast.png"},
},
visual_size = {x=12, y=12},
sounds = {
shoot_attack = "mobs_fireball",
death = "mobs_mc_zombie_death",
attack = "mobs_fireball",
random = "mobs_eerie",
distance = 16,
-- TODO: damage
-- TODO: better death
},
walk_velocity = 1.6,
run_velocity = 3.2,
drops = {
{name = "mcl_mobitems:gunpowder", chance = 1, min = 0, max = 2, looting = "common"},
{name = "mcl_mobitems:ghast_tear", chance = 10/6, min = 0, max = 1, looting = "common", looting_ignore_chance = true},
},
animation = {
stand_speed = 50, walk_speed = 50, run_speed = 50,
stand_start = 0, stand_end = 40,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
fall_damage = 0,
view_range = 100,
attack_type = "dogshoot",
arrow = "mcl_dream:fireball",
shoot_interval = 3.5,
shoot_offset = -5,
dogshoot_switch = 1,
dogshoot_count_max =1,
passive = false,
jump = true,
jump_height = 4,
floats=1,
fly = true,
makes_footstep_sound = false,
instant_death = true,
fire_resistant = true,
do_custom = function(self)
if self.firing == true then
self.base_texture = {"mcl_dream_dream_ghast_firing.png"}
self.object:set_properties({textures=self.base_texture})
else
self.base_texture = {"mcl_dream_dream_ghast.png"}
self.object:set_properties({textures=self.base_texture})
end
end,
})
-- fireball (projectile)
mcl_mobs:register_arrow("mcl_dream:fireball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"mcl_fire_fire_charge.png"},
velocity = 15,
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
_is_fireball = true,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
local p = self.object:get_pos()
if p then
mcl_mobs:boom(self, p, 1, true)
else
mcl_mobs:boom(self, player:get_pos(), 1, true)
end
end,
hit_mob = function(self, mob)
mob:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 6},
}, nil)
mcl_mobs:boom(self, self.object:get_pos(), 1, true)
end,
hit_node = function(self, pos, node)
mcl_mobs:boom(self, pos, 1, true)
end
})
-- spawn eggs
mcl_mobs:register_egg("mcl_dream:dream_ghast", S("Dream Ghast"), "mobs_mc_spawn_icon_ghast.png", 0)
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("giant_dream",{
place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"},
fill_ratio = 0.01,
flags = "place_center_x, place_center_z",
solid_ground = true,
make_foundation = true,
chunk_probability = 500,
y_max = mcl_vars.mg_overworld_max,
y_min = 1,
sidelen = 80,
filenames = {
modpath.."/schematics/mcl_dream_dream.mts",
},
after_place = function(p,def,pr)
local spawnon = {"mcl_amethyst:calcite"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream_creeper")
end
end
end,
loot = {
["mcl_chests:chest_small" ] ={{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_dream:dream_totem", weight = 10, amount_min = 1, amount_max=1 },
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_bows:bow", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_core:diamond", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_farming:bread", weight = 20, amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_dream:dream_ingot", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_bows:arrow", weight = 5, amount_min = 1, amount_max = 4 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_dream:apple_dream_enchanted", weight = 2, },
}
}}
}
})
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("end_dream_dungeon",{
place_on = {"mcl_end:end_stone"},
fill_ratio = 0.01,
flags = "all_floors",
solid_ground = true,
make_foundation = true,
chunk_probability = 300,
y_min = mcl_vars.mg_end_min,
y_max = mcl_vars.mg_end_max,
biomes = {"End"},
sidelen = 80,
filenames = {
modpath.."/schematics/mcl_dream_end_dream_dungeon.mts",
},
after_place = function(p,def,pr)
local spawnon = {"mcl_colorblocks:concrete_lime"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream_ghast")
end
end
end,
loot = {
["mcl_chests:chest_small" ] ={{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_dream:dream_totem_4", weight = 10, amount_min = 1, amount_max=1 },
{ itemstring = "mcl_end:chorus_fruit", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_bows:bow", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_core:diamondblock", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_bows:arrow", weight = 5, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_core:goldblock", weight = 15, amount_min = 2, amount_max = 7 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_end:crystal", weight = 20, amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_bells:bell", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_dream:dream_ingot", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_core:ironblock", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_armor:elytra", weight = 5, amount_min = 1, amount_max = 4 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_totems:totem", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_dream:apple_dream_enchanted", weight = 2, },
}
}}
}
})
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("nether_dream_dungeon",{
place_on = {"mcl_nether:netherrack","mcl_crimson:crimson_nylium","mcl_crimson:warped_nylium","mcl_blackstone:basalt","mcl_blackstone:soul_soil"},
fill_ratio = 0.01,
flags = "all_floors",
solid_ground = true,
make_foundation = true,
chunk_probability = 300,
y_min = mcl_vars.mg_lava_nether_max - 1,
y_max = mcl_vars.mg_nether_max - 30,
biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"},
sidelen = 60,
filenames = {
modpath.."/schematics/mcl_dream_nether_dream_dungeon.mts",
},
after_place = function(p,def,pr)
local spawnon = {"mcl_colorblocks:concrete_lime"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream_blaze")
end
end
end,
loot = {
["mcl_chests:chest_small" ] ={{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_dream:dream_totem_2", weight = 10, amount_min = 1, amount_max=1 },
{ itemstring = "mcl_potions:fire_resistance", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_core:obsidian", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_core:diamondblock", weight = 10, amount_min = 1, amount_max=8 },
{ itemstring = "mcl_nether:magma", weight = 5, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_nether:ancient_debris", weight = 15, amount_min = 2, amount_max = 7 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_throwing:ender_pearl", weight = 20, amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_bells:bell", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_nether:netherite_scrap", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_core:apple_gold", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_shields:shield", weight = 5, amount_min = 1, amount_max = 4 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_tnt:tnt", weight = 2, amount_min = 1, amount_max = 3 },
{ itemstring = "mcl_dream:apple_dream_enchanted", weight = 2, },
}
}}
}
})
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
mcl_structures.register_structure("spider_dream_dungeon",{
place_on = {"mcl_core:stone","mcl_deepslate:deepslate"},
fill_ratio = 0.01,
flags = "place_center_x, place_center_z",
solid_ground = true,
make_foundation = true,
chunk_probability = 300,
y_max = -1,
y_min = -60,
sidelen = 30,
filenames = {
modpath.."/schematics/mcl_dream_spider_dream_dungeon.mts",
},
after_place = function(p,def,pr)
local spawnon = {"mcl_colorblocks:concrete_lime"}
local p1=vector.offset(p,-def.sidelen,-1,-def.sidelen)
local p2=vector.offset(p,def.sidelen,def.sidelen,def.sidelen)
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mcl_dream:dream_spider")
end
end
end,
loot = {
["mcl_chests:chest_small" ] ={{
stacks_min = 1,
stacks_max = 1,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 30 },
{ itemstring = "mcl_core:apple_gold", weight = 20 },
{ itemstring = "mcl_books:book", weight = 10, func = function(stack, pr)
mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr)
end },
{ itemstring = "air", weight = 5},
{ itemstring = "mcl_core:pick_iron", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 1 },
{ itemstring = "mcl_dream:dream_totem_3", weight = 10 },
}},{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_minecarts:rail", weight = 20, amount_min = 4, amount_max = 8 },
{ itemstring = "mcl_torches:torch", weight = 15, amount_min = 1, amount_max = 16 },
{ itemstring = "mcl_minecarts:activator_rail", weight = 5, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_minecarts:detector_rail", weight = 5, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_minecarts:golden_rail", weight = 5, amount_min = 1, amount_max = 4 },
}},{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_minecarts:minecart", weight = 1 },
{ itemstring = "mcl_dream:apple_dream_enchanted", weight = 2, },
}
}}
}
})