Improved infector acid spray particles
+ fixed a couple of infector bugs
This commit is contained in:
parent
5109d20249
commit
032afd7aa9
@ -21,7 +21,7 @@ function fbrawl.register_weapon(name, def)
|
||||
minetest.register_node(name, {
|
||||
drawtype = "mesh",
|
||||
mesh = def.mesh,
|
||||
tiles = {def.texture},
|
||||
tiles = {def.texture},
|
||||
inventory_image = "fbrawl_transparent.png",
|
||||
groups = def.groups,
|
||||
wield_scale = def.wield_scale,
|
||||
@ -29,14 +29,14 @@ function fbrawl.register_weapon(name, def)
|
||||
node_placement_prediction = "",
|
||||
use_texture_alpha = "clip",
|
||||
|
||||
on_drop = function(itemstack, player)
|
||||
on_drop = function(itemstack, player)
|
||||
local pl_name = player:get_player_name()
|
||||
|
||||
|
||||
if fbrawl.is_player_playing(pl_name) then
|
||||
local arena = arena_lib.get_arena_by_player(pl_name)
|
||||
cast_skill(arena, pl_name, "Q")
|
||||
end
|
||||
|
||||
|
||||
return
|
||||
end
|
||||
})
|
||||
@ -49,8 +49,11 @@ function cast_skill(arena, pl_name, key)
|
||||
local skill = pl_name:get_skill(skill_name)
|
||||
|
||||
if not skill["can_cast"] or skill:can_cast() then
|
||||
skill:cast()
|
||||
skill:start()
|
||||
if skill.loop_params then
|
||||
skill:start()
|
||||
else
|
||||
skill:cast()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -66,7 +69,7 @@ function detect_input(player, control_name)
|
||||
|
||||
if control_name == "LMB" then
|
||||
cast_skill(arena, pl_name, "LMB")
|
||||
|
||||
|
||||
elseif control_name == "RMB" then
|
||||
cast_skill(arena, pl_name, "RMB")
|
||||
|
||||
|
@ -13,7 +13,7 @@ fbrawl.register_class("Infector", {
|
||||
skills = {
|
||||
LMB = "fbrawl:acid_spray",
|
||||
RMB = "fbrawl:blood_spray",
|
||||
SNEAK = "fbrawl:shadow_walk",
|
||||
SNEAK = "fbrawl:gaia_fist",
|
||||
Q = "fbrawl:gaia_fist",
|
||||
ZOOM = "fbrawl:cry_of_gaia"
|
||||
},
|
||||
@ -23,7 +23,6 @@ fbrawl.register_class("Infector", {
|
||||
|
||||
dofile(minetest.get_modpath("fantasy_brawl") .. "/src/classes/infector/skills/acid_spray.lua")
|
||||
dofile(minetest.get_modpath("fantasy_brawl") .. "/src/classes/infector/skills/blood_spray.lua")
|
||||
dofile(minetest.get_modpath("fantasy_brawl") .. "/src/classes/infector/skills/shadow_walk.lua")
|
||||
|
||||
dofile(minetest.get_modpath("fantasy_brawl") .. "/src/classes/infector/items.lua")
|
||||
|
||||
|
@ -1,79 +1,7 @@
|
||||
|
||||
minetest.register_node("fantasy_brawl:acid_spray", {
|
||||
drawtype = "mesh",
|
||||
fbrawl.register_weapon("fantasy_brawl:acid_spray", {
|
||||
mesh = "fbrawl_acid_gun.obj",
|
||||
tiles = {"fbrawl_acid_gun_model.png"},
|
||||
inventory_image = "fbrawl_acid_spray.png",
|
||||
wield_scale = {x=3.7,y=3.7, z=3.7},
|
||||
texture = "fbrawl_acid_gun_model.png",
|
||||
groups = {fbrawl_mesh = 1},
|
||||
on_drop = function() return end,
|
||||
on_place = function(itemstack, player, pointed_thing)
|
||||
local pl_name = player:get_player_name()
|
||||
local blood_spray = pl_name:get_skill("fbrawl:blood_spray")
|
||||
|
||||
if blood_spray then
|
||||
blood_spray:start()
|
||||
end
|
||||
end,
|
||||
on_secondary_use = function (itemstack, player)
|
||||
local pl_name = player:get_player_name()
|
||||
local blood_spray = pl_name:get_skill("fbrawl:blood_spray")
|
||||
|
||||
if blood_spray then
|
||||
blood_spray:start()
|
||||
end
|
||||
end,
|
||||
wield_scale = {x=3.7,y=3.7, z=3.7},
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("fantasy_brawl:shadow_walk", {
|
||||
inventory_image = "fbrawl_shadow_walk_skill.png",
|
||||
on_drop = function() return end,
|
||||
on_place = function(itemstack, player, pointed_thing)
|
||||
local pl_name = player:get_player_name()
|
||||
local shadow_walk = pl_name:get_skill("fbrawl:shadow_walk")
|
||||
|
||||
if shadow_walk then
|
||||
shadow_walk:start()
|
||||
end
|
||||
end,
|
||||
on_secondary_use = function (itemstack, player)
|
||||
local pl_name = player:get_player_name()
|
||||
local shadow_walk = pl_name:get_skill("fbrawl:shadow_walk")
|
||||
|
||||
if shadow_walk then
|
||||
shadow_walk:start()
|
||||
end
|
||||
end,
|
||||
on_use = function (itemstack, player)
|
||||
local pl_name = player:get_player_name()
|
||||
local shadow_walk = pl_name:get_skill("fbrawl:shadow_walk")
|
||||
|
||||
if shadow_walk then
|
||||
shadow_walk:start()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
controls.register_on_press(function(player, control_name)
|
||||
local pl_name = player:get_player_name()
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
|
||||
if wielded_item == "fantasy_brawl:acid_spray" and control_name == "LMB" then
|
||||
pl_name:start_skill("fbrawl:acid_spray")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
controls.register_on_release(function(player, control_name)
|
||||
local pl_name = player:get_player_name()
|
||||
local acid_spray = pl_name:get_skill("fbrawl:acid_spray")
|
||||
|
||||
if acid_spray and acid_spray.is_active and control_name == "LMB" then
|
||||
pl_name:stop_skill("fbrawl:acid_spray")
|
||||
end
|
||||
end)
|
||||
|
@ -1,11 +1,46 @@
|
||||
local S = fbrawl.T
|
||||
local spray_particles = {
|
||||
amount = 140,
|
||||
time = 0,
|
||||
pos = {
|
||||
min = {x = 0.25, y = 1.4, z = 0},
|
||||
max = {x = 0.35, y = 1.6, z = 0.1}
|
||||
},
|
||||
vel = {
|
||||
min = vector.new(-1,-1, 2),
|
||||
max = vector.new(1, 1, 20),
|
||||
},
|
||||
minacc = {x=0, y=-2, z=10},
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
glow = 12,
|
||||
texture = {
|
||||
name = "fbrawl_poison_particle.png",
|
||||
alpha_tween = {1, 0.1},
|
||||
scale_tween = {
|
||||
{x = 1, y = 1},
|
||||
{x = 0.5, y = 0.5},
|
||||
},
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16,
|
||||
length = 0.15,
|
||||
},
|
||||
},
|
||||
|
||||
collisiondetection = true,
|
||||
object_collision = true,
|
||||
collision_removal = true,
|
||||
minexptime = 0.4,
|
||||
maxexptime = 0.5,
|
||||
}
|
||||
|
||||
|
||||
skills.register_skill("fbrawl:acid_spray", {
|
||||
name = S("Acid Spray"),
|
||||
icon = "fbrawl_acid_spray.png",
|
||||
damage = 0.25,
|
||||
dmg_multiplier = 1,
|
||||
cooldown = 0.2,
|
||||
slowing_factor = 1.3,
|
||||
range = 7,
|
||||
@ -17,48 +52,27 @@ skills.register_skill("fbrawl:acid_spray", {
|
||||
bgm = {name = "fbrawl_acidspray"}
|
||||
},
|
||||
data = {
|
||||
multiplier = 1,
|
||||
players_being_hit = {} -- "name" = true
|
||||
players_being_hit = {}, -- "name" = true,
|
||||
particlesID = 0,
|
||||
},
|
||||
attachments = {
|
||||
particles = {{
|
||||
amount = 280,
|
||||
time = 0,
|
||||
pos = {
|
||||
min = {x = 0.25, y = 1.4, z = 0.1},
|
||||
max = {x = 0.25, y = 1.4, z = 0.1}
|
||||
},
|
||||
vel = {
|
||||
min = vector.new(-0.5,-8, 2),
|
||||
max = vector.new(0.5, 1, 20),
|
||||
},
|
||||
minacc = {x=0, y=-2, z=10},
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
glow = 12,
|
||||
texture = {
|
||||
name = "fbrawl_poison_particle.png",
|
||||
alpha_tween = {1, 0.1},
|
||||
scale_tween = {
|
||||
{x = 1, y = 1},
|
||||
{x = 0.5, y = 0.5},
|
||||
},
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16, aspect_h = 16,
|
||||
length = 0.15,
|
||||
},
|
||||
},
|
||||
regen_particles = function(self)
|
||||
minetest.delete_particlespawner(self.data.particlesID)
|
||||
|
||||
collisiondetection = true,
|
||||
object_collision = true,
|
||||
collision_removal = true,
|
||||
minexptime = 0.4,
|
||||
maxexptime = 0.5,
|
||||
}}
|
||||
},
|
||||
local new_particles = table.copy(spray_particles)
|
||||
|
||||
-- modifying particles y direction according to the look vertical
|
||||
local vertical = self.player:get_look_vertical()
|
||||
local sensitivity = 10
|
||||
new_particles.vel.min.y = spray_particles.vel.min.y * vertical * sensitivity
|
||||
new_particles.vel.max.y = new_particles.vel.min.y - (spray_particles.vel.max.y - spray_particles.vel.min.y)
|
||||
|
||||
new_particles.attached = self.player
|
||||
|
||||
self.data.particlesID = minetest.add_particlespawner(new_particles)
|
||||
end,
|
||||
on_start = function(self)
|
||||
self.data.players_being_hit = {}
|
||||
self:regen_particles()
|
||||
end,
|
||||
cast = function(self)
|
||||
local pointed_things = fbrawl.grid_raycast(self.player, self.range, self.radius, 3, true)
|
||||
@ -67,21 +81,21 @@ skills.register_skill("fbrawl:acid_spray", {
|
||||
|
||||
-- insert pointed ObjectRefs in objs
|
||||
for i, thing in ipairs(pointed_things) do
|
||||
if thing.type == "object" then
|
||||
table.insert(objs, thing.ref)
|
||||
end
|
||||
if thing.type == "object" then
|
||||
table.insert(objs, thing.ref)
|
||||
end
|
||||
end
|
||||
|
||||
-- damage players in objs
|
||||
-- damage players
|
||||
for i, obj in ipairs(objs) do
|
||||
if obj:is_player() then
|
||||
if obj:is_player() and obj:get_player_name() ~= self.pl_name then
|
||||
local pl_name = obj:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(pl_name)
|
||||
|
||||
if not arena or not arena.match_started then return end
|
||||
|
||||
if pl_name ~= self.pl_name and not hit_this_frame[pl_name] then
|
||||
fbrawl.hit_player(self.player, obj, self.damage * self.data.multiplier)
|
||||
|
||||
if pl_name ~= self.pl_name and not hit_this_frame[pl_name] and not arena.players[pl_name].is_invulnerable then
|
||||
fbrawl.hit_player(self.player, obj, self.damage * self.dmg_multiplier)
|
||||
|
||||
if not self.data.players_being_hit[pl_name] then
|
||||
pl_name:divide_physics("speed", self.slowing_factor)
|
||||
@ -93,17 +107,31 @@ skills.register_skill("fbrawl:acid_spray", {
|
||||
end
|
||||
end
|
||||
|
||||
-- removing players not hit this frame
|
||||
-- removing players not hit this frame from players_being_hit
|
||||
for pl_name, _ in pairs(self.data.players_being_hit) do
|
||||
if not hit_this_frame[pl_name] then
|
||||
self.data.players_being_hit[pl_name] = nil
|
||||
pl_name:multiply_physics("speed", self.slowing_factor)
|
||||
end
|
||||
end
|
||||
|
||||
self:regen_particles()
|
||||
end,
|
||||
on_stop = function(self)
|
||||
for pl_name, _ in pairs(self.data.players_being_hit) do
|
||||
pl_name:multiply_physics("speed", self.slowing_factor)
|
||||
end
|
||||
minetest.delete_particlespawner(self.data.particlesID)
|
||||
end
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
controls.register_on_release(function(player, control_name)
|
||||
local pl_name = player:get_player_name()
|
||||
local acid_spray = pl_name:get_skill("fbrawl:acid_spray")
|
||||
|
||||
if acid_spray and acid_spray.is_active and control_name == "LMB" then
|
||||
pl_name:stop_skill("fbrawl:acid_spray")
|
||||
end
|
||||
end)
|
||||
|
@ -17,11 +17,20 @@ skills.register_skill_based_on("fbrawl:acid_spray", "fbrawl:blood_spray", {
|
||||
position = {x=0.5, y=0.82},
|
||||
}}
|
||||
},
|
||||
data = {
|
||||
multiplier = 4.5,
|
||||
},
|
||||
dmg_multiplier = 4.5,
|
||||
cooldown = 10,
|
||||
loop_params = {
|
||||
duration = 1.5
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
controls.register_on_release(function(player, control_name)
|
||||
local pl_name = player:get_player_name()
|
||||
local blood_spray = pl_name:get_skill("fbrawl:blood_spray")
|
||||
|
||||
if blood_spray and blood_spray.is_active and control_name == "LMB" then
|
||||
pl_name:stop_skill("fbrawl:blood_spray")
|
||||
end
|
||||
end)
|
||||
|
Loading…
x
Reference in New Issue
Block a user