Upload files to 'mods'

This commit is contained in:
thunderdog1138 2020-11-20 18:28:57 +00:00
parent 44ff986b85
commit b7b495ac17
5 changed files with 498 additions and 0 deletions

6
mods/depends.txt Normal file
View File

@ -0,0 +1,6 @@
default
tnt
doors?
xpanes?
vessels?
moreores?

21
mods/door_breaking.lua Normal file
View File

@ -0,0 +1,21 @@
if minetest.get_modpath("doors") then
minetest.override_item("doors:door_wood_a", {
on_timer = function(pos)
minetest.swap_node(pos, {name = "air"})
minetest.add_item(pos, "default:wood 5")
minetest.sound_play("rangedweapons_woodbreak",{pos})
end,
})
minetest.override_item("doors:door_wood_b", {
on_timer = function(pos)
minetest.swap_node(pos, {name = "air"})
minetest.add_item(pos, "default:wood 5")
minetest.sound_play("rangedweapons_woodbreak",{pos})
end,
})
end

145
mods/e11.lua Normal file
View File

@ -0,0 +1,145 @@
minetest.register_craftitem("rangedweapons:e11", {
stack_max= 1,
wield_scale = {x=1.15,y=1.15,z=1.15},
description = "E-11 blaster rifle",
range = 0,
inventory_image = "e11.png",
wield_image = "e11.png^[transformFX",
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 0.35 then
for _, player in pairs(minetest.get_connected_players()) do
local inv = player:get_inventory()
local controls = player:get_player_control()
if controls.LMB then
timer = 0
local wielded_item = player:get_wielded_item():get_name()
if wielded_item == "rangedweapons:e11" then
if not inv:contains_item("main", "rangedweapons:power_particle") then
minetest.sound_play("rangedweapons_empty", {object=player})
else
if wielded_item == "rangedweapons:e11" then
inv:remove_item("main", "rangedweapons:power_particle")
local pos = player:getpos()
local dir = player:get_look_dir()
local yaw = player:get_look_yaw()
if pos and dir and yaw then
pos.y = pos.y + 1.6
local obj = minetest.add_entity(pos, "rangedweapons:e11_shot")
if obj then
minetest.sound_play("blaster-1", {object=obj})
obj:setvelocity({x=dir.x * 30, y=dir.y * 30, z=dir.z * 30})
obj:setacceleration({x=dir.x * math.random(0,0), y=math.random(0,0), z=dir.z * math.random(0,0)})
obj:setyaw(yaw + math.pi)
local ent = obj:get_luaentity()
if ent then
ent.player = ent.player or player
end
end
end
end
end
end
end
end
end
end)
local rangedweapons_e11_shot = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.3, y=0.3},
textures = {"blaster_red.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_e11_shot.on_step = function(self, dtime, node, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer > 0.21 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:e11_shot" and obj:get_luaentity().name ~= "__builtin:item" then
if math.random(1, 100) <= 10 then
local damage = math.random(20,30)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback=0},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(5,15)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage, knockback = 0},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
else
if math.random(1, 100) <= 10 then
local damage = math.random(28,40)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("crit", {pos = self.lastpos, gain = 0.8})
self.object:remove()
else
local damage = math.random(12,18)
obj:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups= {fleshy = damage},
}, nil)
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
self.object:remove()
end
end
if timer >= 0.002 + tiem then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.2,
size = 7,
collisiondetection = false,
vertical = false,
texture = "blaster_red.png",
glow = 30,
})
tiem = tiem + 0.002
end
if self.timer >= 4.0 then
self.object:remove()
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
if not minetest.setting_getbool("creative_mode") then
end
minetest.sound_play("default_dig_cracky", {pos = self.lastpos, gain = 0.8})
if node.name == "rangedweapons:barrel" then
minetest.get_node_timer(pos):start(0)
end
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
end
end
minetest.register_entity("rangedweapons:e11_shot", rangedweapons_e11_shot )

214
mods/explosives.lua Normal file
View File

