sweetgiorni / AnyPortal

A Valheim mod for more flexible portals
Do What The F*ck You Want To Public License
17 stars 11 forks source link

Duplicating portal on dedicated servers when going to destroy there are 2 #27

Open DrPine opened 2 years ago

DrPine commented 2 years ago

Issue Description

Describe the bug When destroying a portal with this mod I get double the resources back

To Reproduce Steps to reproduce the behavior:

  1. Build a portal with your hammer
  2. Destroy the portal with your hammer - Destroy the second portal? Why?
  3. You now have duplicated the resources for the portal since it only costs the initial 1 portal to build, this should be fixed

Expected behavior Build a portal, destroy the portal with a hammer, not have a second portal still sitting there.

Additional context Could be solved by making the portal cost twice the amount of resources in the first place, hopefully this wouldn't then give double the resources back again. Not sure if this is how everyone experiences it or if it's just a bug for me.

Screenshots Not really applicable for this

Game version and environment

Game client version (found in the bottom right of the Valheim main menu v 0.211.9

After reproducing the issue, please attach the BepInEx game log from Valheim/BepInEx/LogOutput.log

Does the issue occur in single-player or multiplayer? You can also check "Both" if you've reproduced the issue in both game modes

If the issue occurs in multiplayer, is the server a "local" server started through the in-game menu, or is it a headless server (like installing the "Valheim Dedicated Server" in Steam or using a server hosting service)

If you are using a headless server, please reproduce the issue and then attach the BepInEx game log from ValheimServer/BepInEx/LogOutput.log

If you are using a headless server, is it being hosted on a Windows machine or a Linux machine?

DrPine commented 1 year ago

Here is my LogOutput.log from the Server that I accidentally forgot to include:


[Info   :   BepInEx] Running under Unity v2020.3.33.9525882
[Info   :   BepInEx] CLR runtime version: 4.0.30319.42000
[Info   :   BepInEx] Supports SRE: True
[Info   :   BepInEx] System platform: Bits64, Windows
[Message:   BepInEx] Preloader started
[Info   :   BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.19.0]
[Info   :   BepInEx] 1 patcher plugin loaded
[Info   :   BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Message:   BepInEx] Preloader finished
[Message:   BepInEx] Chainloader ready
[Message:   BepInEx] Chainloader started
[Info   :   BepInEx] 5 plugins to load
[Info   :   BepInEx] Loading [Show Container Contents 0.3.0]
[Info   :   BepInEx] Loading [Jotunn 2.7.9]
[Info   :    Jotunn] Initializing LocalizationManager
[Info   :    Jotunn] Initializing CommandManager
[Info   :    Jotunn] Initializing InputManager
[Info   :    Jotunn] Initializing SkillManager
[Info   :    Jotunn] Initializing PrefabManager
[Info   :    Jotunn] Initializing ItemManager
[Info   :    Jotunn] Initializing PieceManager
[Info   :    Jotunn] Initializing CreatureManager
[Info   :    Jotunn] Initializing ZoneManager
[Info   :    Jotunn] Initializing MockManager
[Info   :    Jotunn] Initializing KitbashManager
[Info   :    Jotunn] Initializing GUIManager
[Info   :    Jotunn] Initializing KeyHintManager
[Info   :    Jotunn] Initializing NetworkManager
[Info   :    Jotunn] Initializing SynchronizationManager
[Info   :    Jotunn] Initializing RenderManager
[Info   :    Jotunn] Initializing MinimapManager
[Info   :    Jotunn] Initializing UndoManager
[Info   :    Jotunn] Jötunn v2.7.9 loaded successfully
[Info   :   BepInEx] Loading [MultiUserChest 0.2.4]
[Info   :   BepInEx] Loading [AnyPortal 2.0.0]
[Info   :   BepInEx] Loading [More Gates 1.0.10]
[Message:   BepInEx] Chainloader startup complete
[Info   : Unity Log] 10/19/2022 03:16:42: Starting to load scene:start

[Warning: Unity Log] HDR Render Texture not supported, disabling HDR on reflection probe.
[Warning: Unity Log] HDR Render Texture not supported, disabling HDR on reflection probe.
[Warning: Unity Log] Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).
[Warning: Unity Log] HDR Render Texture not supported, disabling HDR on reflection probe.
[Info   : Unity Log] 10/19/2022 03:16:50: Setting -savedir to: E:\XboxGames\Valheim\Content\Server\Saves\

[Info   : Unity Log] 10/19/2022 03:16:50: Get create world DrPine

[Info   : Unity Log] 10/19/2022 03:16:50: Using default prefs

[Info   : Unity Log] 10/19/2022 03:16:50: Valheim version:0.211.9

[Info   :Jotunn.Managers.CommandManager] Adding 1 commands to the Console
[Info   : Unity Log] 10/19/2022 03:16:50: Render threading mode:SingleThreaded

[Warning: Unity Log] 10/19/2022 03:16:50: Missing audio clip in music respawn

[Info   : Unity Log] 10/19/2022 03:16:51: Loaded localization CSV:localization language:English

