FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.77k stars 409 forks source link

[modding] [crash] repairtools that aren't held crash upon use #4447

Closed ghost closed 3 years ago

ghost commented 3 years ago

Description title.

Steps To Reproduce very easy. have a repairtool other than a fire extinguisher be "on" while not held. should result in a crash every time

Version unstable, 12/8/2020

Additional information here is the crash report, a testing environment, and a mod that can create this crash. in this case the crash happens upon planting a seed in the plant pot. probably because it doesn't interact with anything other than a plant pot with a plant in it. `Barotrauma Client crash report (generated on 12/8/2020 8:24:54 PM)

Barotrauma seems to have crashed. Sorry for the inconvenience!

C30AA15F725E6EC3BD34659472EB3B85

Game version 0.11.0.9 (ReleaseWindows, branch release, revision c60afcc03b) Graphics mode: 1280x600 (Fullscreen) VSync ON Language: English Selected content packages: Vanilla 0.9, Thalassophobia, mudraptorpet, Anime Poster Pack, Vertical Hatches, ExtendedMonsters [Spawner Edition], T.H.I.C.C., Salty Dogs Level seed: no level loaded Loaded submarine: sprinkler testing (6FAE4F478320E99A8932AF2BEECA06E6) Selected screen: Barotrauma.GameScreen SteamManager initialized

System info: Operating system: Microsoft Windows NT 10.0.18363.0 64 bit GPU name: Intel(R) HD Graphics Display mode: {Width:1366 Height:768 Format:Color AspectRatio:1.7786459} GPU status: Normal

Exception: Object reference not set to an instance of an object. (System.NullReferenceException) Target site: Void Repair(Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2, Single, Barotrauma.Character, Single, System.Collections.Generic.List1[FarseerPhysics.Dynamics.Body]) Stack trace: at Barotrauma.Items.Components.RepairTool.Repair(Vector2 rayStart, Vector2 rayEnd, Single deltaTime, Character user, Single degreeOfSuccess, List1 ignoredBodies) in \Barotrauma\BarotraumaShared\SharedSource\Items\Components\Holdable\RepairTool.cs:line 469 at Barotrauma.Items.Components.RepairTool.Use(Single deltaTime, Character character) in \Barotrauma\BarotraumaShared\SharedSource\Items\Components\Holdable\RepairTool.cs:line 271 at Barotrauma.Item.Use(Single deltaTime, Character character, Limb targetLimb) in \Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 2083 at Barotrauma.StatusEffect.Apply(Single deltaTime, Entity entity, IEnumerable1 targets, Nullable1 worldPosition) in \Barotrauma\BarotraumaShared\SharedSource\StatusEffects\StatusEffect.cs:line 892 at Barotrauma.StatusEffect.Apply(ActionType type, Single deltaTime, Entity entity, IEnumerable1 targets, Nullable1 worldPosition) in \Barotrauma\BarotraumaShared\SharedSource\StatusEffects\StatusEffect.cs:line 822 at Barotrauma.Item.ApplyStatusEffect(StatusEffect effect, ActionType type, Single deltaTime, Character character, Limb limb, Entity useTarget, Boolean isNetworkEvent, Boolean checkCondition, Nullable1 worldPosition) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1382 at Barotrauma.Item.ApplyStatusEffects(ActionType type, Single deltaTime, Character character, Limb limb, Entity useTarget, Boolean isNetworkEvent, Nullable1 worldPosition) in \Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1291 at Barotrauma.Item.Update(Single deltaTime, Camera cam) in \Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1444 at Barotrauma.MapEntity.UpdateAll(Single deltaTime, Camera cam) in \Barotrauma\BarotraumaShared\SharedSource\Map\MapEntity.cs:line 562 at Barotrauma.GameScreen.Update(Double deltaTime) in \Barotrauma\BarotraumaShared\SharedSource\Screens\GameScreen.cs:line 235 at Barotrauma.GameMain.Update(GameTime gameTime) in \Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 924 at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in \Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 656 at Microsoft.Xna.Framework.Game.Tick() in \Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 500 at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in \Libraries\MonoGame.Framework\Src\MonoGame.Framework\SDL\SDLGamePlatform.cs:line 92 at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in \Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 397 at Microsoft.Xna.Framework.Game.Run() in \Libraries\MonoGame.Framework\Src\MonoGame.Framework\Game.cs:line 367 at Barotrauma.Program.Main(String[] args) in \Barotrauma\BarotraumaClient\ClientSource\Program.cs:line 58

