Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions BattleMod/Lua/2-MobjStateInfo/2-Specials/Info_ActBomb.lua

This file was deleted.

9 changes: 9 additions & 0 deletions BattleMod/Lua/2-MobjStateInfo/2-Specials/Info_ActSlide.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
freeslot("S_FANG_SLIDE")

states[S_FANG_SLIDE] = {
sprite = SPR_PLAY,
frame = SPR2_FLY_,
tics = -1,
nextstate = S_PLAY_STND,
action = function(mo) mo.player.panim = PA_ROLL end
}
48 changes: 29 additions & 19 deletions BattleMod/Lua/3-Functions/3-Player/Lib_ActionControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ local S = B.SkinVars

local spendringwarning = false

B.MasterActionScript = function(player,doaction)
B.MasterActionScript = function(player,doaction,type)
-- 0 = PlayerThink
-- 1 = ThinkFrame

--Set action state
player.actionallowed = B.CanDoAction(player)
player.actioncooldown = max($,player.tossdelay-TICRATE)
Expand Down Expand Up @@ -34,27 +37,34 @@ B.MasterActionScript = function(player,doaction)

local t = player.skinvars
--Reset action values for this frame
player.actiontext = nil
player.action2text = nil
player.actionrings = 0
player.action2rings = 0
player.actiontextflags = nil
player.action2textflags = nil
player.actionsuper = false
--Set exhaustmeter hud (if enabled)
if player.exhaustmeter ~= FRACUNIT then
-- player.action2text = player.exhaustmeter*100/FRACUNIT.."%"
if player.exhaustmeter > FRACUNIT/3 or (player.exhaustmeter > 0 and leveltime&4) then
player.action2textflags = 0
elseif player.exhaustmeter > 0 then
player.action2textflags = 2
else
player.action2textflags = 3
if type == 1 then
player.actiontext = nil
player.action2text = nil
player.actionrings = 0
player.action2rings = 0
player.actiontextflags = nil
player.action2textflags = nil
player.actionsuper = false
--Set exhaustmeter hud (if enabled)
if player.exhaustmeter ~= FRACUNIT then
-- player.action2text = player.exhaustmeter*100/FRACUNIT.."%"
if player.exhaustmeter > FRACUNIT/3 or (player.exhaustmeter > 0 and leveltime&4) then
player.action2textflags = 0
elseif player.exhaustmeter > 0 then
player.action2textflags = 2
else
player.action2textflags = 3
end
end
end
--Perform action script
if S[t].special ~= nil then
S[t].special(mo,doaction)
local special = S[t].special
if type == 0 then
special = S[t].special_playerthink
end

if special ~= nil then
special(mo,doaction)
--For custom characters
if player.spendrings == 1 then
if not(spendringwarning) then
Expand Down
3 changes: 1 addition & 2 deletions BattleMod/Lua/3-Functions/3-Player/Lib_PlayerFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ B.PlayerThinkFrame = function(player)
B.PlayerMovementControl(player)

--Perform Actions
local doaction = B.ButtonCheck(player,player.battleconfig_special)
B.MasterActionScript(player,doaction)
B.MasterActionScript(player,B.ButtonCheck(player,player.battleconfig_special),1)

--Air dodge, Stun Break, Guard
local doguard = B.ButtonCheck(player,player.battleconfig_guard)
Expand Down
60 changes: 37 additions & 23 deletions BattleMod/Lua/3-Functions/3-Player/Lib_Popgun.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,34 @@ local function newGunslinger(player)
-- Same code as vanilla, but without the clause for speed.
-- You naturally lose your speed via friction.
-- v10 EDIT: Now Fang automatically looks towards lockons
-- v10 EDIT 2: i gave fang autoaim if he holds lol

local lockon = B.NewGunLook(player)
if (lockon and lockon.valid)
player.drawangle = R_PointToAngle2(mo.x, mo.y, lockon.x, lockon.y)
P_SpawnLockOn(player, lockon, mobjinfo[MT_LOCKON].spawnstate)
local lockon = nil

