Skip to content

Commit

Permalink
Score gained from enemies are now accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiskster committed Sep 2, 2024
1 parent 678f873 commit dd24791
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
24 changes: 21 additions & 3 deletions src/Lua/Hooks/PlayerTweaks.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
local score_table = {
[1] = 100,
[2] = 200,
[3] = 500,
}

-- Doesn't limit to grabbing rings. you get extra score on killing other stuff too
addHook("MobjDeath", function(target, inflictor, source)
if CV_PTSR.scoreonkill.value and PTSR.IsPTSR() and source and source.valid and source.player and source.player.valid then
local player = source.player
local gm_metadata = PTSR.currentModeMetadata()
local ring_score = gm_metadata.ring_score or PTSR.ring_score
local enemy_score = gm_metadata.enemy_score or PTSR.enemy_score
local real_scoreadd = player.scoreadd + 1
local scoreadd_deduct = 0

if score_table[real_scoreadd] then
scoreadd_deduct = score_table[real_scoreadd]
elseif real_scoreadd >= 4 and real_scoreadd <= 14 then
scoreadd_deduct = 1000
elseif real_scoreadd > 14 then
scoreadd_deduct = 10000
end

if (target.flags & MF_ENEMY) then
P_AddPlayerScore(player, enemy_score-100)
print("ded: "..scoreadd_deduct)
print("equation: "..enemy_score-scoreadd_deduct)
P_AddPlayerScore(player, enemy_score-scoreadd_deduct)
PTSR.add_wts_score(player, target, enemy_score)

if not player.ptsr.pizzaface then
Expand All @@ -16,7 +34,7 @@ addHook("MobjDeath", function(target, inflictor, source)
end
return
elseif (target.type == MT_RING or target.type == MT_COIN)
P_AddPlayerScore(player, ring_score-100)
P_AddPlayerScore(player, ring_score)
PTSR.add_wts_score(player, target, ring_score)

if not player.ptsr.pizzaface then
Expand All @@ -28,6 +46,6 @@ addHook("MobjDeath", function(target, inflictor, source)

if source.player
and source.player.ptsr then
source.player.ptsr.current_score = player.score
source.player.ptsr.current_score = source.player.score
end
end)
2 changes: 1 addition & 1 deletion src/Lua/main_game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ PTSR.default_playervars = {
lastparryframe = nil,
cantparry = false, --this is for the pizzaface parry - saxa

hudstuff = PTSR_shallowcopy(PTSR.hudstuff)
hudstuff = PTSR_shallowcopy(PTSR.hudstuff),

-- score lmao
current_score = 0,
Expand Down

0 comments on commit dd24791

Please sign in to comment.