Last debug messages: [12/8/2020 8:22:59 PM] WARNING: Cannot compress a texture because the dimensions are not a multiple of 4 (path: Mods/Thalassophobia/Map/Thalamus/thalamus.png, size: 853x446) [12/8/2020 8:22:59 PM] Could not compress a texture because the dimensions aren't a multiple of 4 (path: Mods/Thalassophobia/Map/Thalamus/thalamus.png, size: 853x446) [12/8/2020 8:22:56 PM] WARNING: Cannot compress a texture because the dimensions are not a multiple of 4 (path: Mods/Salty Dogs/Item/Cage.png, size: 500x250) [12/8/2020 8:22:56 PM] Could not compress a texture because the dimensions aren't a multiple of 4 (path: Mods/Salty Dogs/Item/Cage.png, size: 500x250) [12/8/2020 8:21:17 PM] Loading sprite "Content\Items\OxygenGenerator/oxygengenerator.png" failed, retrying in 250 ms... [12/8/2020 8:21:01 PM] OpenAL Soft on Microphone (Realtek High Definition Audio) 57 [12/8/2020 8:21:01 PM] OpenAL Soft on Microphone (Steam Streaming Microphone) 54 [12/8/2020 8:21:01 PM] OpenAL Soft on Microphone (2- USB Audio Device) 47 [12/8/2020 8:20:43 PM] Loading additional location types from file 'Mods/Thalassophobia/Map/locationtypes.xml' [12/8/2020 8:20:11 PM] WARNING: Cannot compress a texture because the dimensions are not a multiple of 4 (path: Submarines/Downloaded/Nemo's Nautilus.sub, size: 1225x344) [12/8/2020 8:20:10 PM] WARNING: Cannot compress a texture because the dimensions are not a multiple of 4 (path: Submarines/Downloaded/MECH NANCY.sub, size: 983x524) [12/8/2020 8:19:42 PM] (Msg) SDR RelayNetworkStatus: avail=OK config=OK anyrelay=OK (OK) [12/8/2020 8:19:42 PM] (Msg) Ping location: ord=56+5,iad=57+5,atl=74+11/70+5,okc=104+10/73+5,sea=135+13/101+5,lax=129+13/102+5,eat=136+13/103+5,par=178+17/134+5,lux=187+18/138+5,fra=172+17/143+5,gru=197+19/200+5,sgp=317+31/308+5 [12/8/2020 8:19:42 PM] (Msg) Ping measurement completed [12/8/2020 8:19:40 PM] (Debug) Destroying relay 'sof#4 (139.45.193.10:27018)' because initial_ping_timeout [12/8/2020 8:19:38 PM] (Debug) Destroying relay 'sof#3 (139.45.193.10:27017)' because initial_ping_timeout [12/8/2020 8:19:35 PM] (Debug) Destroying relay 'sof#5 (139.45.193.10:27019)' because initial_ping_timeout [12/8/2020 8:19:33 PM] (Verbose) Communications with routing cluster 'sto2' established. [12/8/2020 8:19:32 PM] (Debug) Destroying relay 'sto2#183 (155.133.252.38:27051)' because initial_ping_timeout [12/8/2020 8:19:32 PM] (Debug) Destroying relay 'sof#2 (139.45.193.10:27016)' because initial_ping_timeout [12/8/2020 8:19:31 PM] (Verbose) Communications with routing cluster 'waw' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'syd' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'tyo1' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'vie' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'tyo' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'sgp' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'sto' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'maa' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'jnb' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'scl' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'sea' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'par' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'mad' established. [12/8/2020 8:19:30 PM] (Msg) Relay hkg#225 (153.254.86.165:27031) is going offline in 411 seconds [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'hkg' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'lux' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'lim' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'okc' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'lhr' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'ord' established. [12/8/2020 8:19:30 PM] (Msg) Cluster 'lax' has a selection penalty of 1ms for load balancing purposes. (As per lax#26 (162.254.195.86:27020)). [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'lax' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'gru' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'dxb' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'bom' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'fra' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'iad' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'eat' established. [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'ams' established. [12/8/2020 8:19:30 PM] (Msg) Cluster 'atl' has a selection penalty of 4ms for load balancing purposes. (As per atl#20 (162.254.199.170:27034)). [12/8/2020 8:19:30 PM] (Verbose) Communications with routing cluster 'atl' established. [12/8/2020 8:19:30 PM] (Msg) SDR RelayNetworkStatus: avail=Attempting config=OK anyrelay=Attempting (Performing ping measurement) [12/8/2020 8:19:30 PM] (Msg) Performing ping measurement [12/8/2020 8:19:29 PM] (Msg) Got SDR network config. Loaded revision 285 OK [12/8/2020 8:19:29 PM] (Warning) SDR network config fetch first attempt failed. HTTP 504. . Trying again. [12/8/2020 8:18:38 PM] Attempting to open ALC device "OpenAL Soft on Speakers (2- USB Audio Device)" [12/8/2020 8:18:34 PM] Loaded languages: English, German, French, Russian, Polish, Brazilian Portuguese, Castilian Spanish, Latinamerican Spanish, Simplified Chinese, Traditional Chinese, Japanese, Turkish, Korean [12/8/2020 8:18:32 PM] Loaded languages: English, German, French, Russian, Polish, Brazilian Portuguese, Castilian Spanish, Latinamerican Spanish, Simplified Chinese, Traditional Chinese, Japanese, Turkish, Korean [12/8/2020 8:18:29 PM] Logged in as TacticalThunder (SteamID STEAM_1:1:427448593) `

auto plants.zip

sprinkler testing.zip

submarine file is inside sprinkler testing.zip because sub files can't be uploaded.

if you need any more information, probably talk to habismal on the discord server because he's smart.

itchyOwl commented 3 years ago

Fixed in Regalis11/Barotrauma-development@f0a562b. Thanks for a good report!

Rokvach commented 3 years ago

Tested, working correctly. Closing.

hubismal commented 3 years ago

"Fixed crashing if a repair tool is operated by something else than a character (only affects modded items)." Seeing this in the changelog for latest unstable. But still recieved an extremely similar crash as of the latest unstable (the one that adds stacking). This is just when a repairtool hits a plant, with wateramount="20". It seems this is not fixed.

Exception: Object reference not set to an instance of an object. (System.NullReferenceException)
Target site: Void Repair(Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2, Single, Barotrauma.Character, Single, System.Collecti
ons.Generic.List`1[FarseerPhysics.Dynamics.Body])
Stack trace: 
   at Barotrauma.Items.Components.RepairTool.Repair(Vector2 rayStart, Vector2 rayEnd, Single deltaTime, Character user, Single degreeOfSuccess, 
List`1 ignoredBodies) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs:line 461
   at Barotrauma.Items.Components.RepairTool.Use(Single deltaTime, Character character) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/
Components/Holdable/RepairTool.cs:line 272
   at Barotrauma.Item.Use(Single deltaTime, Character character, Limb targetLimb) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Item.c
s:line 2096
   at Barotrauma.StatusEffect.Apply(Single deltaTime, Entity entity, IEnumerable`1 targets, Nullable`1 worldPosition) in <DEV>/Barotrauma/Barotr
aumaShared/SharedSource/StatusEffects/StatusEffect.cs:line 899
   at Barotrauma.StatusEffect.Apply(ActionType type, Single deltaTime, Entity entity, IEnumerable`1 targets, Nullable`1 worldPosition) in <DEV>/
Barotrauma/BarotraumaShared/SharedSource/StatusEffects/StatusEffect.cs:line 829
   at Barotrauma.Item.ApplyStatusEffect(StatusEffect effect, ActionType type, Single deltaTime, Character character, Limb limb, Entity useTarget
, Boolean isNetworkEvent, Boolean checkCondition, Nullable`1 worldPosition) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs:line
 1406
   at Barotrauma.Item.ApplyStatusEffects(ActionType type, Single deltaTime, Character character, Limb limb, Entity useTarget, Boolean isNetworkE
vent, Nullable`1 worldPosition) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs:line 1320
   at Barotrauma.Item.Update(Single deltaTime, Camera cam) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs:line 1468
   at Barotrauma.MapEntity.UpdateAll(Single deltaTime, Camera cam) in <DEV>/Baro
trauma/BarotraumaShared/SharedSource/Map/MapEntity.cs:line 558
   at Barotrauma.GameScreen.Update(Double deltaTime) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Screens/GameScreen.cs:line 234
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>/Barotrauma/BarotraumaClient/ClientSource/GameMain.cs:line 928
   at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in <DEV>/Libraries/MonoGame.Framework/Src/MonoGame.Framework/Game.cs:line 656
   at Microsoft.Xna.Framework.Game.Tick() in <DEV>/Libraries/MonoGame.Framework/Src/MonoGame.Framework/Game.cs:line 500
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop() in <DEV>/Libraries/MonoGame.Framework/Src/MonoGame.Framework/SDL/SDLGamePlatform.cs:line 92
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in <DEV>/Libraries/MonoGame.Framework/Src/MonoGame.Framework/Game.cs:line 397
   at Microsoft.Xna.Framework.Game.Run() in <DEV>/Libraries/MonoGame.Framework/Src/MonoGame.Framework/Game.cs:line 367
   at Barotrauma.Program.Main(String[] args) in <DEV>/Barotrauma/BarotraumaClient/ClientSource/Program.cs:line 58

Requesting Reopening. This can be reproduced with this xml code

<Item name="" identifier="thal_sprinkler" category="Machine" Tags="mediumitem,fireextinguisher,provocative" cargocontaineridentifier="metalcrate" description="" impactsoundtag="impact_metal_light" requireaimtouse="false" hideinmenus="true">
    <!-- show in menus disabled until 0.10.5(?).0 -->
    <InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
    <Sprite texture="Content/Items/InventoryIconAtlas.png" depth="0.55" sourcerect="0,0,64,64" origin="0.5,0.5" />
    <Body width="17" height="48" density="5" bodytype="Kinematic" >
      <StatusEffect type="Always" targettype="This" setvalue="true" targetrotation="70" rotation="70" />
    </Body>
    <RepairTool extinguishamount="60.0" range="500" barrelpos="0,0" repairthroughholes="true" wateramount="20" requireaimtouse="false" usablein="air" barrelrotation="270" structurefixamount="-3" >
      <ParticleEmitter particle="extinguisher" velocitymin="500.0" velocitymax="650.0" particlespersecond="50" />
      <StatusEffect type="OnUse" targettype="This" setvalue="true" rotation="30" />
      <sound file="Content/Items/Tools/Extinguisher.ogg" type="OnUse" range="500.0" loop="true" />
      <StatusEffect type="Always" target="This">
        <UseItem />
      </StatusEffect>
    </RepairTool>
  </Item>

just spawn a growing plant underneath it.

hubismal commented 3 years ago
Exception: Object reference not set to an instance of an object. (System.NullReferenceException)
Target site: Microsoft.Xna.Framework.Vector2 get_TransformedBarrelPos()
Stack trace: 
   at Barotrauma.Items.Components.RepairTool.get_TransformedBarrelPos() in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs:line 119
   at Barotrauma.Items.Components.RepairTool.Use(Single deltaTime, Character character) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs:line 208
   at Barotrauma.Item.Use(Single deltaTime, Character character, Limb targetLimb) in <DEV>/Barotrauma/BarotraumaShared/SharedSource/Items/Item.cs:line 2096

another crash

<Item name="" identifier="thal_sprinkler" category="Machine" Tags="mediumitem,fireextinguisher,provocative" cargocontaineridentifier="metalcrate" description="" impactsoundtag="impact_metal_light" requireaimtouse="false" hideinmenus="true">
    <!-- show in menus disabled until 0.10.5(?).0 -->
    <InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="0,0,64,64" origin="0.5,0.5" />
    <Sprite texture="Content/Items/InventoryIconAtlas.png" depth="0.55" sourcerect="0,0,64,64" origin="0.5,0.5" />
    <Body width="17" height="48" density="5" >
      <StatusEffect type="Always" targettype="This" setvalue="true" targetrotation="70" rotation="70" />
    </Body>
    <!-- TODO: add "wateramount=10" after the bug is fixed -->
    <RepairTool extinguishamount="60.0" range="500" barrelpos="0,0" repairthroughholes="true" requireaimtouse="false" usablein="air" barrelrotation="270" >
      <ParticleEmitter particle="extinguisher" velocitymin="500.0" velocitymax="650.0" particlespersecond="50" />
      <StatusEffect type="OnUse" targettype="This" setvalue="true" rotation="30" />
      <sound file="Content/Items/Tools/Extinguisher.ogg" type="OnUse" range="500.0" loop="true" />
      <StatusEffect type="OnNotContained" target="This">
        <UseItem />
      </StatusEffect>
    </RepairTool>
    <Holdable selectkey="Select" pickkey="Use" slots="Any,RightHand,LeftHand" msg="ItemMsgDetachWrench" PickingTime="10.0" aimpos="35,-10" handle1="0,0" attachable="true" attachedbydefault="true" aimable="true">
      <requireditem identifier="wrench" type="Equipped" />
    </Holdable>
  </Item>

corresponding xml. happens immediately on spawn.

itchyOwl commented 3 years ago

Not actually the same crashes, but due to similar causes: the repair tool wasn't designed to be used without an user or a body (the body gets deferenced when the item is attached). Should be fixed in Regalis11/Barotrauma-development@f97483f.

Rokvach commented 3 years ago

Tested, working correctly. Will be added to the upcoming hotfix, closing.