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.74k stars 404 forks source link

Crash when using NearbyItems #11459

Closed Working-Joe closed 1 year ago

Working-Joe commented 1 year ago

Disclaimers

What happened?

The XML below overrides a can of paint to Use itself OnImpact. A second OnUse StatusEffect is then supposed to change the spritecolor of NearbyItems. However, for some reason this crashes the game. This used to work in previous versions.

  <Override>
    <Item name="" identifier="greenpaint" category="Material" maxstacksize="8" cargocontaineridentifier="chemicalcrate" description="" Tags="smallitem,paint" spritecolor="51,204,51,255" InventoryIconColor="51,204,51,255" scale="0.5" impactsoundtag="impact_metal_light" impacttolerance="6">
      <PreferredContainer primary="storagecab" minamount="1" maxamount="2" spawnprobability="0.25" />
      <PreferredContainer secondary="wreckstoragecab" minamount="1" maxamount="2" spawnprobability="0.075" />
      <PreferredContainer primary="engcab" minamount="0" maxamount="1" spawnprobability="0.25" />
      <Price baseprice="65">
        <Price locationtype="outpost" multiplier="1.1" minavailable="2" />
        <Price locationtype="city" multiplier="0.9" minavailable="2" />
        <Price locationtype="research" multiplier="1.2" minavailable="2" />
        <Price locationtype="military" multiplier="1.2" minavailable="2" />
        <Price locationtype="mine" multiplier="1.2" minavailable="2" />
      </Price>
      <InventoryIcon texture="Content/Items/InventoryIconAtlas2.png" sourcerect="256,320,64,64" origin="0.5,0.5" />
      <Sprite texture="Content/Items/Tools/tools.png" sourcerect="379,78,27,58" depth="0.6" origin="0.5,0.5" />
      <Body width="25" height="55" density="20" />
      <Fabricate suitablefabricators="fabricator" requiredtime="30">
        <RequiredSkill identifier="mechanical" level="20" />
        <RequiredItem identifier="ethanol" />
        <RequiredItem identifier="rubber" />
        <RequiredItem identifier="copper" />
      </Fabricate>
      <Deconstruct time="20">
        <Item identifier="ethanol" copycondition="true" mincondition="0.1" />
        <Item identifier="rubber" copycondition="true" mincondition="0.1" />
        <Item identifier="copper" copycondition="true" mincondition="0.1" />
      </Deconstruct>
      <Throwable characterusable="true" canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10" msg="ItemMsgPickUpSelect">
        <StatusEffect type="OnImpact" target="This">
          <Use />
        </StatusEffect>
      </Throwable>
      <ItemComponent characterusable="false">
        <StatusEffect type="OnUse" target="NearbyItems" range="150"  spriteColor="51,204,51" InventoryIconColor="51,204,51"/>
      </ItemComponent>
    </Item>
  </Override>

