From 2a9ebe8b9d9110f16c2209a21a68c67d08de44ac Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 6 Jul 2020 15:59:14 +0200 Subject: [PATCH] Initial Commit --- init.lua | 105 ++++++++++++++++++++++++++++++++++ locale/mcl_end_crystal.de.tr | 6 ++ locale/template.txt | 6 ++ mod.conf | 4 ++ models/end_crystal.b3d | Bin 0 -> 12932 bytes models/end_crystal_entity.png | Bin 0 -> 1940 bytes textures/end_crystal.png | Bin 0 -> 356 bytes 7 files changed, 121 insertions(+) create mode 100644 init.lua create mode 100644 locale/mcl_end_crystal.de.tr create mode 100644 locale/template.txt create mode 100644 mod.conf create mode 100644 models/end_crystal.b3d create mode 100644 models/end_crystal_entity.png create mode 100644 textures/end_crystal.png diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..512e63f --- /dev/null +++ b/init.lua @@ -0,0 +1,105 @@ +local S = minetest.get_translator("mcl_end_crystal") + +local explosion_range = 7 + +local directions = { + {x = 1}, {x = -1}, {z = 1}, {z = -1} +} + +local dimensions = {"x", "y", "z"} + +for _, dir in pairs(directions) do + for _, dim in pairs(dimensions) do + dir[dim] = dir[dim] or 0 + end +end + +local function crystal_explode(self, puncher) + if self.exploded then return end + self.exploded = true + local radius = puncher and explosion_range or 1 + mcl_explosions.explode(self.object:get_pos(), radius, {drop_chance = 1}, puncher) + minetest.after(0, self.object.remove, self.object) +end + +local function set_crystal_animation(self) + self.object:set_animation({x = 0, y = 60}, 30) +end + +local function spawn_crystal(pos) + local crystal = minetest.add_entity(pos, "mcl_end_crystal:end_crystal") + if not vector.equals(pos, vector.floor(pos)) then return end + if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end + local portal_center + for _, dir in pairs(directions) do + local node = minetest.get_node(vector.add(pos, vector.add(dir, {x = 0, y = -1, z = 0}))) + if node.name == "mcl_portals:portal_end" then + portal_center = vector.add(pos, vector.multiply(dir, 3)) + break + end + end + if not portal_center then return end + local crystals = {} + for i, dir in pairs(directions) do + local crystal_pos = vector.add(portal_center, vector.multiply(dir, 3)) + print(minetest.pos_to_string(crystal_pos)) + local objects = minetest.get_objects_inside_radius(crystal_pos, 0) + for _, obj in pairs(objects) do + local luaentity = obj:get_luaentity() + if luaentity and luaentity.name == "mcl_end_crystal:end_crystal" then + crystals[i] = luaentity + break + end + end + if not crystals[i] then return end + end + for _, crystal in pairs(crystals) do + crystal_explode(crystal) + end + minetest.add_entity(vector.add(portal_center, {x = 0, y = 10, z = 0}), "mobs_mc:enderdragon") +end + +minetest.register_entity("mcl_end_crystal:end_crystal", { + initial_properties = { + physical = true, + visual = "mesh", + visual_size = {x = 7.5, y = 7.5, z = 7.5}, + collisionbox = {-0.75, -0.5, -0.75, 0.75, 1.25, 0.75}, + mesh = "end_crystal.b3d", + textures = {"end_crystal_entity.png"}, + collide_with_objects = true, + }, + exploded = false, + on_punch = crystal_explode, + on_activate = set_crystal_animation, + _cmi_is_mob = true -- Ignitable by arrows +}) + +minetest.register_craftitem("mcl_end_crystal:end_crystal", { + inventory_image = "end_crystal.png", + description = S("End Crystal"), + stack_max = 64, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" and pointed_thing.above.y > pointed_thing.under.y then + local node = minetest.get_node(pointed_thing.under).name + if node == "mcl_core:obsidian" or node == "mcl_core:bedrock" then + itemstack:take_item() + spawn_crystal(pointed_thing.above) + end + end + return itemstack + end, + _tt_help = S("Ignited by a punch or a hit with an arrow").."\n"..S("Explosion radius: @1", tostring(explosion_range)), + _doc_items_longdesc = S("End Crystals are explosive devices. They can be placed on Obsidian or Bedrock. Ignite them by a punch or a hit with an arrow. End Crystals can also be used the spawn the Ender Dragon by placing one at each side of the End Exit Portal."), + _doc_items_usagehelp = S("Place the End Crystal on Obsidian or Bedrock, then punch it or hit it with an arrow to cause an huge and probably deadly explosion. To Spawn the Ender Dragon, place one at each side of the End Exit Portal."), + +}) + +minetest.register_craft({ + output = "mcl_end_crystal:end_crystal", + recipe = { + {"mcl_core:glass", "mcl_core:glass", "mcl_core:glass"}, + {"mcl_core:glass", "mcl_end:ender_eye", "mcl_core:glass"}, + {"mcl_core:glass", "mcl_mobitems:ghast_tear", "mcl_core:glass"}, + } +}) diff --git a/locale/mcl_end_crystal.de.tr b/locale/mcl_end_crystal.de.tr new file mode 100644 index 0000000..7456fb9 --- /dev/null +++ b/locale/mcl_end_crystal.de.tr @@ -0,0 +1,6 @@ +# textdomain: mcl_end_crystal +End Crystal=Enderkristall +End Crystals are explosive devices. They can be placed on Obsidian or Bedrock. Ignite them by a punch or a hit with an arrow. End Crystals can also be used the spawn the Ender Dragon by placing one at each side of the End Exit Portal.=Enderkristalle sind explosiv. Sie können auf Obsidian oder Grundgestein platziert werden. Man kann sie durch einen Schlag oder einen Treffer mit einem Pfeil entzünden. Ausserdem können sie benutzt werden, um den Enderdrachen zu erzeugen, in dem man je einen auf jeder Seite des Endausgangsportals platziert. +Explosion radius: @1=Explosionsradius: @1 +Ignited by a punch or a hit with an arrow=Entzündbar durch einen Schlag oder einen Treffer mit einem Pfeil +Place the End Crystal on Obsidian or Bedrock, then punch it or hit it with an arrow to cause an huge and probably deadly explosion. To Spawn the Ender Dragon, place one at each side of the End Exit Portal.=Platziere den Enderkistall auf Obsidian oder Grundgestein, dann schlage ihn oder triff ihn mit einem Pfeil, um eine riesige und meistens tödliche Explosion zu bewirken. diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..8a0a386 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,6 @@ +# textdomain: mcl_end_crystal +End Crystal= +End Crystals are explosive devices. They can be placed on Obsidian or Bedrock. Ignite them by a punch or a hit with an arrow. End Crystals can also be used the spawn the Ender Dragon by placing one at each side of the End Exit Portal.= +Explosion radius: @1= +Ignited by a punch or a hit with an arrow= +Place the End Crystal on Obsidian or Bedrock, then punch it or hit it with an arrow to cause an huge and probably deadly explosion. To Spawn the Ender Dragon, place one at each side of the End Exit Portal.= diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..a58adfb --- /dev/null +++ b/mod.conf @@ -0,0 +1,4 @@ +name = mcl_end_crystal +author = Fleckenstein +depends = mcl_explosions +description = Adds End Crystals to MineClone2. The Ender Dragon can be spawned by placing one of them on each side of the end exit portal. diff --git a/models/end_crystal.b3d b/models/end_crystal.b3d new file mode 100644 index 0000000000000000000000000000000000000000..803bf99336149d7be36a2af547ff810a03f10947 GIT binary patch literal 12932 zcmds+eT-Jc6~>1zsR-B>5D+YjfKud31&XkHXIWT+NY2%%pHp=IUgR?XBpwYP5H_LZ5lXJ4*;iD#N2bReA8 zvV6so)&=U}Yuj&|xqide^_$ul=~4du@%rHPt*e&)dWgBXapme&L(etWETF&Iysz%8 zb=>??@%Vs=@jE*{TN^Rp#p2}7Q-uzxNl`m?qVt3O18d7){p-Ou+P5^yxQ?#&_Cp8F zzZ84NKGpg2rOy^}ikWQj0(*P>~dU)1-DGbX%J z==`0s0fZM@unNY9tAkMXoWC7%!e)BcuxzBYf={*}MqA^eB(^{4saU&;Q4 z^nT@^zpbyFU*^9Lex~&ueC>~2&$R51gHE6Bn)>pH+JRSo5UJT4tjBoKV_e4?()g4o zht{6|{hmUfPvh&RPo>V|QuG*4{_}Xv{7X^pe_h>w-1WvD)|dR|_34Nl8yZ49Z)Be=wPvhP1Xa39AhyOF?@8!Rt?!V;o z;rS5D_t*UQn7`Nh@PEesFkb6kzdhf>f6-%HpIw)p@8O^E9{bOD2tCGo&5!>O%J;V+ z`R_5F{C9u;Jl_|8%)icGvVZv3J7C)S*!aQz`0!)D=zQSWrLlA4lkx8M7djc!67PCp zRs8m(H=CxsJgInk*_!yL#*M}N!{azRSloN>4V`=MeY}|Y_SfV4{Z9V$-Qqy;+n?Qn z?{t2@HEVR^TX#Gk@1Hz3j=lB1&f`~f#x-$znw#~P`#+TY>+=V1+&;2XpReijO|pLf zLVdo*+?cMv)^MUIbp1`b{@R#L0}5S#la1^BRJuO=OHuA$>hIUI=5G&1eZQK%-@=Zg zyQ99J&Ts3}_16a9{==yI)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