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

Modded Item seems to desync #2373

Closed hubismal closed 2 years ago

hubismal commented 4 years ago

My mod has an item called "Clown Slick" that applies a stun affliction and a little bit of internal damage to nearby characters if they have no internal damage (internaldamage="eq 0"). It also plays a banana peel sound effect because it's supposed to be like you're slipping on an oily piece of cloth. It's funny in singleplayer, but not in multiplayer because it doesn't seem to work properly. There are two mysterious issues that don't seem to exist anywhere else.

I am trying to go through the code and cut out multiple parts to see what works and if anything fixes it, but it takes a while. I suspect it's something statuseffect related but I can't imagine why it would happen. Either way, this is definitely a bug due to the fact it exclusively doesn't work in multiplayer.

There is a link to my mod above if you want to try it out (for testing purposes obviously) but here is the code anyway:

  <Item name="Clown Slick" description="A completely innocuous oiled up rag. Slippery to those without internal damage." identifier="thal_slick" category="Equipment" cargocontaineridentifier="metalcrate" tags="smallitem" impactsoundtag="impact_soft" scale="0.3">
    <Deconstruct time="1">
      <Item identifier="weldingfueltank" outcondition="0.5" />
      <Item identifier="clowncostume" />
    </Deconstruct>
    <Fabricate suitablefabricators="fabricator" requiredtime="10" outcondition="100">
      <RequiredSkill identifier="mechanical" level="30" />
      <RequiredItem identifier="clowncostume" />
      <RequiredItem identifier="weldingfueltank" />
    </Fabricate>
    <InventoryIcon name="Clown Costume Icon" texture="Content/Items/InventoryIconAtlas.png" sourcerect="384,448,64,64" origin="0.5,0.5" />
    <Sprite name="Clown Costume" texture="Content/Items/Jobgear/MiscJobGear.png" sourcerect="6,163,195,68" depth="0.6" origin="0.5,0.5" />
    <Body width="30" height="15" density="40" />
    <MotionSensor range="120" canbeselected="false" minimumvelocity="0">
      <StatusEffect type="OnNotContained" target="NearbyCharacters" range="120" Comparison="Or">
        <Conditional internaldamage="eq 0" />
        <Affliction identifier="stun" strength="130" />
        <Affliction identifier="internaldamage" strength="3" />
        <Sound file="Mods/Thalassophobia/Items/Jobgear/Clown/slip0.ogg" type="OnActive" range="1000" selectionmode="Random" />
        <Sound file="Mods/Thalassophobia/Items/Jobgear/Clown/slip1.ogg" type="OnActive" range="1000" selectionmode="Random" />
        <Sound file="Mods/Thalassophobia/Items/Jobgear/Clown/slip2.ogg" type="OnActive" range="1000" selectionmode="Random" />
        <Sound file="Mods/Thalassophobia/Items/Jobgear/Clown/slip3.ogg" type="OnActive" range="1000" selectionmode="Random" />
        <Sound file="Mods/Thalassophobia/Items/Jobgear/Clown/slip4.ogg" type="OnActive" range="1000" selectionmode="Random" />
      </StatusEffect>
    </MotionSensor>
    <Holdable slots="Any,RightHand+LeftHand" aimpos="90,0" handle1="-50,65" handle2="-54,69" msg="ItemMsgPickUpSelect" />
  </Item>
juanjp600 commented 2 years ago

Fabrication-related issues should be fixed with https://github.com/Regalis11/Barotrauma/pull/7869, needs testing

Rokvach commented 2 years ago

We didn't encounter any fabrication syncing during yesterdays playsession, this seems to be working correctly. Closing.