if player.gunheld >= 12 then
lockon = B.NewGunLook(player)

if (lockon and lockon.valid) then
player.drawangle = R_PointToAngle2(mo.x, mo.y, lockon.x, lockon.y)
P_SpawnLockOn(player, lockon, mobjinfo[MT_LOCKON].spawnstate)
end
end

if player.cmd.buttons & BT_SPIN then
player.gunheld = $ + 1
else
player.gunheld = 0
end
//Trigger firing action
if (player.cmd.buttons & BT_SPIN)
-- and not (player.gunheld)
and not(player.buttonhistory&BT_SPIN)
if not (player.cmd.buttons & BT_SPIN)
and (player.buttonhistory&BT_SPIN)
local bullet = nil

mo.state = S_PLAY_FIRE
player.panim = PA_ABILITY2
player.weapondelay = refiretime
mo.momx = $ * 2/3
mo.momy = $ * 2/3
mo.momx = $ * 3/4
mo.momy = $ * 3/4
S_StartSoundAtVolume(mo,sfx_s1c4,150)

if player == consoleplayer
Expand All @@ -134,7 +145,6 @@ local function newGunslinger(player)
player.revitem,
mo.x, mo.y, zpos(mo, player.revitem)
)

else
bullet = P_SpawnPointMissile(
mo,
Expand All @@ -144,14 +154,19 @@ local function newGunslinger(player)
player.revitem,
mo.x, mo.y, zpos(mo, player.revitem)
)
end

if (bullet and bullet.valid)
bullet.flags = $1 & ~MF_NOGRAVITY
bullet.momx = $1 / 2
bullet.momy = $1 / 2
end
if (bullet and bullet.valid)
-- bullet.flags = $1 & ~MF_NOGRAVITY
local speed = max(35 * mo.scale, FixedHypot(mo.momx - player.cmomx, mo.momy - player.cmomy) * 6 / 4)
local angle = R_PointToAngle2(0, 0, bullet.momx, bullet.momy)
local aiming = R_PointToAngle2(0, 0, FixedHypot(bullet.momx, bullet.momy), bullet.momz)

bullet.momx = P_ReturnThrustX(nil, angle, FixedMul(speed, cos(aiming)))
bullet.momy = P_ReturnThrustY(nil, angle, FixedMul(speed, cos(aiming)))
bullet.momz = FixedMul(speed, sin(aiming))
end
-- player.gunheld = true

player.drawangle = mo.angle
//Air function
if not(P_IsObjectOnGround(mo))
Expand All @@ -167,6 +182,8 @@ local function newGunslinger(player)
P_Thrust(mo,mo.angle+ANGLE_180,mo.scale*3)
end
end
else
player.gunheld = 0
end
//Running and gunning
local spd = FixedHypot(player.rmomx,player.rmomy)
Expand Down Expand Up @@ -216,15 +233,16 @@ local function newGunslinger(player)
if P_IsObjectOnGround(mo) and player.airgun == true
player.airgun = false
if (player.weapondelay) then
mo.state = S_PLAY_FIRE_FINISH
mo.tics = player.weapondelay
player.weapondelay = 0
mo.state = S_PLAY_STND
end
end
end

B.CustomGunslinger = function(player)
if not(player.mo) return end
if not(B.GetSkinVarsFlags(player)&SKINVARS_GUNSLINGER) return end

//Disallow native CA2_GUNSLINGER functionality
if player.charability2 == CA2_GUNSLINGER
player.charability2 = CA2_NONE
Expand All @@ -244,11 +262,7 @@ B.CustomGunslinger = function(player)
return end
//Get inputs
if (player.gunheld == nil)
player.gunheld = false
end

if not (player.cmd.buttons & BT_SPIN)
player.gunheld = false
player.gunheld = 0
end

//Do Gunslinger
Expand Down
Loading
Loading