@ -0,0 +1,214 @@
local he_boom = {
name = "rangedweapons:he_explosion",
--description = "DuN mInD mEh...",
radius = 2,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(he_boom)
local rocket_boom = {
name = "rangedweapons:rocket_explosion",
--description = "DuN mInD mEh...",
radius = 3,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(rocket_boom)
local rangedweapons_rocket = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.0, y=0.0},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_rocket.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer >= 0.002 then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.04,
size = 7,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_rocket_fly.png",
glow = 15,
})
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=6, z=0},
expirationtime = 0.4,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
tiem = tiem + 0.002
end
if self.timer >= 0.375 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.5)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:rocket" and obj:get_luaentity().name ~= "__builtin:item" then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
if self.timer >= 7.5 then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:rocket", rangedweapons_rocket)
local rangedweapons_he_grenade = {
physical = false,
timer = 0,
visual = "sprite",
visual_size = {x=0.0, y=0.0},
textures = {"rangedweapons_invisible.png"},
lastpos= {},
collisionbox = {0, 0, 0, 0, 0, 0},
}
rangedweapons_he_grenade.on_step = function(self, dtime, pos)
self.timer = self.timer + dtime
local tiem = 0.002
local pos = self.object:getpos()
local node = minetest.get_node(pos)
if self.timer >= 0.002 then
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=0, z=0},
expirationtime = 0.04,
size = 7,
collisiondetection = false,
vertical = false,
texture = "rangedweapons_rocket_fly.png",
glow = 15,
})
minetest.add_particle({
pos = pos,
velocity = 0,
acceleration = {x=0, y=16, z=0},
expirationtime = 0.4,
size = 4,
collisiondetection = false,
vertical = false,
texture = "tnt_smoke.png",
glow = 5,
})
tiem = tiem + 0.002
end
if self.timer >= 0.4 then
local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1.5)
for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "rangedweapons:he_grenade" and obj:get_luaentity().name ~= "__builtin:item" then
tnt.boom(pos, rocket_boom)
self.object:remove()
end
end
end
end
if self.lastpos.x ~= nil then
if minetest.registered_nodes[node.name].walkable then
tnt.boom(pos, he_boom)
self.object:remove()
end
if self.timer >= 7.5 then
tnt.boom(pos, he_boom)
self.object:remove()
end
end
self.lastpos= {x = pos.x, y = pos.y, z = pos.z}
end
minetest.register_entity("rangedweapons:he_grenade", rangedweapons_he_grenade)
local barrel_boom = {
name = "rangedweapons:explosion",
--description = "DuN mInD mEh...",
radius = 3,
tiles = {
side = "rangedweapons_invisible.png",
top = "rangedweapons_invisible.png",
bottom = "rangedweapons_invisible.png",
burning = "rangedweapons_invisible.png"
},
}
tnt.register_tnt(barrel_boom)
minetest.register_craft({
output = "rangedweapons:barrel",
recipe = {
{"default:wood", "tnt:gunpowder", "default:wood"},
{"default:wood", "tnt:tnt", "default:wood"},
}
})
minetest.register_node("rangedweapons:barrel", {
description = "" ..core.colorize("#35cdff","Explosive barrel\n")..core.colorize("#FFFFFF", "It will explode if shot by gun"),
tiles = {
"rangedweapons_barrel_top.png",
"rangedweapons_barrel_top.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png",
"rangedweapons_barrel_side.png"
},
drawtype = "nodebox",
paramtype = "light",
groups = {choppy = 3, oddly_breakable_by_hand = 3},
on_timer = function(pos)
tnt.boom(pos, barrel_boom)
end,
on_blast = function(pos)
tnt.boom(pos, barrel_boom)
end,
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- NodeBox1
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- NodeBox2
{-0.4375, -0.5, -0.3125, 0.4375, 0.5, 0.3125}, -- NodeBox3
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, 0.4375}, -- NodeBox4
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}, -- NodeBox5
}
}
})

112
mods/glass_breaking.lua Normal file
View File

@ -0,0 +1,112 @@
minetest.register_craftitem("rangedweapons:glass_shards", {
description = "" ..core.colorize("#35cdff","Glass shards\n")..core.colorize("#FFFFFF", "3 of those, can be crafted into a file of glass fragments"),
inventory_image = "rangedweapons_glass_shards.png",
})
minetest.register_craft({
output = "vessels:glass_fragments",
recipe = {
{"rangedweapons:glass_shards", "rangedweapons:glass_shards", "rangedweapons:glass_shards"},
}
})
--minetest.override_item("default:glass", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "rangedweapons:broken_glass"})
-- minetest.sound_play("glass_break",{pos})
-- end,
--})
minetest.register_node("rangedweapons:broken_glass", {
description = "Broken glass",
drawtype = "glasslike",
tiles = {
"rangedweapons_broken_glass.png"
},
paramtype = "light",
walkable = false,
is_ground_content = false,
liquidtype = "source",
liquid_alternative_flowing = "rangedweapons:broken_glass",
liquid_alternative_source = "rangedweapons:broken_glass",
liquid_viscosity = 7,
alpha = 160,
liquid_range= 0,
liquid_renewable = false,
damage_per_second = 2,
groups = {oddly_breakable_by_hand = 3},
})
--if minetest.get_modpath("doors") then
--minetest.override_item("doors:door_glass_a", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "vessels:glass_fragments 5")
-- minetest.sound_play("glass_break",{pos})
-- end,
--})
--minetest.override_item("doors:door_glass_b", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "vessels:glass_fragments 5")
-- minetest.sound_play("glass_break",{pos})
-- end,
--})
--end
--if minetest.get_modpath("xpanes") then
--minetest.override_item("xpanes:pane", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "rangedweapons:glass_shards")
-- minetest.sound_play("glass_break",{pos})
-- end,
--})
--minetest.override_item("xpanes:pane_flat", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "rangedweapons:glass_shards")
-- minetest.sound_play("glass_break",{pos})
-- end,
--})
--end
--if minetest.get_modpath("vessels") then
--minetest.override_item("vessels:glass_bottle", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "rangedweapons:glass_shards")
-- minetest.sound_play("glass_break",{pos})
-- end,
-- walkable = true,
-- node_box = {
-- type = "fixed",
-- fixed = {
-- {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
-- },
-- },
--})
--minetest.override_item("vessels:drinking_glass", {
-- on_timer = function(pos)
-- minetest.swap_node(pos, {name = "air"})
-- minetest.add_item(pos, "rangedweapons:glass_shards")
-- minetest.sound_play("glass_break",{pos})
-- end,
-- walkable = true,
-- node_box = {
-- type = "fixed",
-- fixed = {
-- {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2},
-- },
-- },
--})
--end