[Info   : Unity Log] 10/19/2022 03:16:51: Loaded localization CSV:localization_extra language:English

[Info   : Unity Log] 10/19/2022 03:16:51: Loaded localization CSV:localization language:English

[Info   : Unity Log] 10/19/2022 03:16:51: Loaded localization CSV:localization_extra language:English

[Info   :Jotunn.Managers.LocalizationManager] Loading custom localizations
[Info   : Unity Log] 10/19/2022 03:16:52: Loaded localization CSV:localization language:English

[Info   : Unity Log] 10/19/2022 03:16:52: Loaded localization CSV:localization_extra language:English

[Info   :Jotunn.Managers.LocalizationManager] Adding tokens for language 'English'
[Info   : Unity Log] The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
[Warning: Unity Log] The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
[Info   : Unity Log] The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
[Info   : Unity Log] The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
[Warning: Unity Log] The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
[Info   : Unity Log] 10/19/2022 03:16:52: UI Group status changed Menu = True

[Warning: Unity Log] HDR Render Texture not supported, disabling HDR on reflection probe.
[Warning: Unity Log] HDR Render Texture not supported, disabling HDR on reflection probe.
[Info   : Unity Log] 10/19/2022 03:16:52: Using default prefs

[Info   :Jotunn.Managers.CommandManager] Adding 1 commands to the Console
[Info   : Unity Log] 10/19/2022 03:16:52: isModded: True

[Info   : Unity Log] 10/19/2022 03:16:52: Zonesystem Awake 239

[Info   : Unity Log] 10/19/2022 03:16:52: DungeonDB Awake 239

[Info   : Unity Log] 10/19/2022 03:16:53: PlayFab custom ID set to "PlayFab_DrPine_76d64bbe021fbc727753260b68422da66a88b2cb"

[Info   :Jotunn.Managers.PrefabManager] Adding 41 custom prefabs to the ZNetScene
[Info   :Jotunn.Managers.PieceManager] Adding 41 custom pieces to the PieceTables
[Info   : Unity Log] 10/19/2022 03:16:58: Audioman already exist, destroying self

[Info   : Unity Log] 10/19/2022 03:16:58: PlayFab logged in as "PlayFab_DrPine_76d64bbe021fbc727753260b68422da66a88b2cb"

[Info   : Unity Log] 10/19/2022 03:16:58: PlayFab local entity ID is B4087CD732ED4BD2

[Info   : Unity Log] 10/19/2022 03:16:58: New session server "DrPine" that has join code , now 0 player(s)

[Info   : Unity Log] 10/19/2022 03:16:58: Register PlayFab server "DrPine" with IP 73.109.159.243:2456

[Info   : Unity Log] 10/19/2022 03:16:58: Server 'DrPine' begin PlayFab create and join network for server 

[Info   :Jotunn.Managers.NetworkManager] Registering 2 custom RPCs
[Info   : Unity Log] 10/19/2022 03:17:04: Zonesystem Start 239

[Info   : Unity Log] 10/19/2022 03:17:04: Added 3 locations, 0 vegetations, 0 environments, 0 biome env-setups from locations_cp1

[Info   : Unity Log] 10/19/2022 03:17:04: Added 1 locations, 0 vegetations, 1 environments, 0 biome env-setups from locations_mountaincaves

[Info   : Unity Log] 10/19/2022 03:17:05: DungeonDB Start 239

[Info   : Unity Log] 10/19/2022 03:17:05: Load world: DrPine (DrPine)

[Info   : Unity Log] 10/19/2022 03:17:05: Loading 105637 zdos , my id 4035999163 data version:28

[Info   : Unity Log] 10/19/2022 03:17:06: Loaded 100000 dead zdos

[Info   : Unity Log] 10/19/2022 03:17:06: Removed 0 OLD generated ZDOS

[Info   : Unity Log] 10/19/2022 03:17:06: Loaded 7477 locations

[Info   : Unity Log] The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
[Info   : Unity Log] The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
[Warning: Unity Log] The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
[Info   : Unity Log] 10/19/2022 03:17:08: Joined PlayFab Party network with ID "8ceb467f-e6ab-4a04-add6-bd54f1499985|AwBxUzlve+hYuFDjG06OdJLxAHisZkNlbnRyYWxVcwAAAAAAAAAAAAAAGnpkEL9Xa34rfnIgJk1n6olEkKykili28X3MawG4mvIpb0lkbnM4MWU1LWY5NDU4YWI5LTc5NGUtNGUzYi04ZGRiLTcyMDBjNmIxMWJhOC5jZW50cmFsdXMuY2xvdWRhcHAuYXp1cmUuY29t"

[Info   : Unity Log] 10/19/2022 03:17:08: Created PlayFab lobby with ID "d5227888-505c-48b3-8cbb-7917b25792b9", ConnectionString "cv1:d5227888-505c-48b3-8cbb-7917b25792b9|451107|kv1|cv1:GFUxn1EXrOUWDmU4dFk8WMBNFLUzf9ATPWemQ4faKQ4=" and owned by "B4087CD732ED4BD2"

