From 3c69c3f72736b3f252f47c22a46b935352d94739 Mon Sep 17 00:00:00 2001 From: Kenneth Watson Date: Sun, 19 Jun 2022 09:21:25 +0200 Subject: [PATCH] fix #27 life increasing bug, small optimisations to MonsterShadow (#28) --- CHANGELOG.md | 4 ++++ buildscript/buildconfig.sh | 4 ++-- src/Classes/MonsterHunt.uc | 6 +++++- src/Classes/MonsterHuntScoreExtension.uc | 6 +++--- src/Classes/MonsterShadow.uc | 23 +++++++++++++---------- src/Textures/MHShadow.pcx | Bin 0 -> 2250 bytes 6 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 src/Textures/MHShadow.pcx diff --git a/CHANGELOG.md b/CHANGELOG.md index 2726e0c..18801b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 611 to 612: + - Deaths via traps reduce the life count, rather than increasing it + - Performance optimisations for monster shadows + ## 610 to 611: - Moved logic for several actions into separate "extension" classes: - `MonsterHuntScoreExtension`: Allows implementation of custom scoring for monster kills and player deaths diff --git a/buildscript/buildconfig.sh b/buildscript/buildconfig.sh index 5f4ad78..14f286c 100644 --- a/buildscript/buildconfig.sh +++ b/buildscript/buildconfig.sh @@ -7,8 +7,8 @@ SCRIPTS_DIR=$(dirname $(realpath $0)) export name="Monster Hunt" export package=MonsterHunt -export build=611 -export version=611 +export build=612 +export version=612 export packagefull=$package export packagedist=$package$version export debug=1 diff --git a/src/Classes/MonsterHunt.uc b/src/Classes/MonsterHunt.uc index 8767165..99df58e 100644 --- a/src/Classes/MonsterHunt.uc +++ b/src/Classes/MonsterHunt.uc @@ -404,13 +404,17 @@ function CheckEndGame() { function Killed(Pawn killer, Pawn other, name damageType) { Super.Killed(killer, other, damageType); - if (killer == None || other == None) return; + if (other == None) return; if (other.PlayerReplicationInfo == None) return; if (scoreExtension != None) other.PlayerReplicationInfo.Score += scoreExtension.PlayerKilled(killer, other); if (MonsterReplicationInfo(GameReplicationInfo).bUseLives && other.bIsPlayer) { + // if there was no killer (trap death), super increases the deaths count, while we're decreasing it here. + // avoiding introduction of a new PRI value for life countdown, since some things elsewhere may now rely on it. + // so we need to decrease it by two, as a giant hack :( + if (killer == None) other.PlayerReplicationInfo.Deaths -= 1; other.PlayerReplicationInfo.Deaths -= 1; CheckEndGame(); } diff --git a/src/Classes/MonsterHuntScoreExtension.uc b/src/Classes/MonsterHuntScoreExtension.uc index 37c5f2a..2add094 100644 --- a/src/Classes/MonsterHuntScoreExtension.uc +++ b/src/Classes/MonsterHuntScoreExtension.uc @@ -53,11 +53,11 @@ function int ScoreKill(Pawn killer, Pawn other) { } function int PlayerKilled(Pawn killer, Pawn other) { - // suicide - if (Killer == Other) return -4; + // suicide, or death by traps + if (killer == None || killer == Other) return -4; // player was killed by a monster - if (Killer.IsA('ScriptedPawn') && Other.bIsPlayer && !MonsterReplicationInfo(GameReplicationInfo).bUseLives) { + if (killer.IsA('ScriptedPawn') && Other.bIsPlayer && !MonsterReplicationInfo(GameReplicationInfo).bUseLives) { return -5; } diff --git a/src/Classes/MonsterShadow.uc b/src/Classes/MonsterShadow.uc index 0e899ff..bee7297 100644 --- a/src/Classes/MonsterShadow.uc +++ b/src/Classes/MonsterShadow.uc @@ -7,23 +7,28 @@ // For more info, https://shrimpworks.za.net // ============================================================ -class MonsterShadow extends Decal; +class MonsterShadow extends Decal + config(MonsterHunt); + +#exec TEXTURE IMPORT NAME=MHShadow FILE=Textures\MHShadow.pcx LODSET=2 var vector OldOwnerLocation; -var vector offset; + +const ShadowDir = vect(0.1, 0.1, 0); +const ShadowDrop = vect(0, 0, 300); function AttachToSurface() { } simulated event PostBeginPlay() { - DrawScale = 0.03 * Owner.CollisionRadius; - if (Owner.IsA('Nali') || Owner.IsA('Slith')) DrawScale *= 0.75; - if (Owner.IsA('Pupae')) DrawScale = 0.03 * (Owner.CollisionRadius / 2); + DrawScale = 0.09 * Owner.CollisionRadius; + if (Owner.IsA('Nali') || Owner.IsA('Slith')) DrawScale *= 1.0; + if (Owner.IsA('Pupae')) DrawScale = 0.12 * (Owner.CollisionRadius / 2); } simulated function Tick(float DeltaTime) { local Actor HitActor; - local Vector HitNormal, HitLocation, ShadowStart, ShadowDir; + local Vector HitNormal, HitLocation, ShadowStart; if (Owner == None) { Destroy(); @@ -36,10 +41,8 @@ simulated function Tick(float DeltaTime) { DetachDecal(); - ShadowDir = vect(0.1, 0.1, 0); - ShadowStart = Owner.Location + Owner.CollisionRadius * ShadowDir; - HitActor = Trace(HitLocation, HitNormal, ShadowStart - vect(0, 0, 300), ShadowStart, false); + HitActor = Trace(HitLocation, HitNormal, ShadowStart - ShadowDrop, ShadowStart, false); if (HitActor == None) return; @@ -50,6 +53,6 @@ simulated function Tick(float DeltaTime) { defaultproperties { MultiDecalLevel=3 - Texture=Texture'Botpack.energymark' + Texture=Texture'MHShadow' DrawScale=0.500000 } diff --git a/src/Textures/MHShadow.pcx b/src/Textures/MHShadow.pcx new file mode 100644 index 0000000000000000000000000000000000000000..d28dd09ee33263147fc7c401924cce7adea2b6bf GIT binary patch literal 2250 zcmeHHS65SM6qScrYu2oJx6v%1U~r?nr~LGT!;h12x!@Cu&v#!A zu9FC)5Y?y{{kKlO>?_fpNT1f=X zZZ%57G)VpQg+4J8eWK5J>Zbu30%nZHVP&n6cpN;9LwHQ!Pf|n!*K?QzTt-8w-=aJ`kk8SHN9dl=@q@9ck~_}x^UKqm}531_;I8K|2eK3 z7R}U1_4J4g#E7UG-v+9q2KZ>kX*W0xB1bu{ovj62Iram+g`M$1Re34XmzGsM0P-ok zwIJ#zpmkU51sm;$hh5n9P0JZAM}#M3SEv`X%LuFrPkz^+@@MkYQ-TZ zG$H#o1KI`8Pww8(ssvFX3Q9q#%Ffr{N3dobeSv3-Y&r@OZBW%%c0EgAnM}dpSQJ#6 z!U|;D2!%|b%~@EXiV2#$AS%gGDl&}0 zq6=!u^VKzw2B|QGGUw)fd&UD$hIbsV&PUX&{$BAlF1P`=kdp( zS@4PijnV+0uvBYr+(l%bHm?jXqJ(cVymm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