Reproduction steps

  1. Add the XML above to a mod of your choosing
  2. Spawn a can of paint and toss it
  3. Impact
  4. Game implodes :(

Bug prevalence

Happens every time I play

Version

Faction/endgame test branch

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

Barotrauma Client crash report (generated on 03/05/2023 21:15:46)

Barotrauma seems to have crashed. Sorry for the inconvenience! 

AFABEC682B377E070F421C2C1852AF62

Game version 1.0.6.0 (ReleaseWindows, branch release/1.0, revision a2ad1b8b8d)
Graphics mode: 1920x1080 (BorderlessWindowed)
VSync ON
Language: English
Selected content packages: Vanilla, Crescent Christmas pre-release, Battleships, Charging coilgun, Coil balancing, RGB assemblies, Greatly improved RGB assemblies, RegexConcRGB, Regex Conc RGB, Barotronics - Fallout Hacking, Barotronics - Barolink resolved, Barotronics - Barolink, Barotronics - Barolink backup, Coil balancing finalising, Barotronics - airlock, Barotronics - Advanced Turrets, Barotronics - Serveillance, Barotronics - Doors Collection, Barotronics - Clock, Barotronics - template, Barotronics - Docking Rail, Barotronics - Background, Barotronics - Game Of Life, Barotronics - Mapper shuttle, Barotronics - Mapper, Barotronics - Automatic Farm, Barotronics - Minigames, Barotronics - Morse, Barotronics - Turrets, Barotronics - Sonar turret, Crescent, Crescent - Pre-Release, Deus Machina, ZEUS 0.6, display debug, triple click door, Coil balancing complete, White label, Testing space, VOLTFOX, PaintItems
Level seed: no level loaded
Loaded submarine: Testing space (D62D67903D9AB1326C5B4CCFC7C0B5C4)
Selected screen: Barotrauma.GameScreen
SteamManager initialized

System info:
    Operating system: Microsoft Windows NT 10.0.19045.0 64 bit
    GPU name: NVIDIA GeForce GTX 1070
    Display mode: {Width:1920 Height:1080 Format:Color AspectRatio:1.7777778}
    GPU status: Normal

Exception: Object reference not set to an instance of an object. (System.NullReferenceException)
Target site: Void AddNearbyTargets(Microsoft.Xna.Framework.Vector2, System.Collections.Generic.List`1[Barotrauma.ISerializableEntity])
Stack trace: 
   at Barotrauma.StatusEffect.AddNearbyTargets(Vector2 worldPosition, List`1 targets) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\StatusEffects\StatusEffect.cs:line 902
   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 1680
   at Barotrauma.Items.Components.ItemComponent.ApplyStatusEffects(ActionType type, Single deltaTime, Character character, Limb targetLimb, Entity useTarget, Character user, Nullable`1 worldPosition, Single afflictionMultiplier) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Components\ItemComponent.cs:line 855
   at Barotrauma.Item.Use(Single deltaTime, Character character, Limb targetLimb) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 2758
   at Barotrauma.StatusEffect.Apply(Single deltaTime, Entity entity, IReadOnlyList`1 targets, Nullable`1 worldPosition) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\StatusEffects\StatusEffect.cs:line 1310
   at Barotrauma.StatusEffect.Apply(ActionType type, Single deltaTime, Entity entity, IReadOnlyList`1 targets, Nullable`1 worldPosition) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\StatusEffects\StatusEffect.cs:line 1212
   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 1740
   at Barotrauma.Item.ApplyStatusEffects(ActionType type, Single deltaTime, Character character, Limb limb, Entity useTarget, Boolean isNetworkEvent, Nullable`1 worldPosition) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1638
   at Barotrauma.Item.HandleCollision(Single impact) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 2231
   at Barotrauma.Item.Update(Single deltaTime, Camera cam) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Items\Item.cs:line 1907
   at Barotrauma.MapEntity.UpdateAll(Single deltaTime, Camera cam) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Map\MapEntity.cs:line 649
   at Barotrauma.GameScreen.Update(Double deltaTime) in <DEV>\Barotrauma\BarotraumaShared\SharedSource\Screens\GameScreen.cs:line 248
   at Barotrauma.GameMain.Update(GameTime gameTime) in <DEV>\Barotrauma\BarotraumaClient\ClientSource\GameMain.cs:line 881
   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 93
   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

Last debug messages:
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:39] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item cyanpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item blackpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item bluepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item yellowpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item whitepaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item redpaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Item magentapaint has multiple Holdable components (Holdable, Throwable).
[03/05/2023 21:15:35] WARNING: Could not compress a texture because the dimensions aren't a multiple of 4 (path: LocalMods/PaintItems/paintMachines.png, size: 516x275)
[03/05/2023 21:14:22] Attempting to open ALC device "OpenAL Soft on Luidsprekers (Realtek High Definition Audio)"
[03/05/2023 21:14:19] Logged in as Working Joe (SteamID STEAM_1:0:167499710)
Working-Joe commented 1 year ago

The number of items nearby does not appear to influence the result.

Regalis11 commented 1 year ago

Fixed in https://github.com/Regalis11/Barotrauma-development/commit/65649fbd09326e12fc402a25bca3d29f4d478365

Rokvach commented 1 year ago

Tested, working correctly. Closing.