[Info   : Unity Log] 10/19/2022 03:17:08: Session "DrPine" registered with join code 397508

[Info   : Unity Log] 10/19/2022 03:17:08: Retry join-code check 99

[Info   : Unity Log] 10/19/2022 03:17:09: Session "DrPine" with join code 397508 and IP 73.109.159.243:2456 is active with 0 player(s)

[Info   : Unity Log] 10/19/2022 03:19:58: PlayFab listen socket child connected to remote player B9339A5DE2E28FDF

[Info   : Unity Log] 10/19/2022 03:19:58: Player joined server "DrPine" that has join code 397508, now 1 player(s)

[Info   : Unity Log] 10/19/2022 03:19:58: Muted PlayFab remote player B9339A5DE2E28FDF

[Info   : Unity Log] 10/19/2022 03:19:58: PlayFab socket with remote ID playfab/B9339A5DE2E28FDF received local Platform ID Xbox_2533274817645690

[Info   : Unity Log] 10/19/2022 03:19:58: Got handshake from client playfab/B9339A5DE2E28FDF

[Info   : Unity Log] 10/19/2022 03:20:01: VERSION check their:0.211.9  mine:0.211.9

[Info   : Unity Log] 10/19/2022 03:20:01: Server: New peer connected,sending global keys

[Info   :Jotunn.Managers.SynchronizationManager+<>c__DisplayClass25_0+<<ZNet_RPC_Post_PeerInfo>g__SynchronizeInitialData|0>d] Sending initial data to peer #2965447355
[Info   : Unity Log] 10/19/2022 03:20:31: Got character ZDOID from Drpine : 2965447355:1```
sweetgiorni commented 1 year ago

Are you able to reproduce this issue with all other mods removed? AnyPortal doesn't make any changes to how portals are built/destroyed, resources used, etc., so this would be an unusual bug. I'm inclined to blame another mod if I have the option :)

DrPine commented 1 year ago

You had the option, until I just completed the below testing which proves that it is this mod's fault 100%. These are the detailed steps I just took to reproduce. You can see that it works fine up until deploying the world to a dedicated server.

Using BepInEx: https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/

  1. Disabled All Mods on Client
  2. Deployed AnyPortal v2.0.0 on Client: https://www.nexusmods.com/valheim/mods/170
  3. Deployed Jotunn the Valheim Library - Jotunn v2.7.9 on Client: https://www.nexusmods.com/valheim/mods/1138
  4. Created Character named Test
  5. Selected Start
  6. Created New Seed, jgrGDCdxjC, named Testing
  7. Selected Start
  8. Waited through game intro and landed at spawn point
  9. Logged out
  10. Logged in with character that has the necessary resources
  11. Created a chest and placed the resources in said chest, 2 Surtling cores, 20 Fne wood, 10 Greydwarf eyes
  12. Logged out
  13. Logged in with Test character
  14. Picked up materials from chest
  15. Built portal
  16. Destroyed portal - Works as intended
  17. Logged out
  18. Configuring Dedicated Server batch file to use this world, this is where the bug seems to occur
  19. ValheimServer.exe -nographics -batchmode -name "DrPine" -port 2456 -world "Testing" -password "testing" -savedir "C:\Users\Nick\AppData\LocalLow\IronGate\Valheim\" -public 1
  20. Installed BepInEx to the Server in Program Files: https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/
  21. Deployed AnyPortal v2.0.0 to the Server: https://www.nexusmods.com/valheim/mods/170
  22. Deployed Jotunn the Valheim Library - Jotunn v2.7.9 to the Server: https://www.nexusmods.com/valheim/mods/1138
  23. Started "StartHeadlessServer - Testing.bat"
  24. Jumped back into Valheim I selected my Test character
  25. Selected Start
  26. Selected Join Game
  27. Selected Add Server then entered the join code from the Server terminal
  28. Selected Connect
  29. Entered password "testing"
  30. Build portal with existing resources and workbench
  31. Destroy Portal
  32. Proof that the bug is from this mod at long last, the portal is still standing

*** Further details that might lead to a fix

  1. Destroy Portal - Receive duplicated resources
  2. Build 2 portals now since we have the resources
  3. Name one portal A and the other B
  4. Set portal A to teleport to portal B
  5. Destroy portal A - Works as intended no extra portal
  6. Create portal again, name portal A
  7. Destroy portal A - Bug exists portal still sitting there
  8. Instead of destroying again, change this duplicated portal destination to B
  9. While doing this the portal disappears
  10. Place portal down again, name it A, set destination to B, delete portal, duplicate portal still exists
  11. Change duplicated portal's destination from B to No destination and the duplicated portal poofs and is gone

** I hope with all my testing you can solve this bug. This mod is quite amazing, but this is definitely due to this mod alone.

DrPine commented 1 year ago

Suggestion, you could try having your mod change the destination of the portal upon deletion. That way it disappears automatically as it did in my testing when I did that step manually. If you could make any changes to this, I would be happy to test it for you. The logic would have to check the portals current destination and if set to No destination it would have to set to something else

Golkiwu commented 1 year ago

This has been happening on our dedicated server as well.