From 1467125502cf5238217bf0cea2d57d2b64abf974 Mon Sep 17 00:00:00 2001 From: Rebecca Kelly Date: Sat, 22 Oct 2022 18:08:05 -0400 Subject: [PATCH] Fix multiplayer desyncs --- NOTES | 17 +++++------------ gun-bonsai/CHANGELOG.md | 5 +++++ gun-bonsai/Makefile | 2 +- gun-bonsai/README.md | 2 +- gun-bonsai/ca.ancilla.bonsai/EventHandler.zs | 12 +++++------- gun-bonsai/ca.ancilla.bonsai/UpgradeGiver.zs | 2 +- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/NOTES b/NOTES index 61a6c5d..f00cefa 100644 --- a/NOTES +++ b/NOTES @@ -4,18 +4,6 @@ Slomo option instead of timestop? -### 0.9.4 - -make rapid fire work on things that have 1-tic frames -clarify how the custom levelup sound cvar works -? figure out XP wraparound ? maybe fixed -stop including PENTAHUD and other badlumps -add secondary upgrade support to elemental sythesis by implenting ::Dot.CopyFrom -rapid fire wears off on level transitions and you need to switch weapons to reapply it -nullpointer when attacking upgraded centaurs in Serpent Resurrection: - Called from TFLV_Upgrade_Thunderbolt_Aux.PostBeginPlay at GunBonsai-0.9.3.pk3:ca.ancilla.bonsai/upgrades/lightning.zsc, line 461 -co-op doesn't work at all (maybe bump this to 0.10) - ### 0.9.x - scavenge lead probabalistic below 100hp & for ammo that produces low amounts @@ -25,6 +13,11 @@ co-op doesn't work at all (maybe bump this to 0.10) - raised enemies don't collide with player projectiles, if possible - Shield upgrade rework - rather than a flat damage reduction, have it charge up when making kills in melee, and gradually fade when not doing so +- clarify how the custom levelup sound cvar works +- stop including PENTAHUD and other badlumps +- nullpointer when attacking upgraded centaurs in Serpent Resurrection: + - Called from TFLV_Upgrade_Thunderbolt_Aux.PostBeginPlay at GunBonsai-0.9.3.pk3:ca.ancilla.bonsai/upgrades/lightning.zsc, line 461 + ### 0.10.x? diff --git a/gun-bonsai/CHANGELOG.md b/gun-bonsai/CHANGELOG.md index 72bd91c..1a91020 100644 --- a/gun-bonsai/CHANGELOG.md +++ b/gun-bonsai/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.9.5 + +- Fix: + - Multiplayer should now stay synced + # 0.9.4 - New: diff --git a/gun-bonsai/Makefile b/gun-bonsai/Makefile index 32509ed..70a4178 100644 --- a/gun-bonsai/Makefile +++ b/gun-bonsai/Makefile @@ -1,5 +1,5 @@ NAME=GunBonsai -VERSION=0.9.4 +VERSION=0.9.5 LUMPS=zscript.txt LANGUAGE.* sprites sounds *.md COPYING.freedoom LUMPS+=MAPINFO CVARINFO SNDINFO KEYCONF MENUDEF GLDEFS BONSAIRC ZSDIR=ca.ancilla.bonsai diff --git a/gun-bonsai/README.md b/gun-bonsai/README.md index 502b593..5589b78 100644 --- a/gun-bonsai/README.md +++ b/gun-bonsai/README.md @@ -1,6 +1,6 @@ # Gun Bonsai -Gun Bonsai is a mod about growing your weapons from delicate pain saplings into beautiful murder trees. It is designed for maximum compatibility, and pairs well with total conversions and monster/weapon replacements, especially ones that increase the overall difficulty. +Gun Bonsai is a mod about growing your weapons from delicate pain saplings into beautiful murder trees. It is designed for maximum compatibility; it works in both gzDoom and lzDoom, supports multiplayer, and pairs well with total conversions and monster/weapon replacements, especially ones that increase the overall difficulty. As you fight the hordes of hell, your weapons will gain XP based on how much damage you do and what you're attacking. Once a weapon levels up, you can open the info screen to browse a list of randomly selected upgrades (four by default), of which you can pick one. Higher levels take more XP to earn, but some upgrades can only be unlocked on high-level weapons. diff --git a/gun-bonsai/ca.ancilla.bonsai/EventHandler.zs b/gun-bonsai/ca.ancilla.bonsai/EventHandler.zs index 3b33e3d..b8f7edb 100644 --- a/gun-bonsai/ca.ancilla.bonsai/EventHandler.zs +++ b/gun-bonsai/ca.ancilla.bonsai/EventHandler.zs @@ -127,7 +127,7 @@ class ::EventHandler : StaticEventHandler { // Check for pending level ups and apply those if present. if (stats.GetInfoForCurrentWeapon() && stats.GetInfoForCurrentWeapon().StartLevelUp()) return; if (stats.StartLevelUp()) return; - Menu.SetMenu("GunBonsaiStatusDisplay"); + if (p == consoleplayer) Menu.SetMenu("GunBonsaiStatusDisplay"); return; } @@ -154,9 +154,7 @@ class ::EventHandler : StaticEventHandler { } override void NetworkProcess(ConsoleEvent evt) { - if (evt.player != consoleplayer) { - return; - } else if (evt.name == "bonsai-show-info") { + if (evt.name == "bonsai-show-info") { ShowInfo(evt.player); } else if (evt.name == "bonsai-cycle-ld-effect") { if (::Settings.have_legendoom()) { @@ -199,7 +197,7 @@ class ::EventHandler : StaticEventHandler { DEBUG("WTD: %s inflictor=%s source=%s damage=%d type=%s flags=%X, hp=%d", TAG(evt.thing), TAG(evt.inflictor), TAG(evt.damagesource), evt.damage, evt.damagetype, evt.damageflags, evt.thing.health); - if (evt.damagesource == players[consoleplayer].mo + if (PlayerPawn(evt.damagesource) && evt.thing.bISMONSTER && !evt.thing.bFRIENDLY // do not award XP or trigger procs when attacking friendlies && evt.thing != evt.damagesource @@ -209,7 +207,7 @@ class ::EventHandler : StaticEventHandler { if (evt.thing.health <= 0) { stats.OnKill(evt.inflictor, evt.thing); } - } else if (evt.thing == players[consoleplayer].mo) { + } else if (PlayerPawn(evt.thing)) { ::PerPlayerStats.GetStatsFor(PlayerPawn(evt.thing)).OnDamageReceived( evt.inflictor, evt.damagesource, evt.damage); } @@ -218,7 +216,7 @@ class ::EventHandler : StaticEventHandler { override void WorldThingSpawned(WorldEvent evt) { Actor thing = evt.thing; if (!thing) return; - if (thing.bMISSILE && thing.target == players[consoleplayer].mo) { + if (thing.bMISSILE && PlayerPawn(thing.target)) { // If it's a projectile (MISSILE flag is set) and target=player, the player // just fired a shot. This is our chance to fiddle with its flags and whatnot. ::PerPlayerStats.GetStatsFor(thing.target).OnProjectileCreated(thing); diff --git a/gun-bonsai/ca.ancilla.bonsai/UpgradeGiver.zs b/gun-bonsai/ca.ancilla.bonsai/UpgradeGiver.zs index 3b71dd5..29acb22 100644 --- a/gun-bonsai/ca.ancilla.bonsai/UpgradeGiver.zs +++ b/gun-bonsai/ca.ancilla.bonsai/UpgradeGiver.zs @@ -48,7 +48,7 @@ class ::UpgradeGiver : Inventory { DEBUG("%s claiming menu", self.GetClassName()); stats.currentEffectGiver = self; - Menu.SetMenu(menuname); + if (players[consoleplayer].mo == owner) Menu.SetMenu(menuname); self.SetStateLabel("AwaitChoice"); }