sandbag - a gunshot cover ??

Started by 14m1337, September 23, 2016, 08:27:32 AM

Previous topic - Next topic

14m1337

<ThingDef ParentName="BuildingBase">
    <defName>Sandbags</defName>
    <label>sandbags</label>
    <thingClass>Building</thingClass>
    <category>Building</category>
    <graphicData>
      <texPath>Things/Building/Linked/Sandbags_Atlas</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <linkType>Basic</linkType>
      <linkFlags>
        <li>Sandbags</li>
      </linkFlags>
    </graphicData>
    <blueprintGraphicData>
      <texPath>Things/Building/Linked/Sandbags_Blueprint_Atlas</texPath>
    </blueprintGraphicData>
    <uiIconPath>Things/Building/Linked/Sandbags_MenuIcon</uiIconPath>
    <altitudeLayer>Building</altitudeLayer>
    <pathCost>40</pathCost>
    <pathCostIgnoreRepeat>true</pathCostIgnoreRepeat>
    <passability>PassThroughOnly</passability>
    <castEdgeShadows>true</castEdgeShadows>
    <fillPercent>0.65</fillPercent>
    <statBases>
      <MaxHitPoints>450</MaxHitPoints>
      <Beauty>-10</Beauty>
      <WorkToMake>180</WorkToMake>
      <Flammability>0</Flammability>
    </statBases>
    <building>
      <isInert>true</isInert>
    </building>
    <description>Cover from gunfire.</description>
    <placingDraggableDimensions>1</placingDraggableDimensions>
    <costList>
      <Steel>6</Steel>
    </costList>
    <filthLeaving>SandbagRubble</filthLeaving>
    <rotatable>false</rotatable>
    <selectable>true</selectable>
    <neverMultiSelect>true</neverMultiSelect>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Security</designationCategory>
    <staticSunShadowHeight>0.20</staticSunShadowHeight>
    <constructEffect>ConstructDirt</constructEffect>
    <repairEffect>ConstructDirt</repairEffect>
    <designationHotKey>Misc1</designationHotKey>
  </ThingDef>


which variable is it that says "this provides cover" ? is it "<fillPercent>0.65</fillPercent>" ?
Quick_Silver - The One And Lonely
My posts may sometimes be filled with (sarcastic) humor - it's up to you to find it out on your own.
Usually drunk on Mondays from 21:00 to 03:00 CEST.

Master Bucketsmith


Dingo

Like MB said, I think that's it. Here is the code snippet for projectiles' interception chance:

private const float InterceptChanceOnRandomObjectPerFillPercent = 0.07f;

Master Bucketsmith

Quote from: Dingo on September 23, 2016, 09:51:06 AM
Like MB said, I think that's it. Here is the code snippet for projectiles' interception chance:

private const float InterceptChanceOnRandomObjectPerFillPercent = 0.07f;
*cough*MBS*cough*

14m1337

how does this work then ? is this variable only taken into account when the shooter doesn't stand next to the sandbag ?
Quick_Silver - The One And Lonely
My posts may sometimes be filled with (sarcastic) humor - it's up to you to find it out on your own.
Usually drunk on Mondays from 21:00 to 03:00 CEST.

Jdalt40

It takes into account;

-The health of the person shooting
-Cover
-Light levels right next to victim
-Shooter's base accuracy, impacted by health, traits and skill
-Distance
-Base Accuracy of the weapon

So if you had a careful shooter with bionic arms ,no pain, with a sniper rifle at medium range and a lvl 20 shooter, you would have the estimated probability of 60-80% of hitting a target in cover, yet if he had no cover it would be 100% unless there was darkness

AtomicRavioli

Quote from: Jdalt40 on October 02, 2016, 11:53:08 AM
It takes into account;

-The health of the person shooting
-Cover
-Light levels right next to victim
-Shooter's base accuracy, impacted by health, traits and skill
-Distance
-Base Accuracy of the weapon

So if you had a careful shooter with bionic arms ,no pain, with a sniper rifle at medium range and a lvl 20 shooter, you would have the estimated probability of 60-80% of hitting a target in cover, yet if he had no cover it would be 100% unless there was darkness

Target size is also a variable

14m1337

I asked the wrong way ... at least I didn't ask for the shooting thing. It's still all about the sandbags ...

let's say every value stays the same (even the distance attacker to target), except the distance to sandbags.....
E=enemy, o=empty space, x=sandbag, P=pawn

1) EooooooooooxP
2) EoooooooooxoP
3) EooooxooooooP

logically, one would say that in cases 1) & 2) P would receive a bonus from the cover that the sandbags provide. in case 3) noone should receive a bonus.
Quick_Silver - The One And Lonely
My posts may sometimes be filled with (sarcastic) humor - it's up to you to find it out on your own.
Usually drunk on Mondays from 21:00 to 03:00 CEST.

Facepunch

 I believe that in only case 1 do the sandbags provide cover to pawns. I'd imaginethis is explained by the pawn being prone or crouched against the sandbags, and when he moves away he stands up

mabor0shi

#9
in-game Learning Helper says "Cover only works if your colonist is touching it, and it is between your colonist and the enemy." /exact quote
edit presumably, this means:
1) EooooooooooxP  x=60%
2) EoooooooooxoP  x=0%
Cool Mod, Bro Everything in RimWorld doesn't have to be either brown or grey anymore: Now you can Pick a Color!

14m1337

Quote from: mabor0shi on October 06, 2016, 09:52:37 PM
in-game Learning Helper says "Cover only works if your colonist is touching it, and it is between your colonist and the enemy." /exact quote
edit presumably, this means:
1) EooooooooooxP  x=60%
2) EoooooooooxoP  x=0%

tyvm !
is it possible that this chapter is new in A15 ? can't remember this in A14 tutorial, and I never used the A15 one
Quick_Silver - The One And Lonely
My posts may sometimes be filled with (sarcastic) humor - it's up to you to find it out on your own.
Usually drunk on Mondays from 21:00 to 03:00 CEST.

mabor0shi

Quote from: 14m1337 on October 07, 2016, 04:00:55 AM
Quote from: mabor0shi on October 06, 2016, 09:52:37 PM
in-game Learning Helper says "Cover only works if your colonist is touching it, and it is between your colonist and the enemy." /exact quote
edit presumably, this means:
1) EooooooooooxP  x=60%
2) EoooooooooxoP  x=0%

tyvm !
is it possible that this chapter is new in A15 ? can't remember this in A14 tutorial, and I never used the A15 one
oops, sandbags do 65% cover, not 60%. i was goin off my unreliable memory.
Mr. 14m1337 (i hope i'm pronouncing that right :P ) u forget there was no in-game Learning Helper in A14. It's new to A15. The tutorial is, too. Thanks for makin me feel useful!
Cool Mod, Bro Everything in RimWorld doesn't have to be either brown or grey anymore: Now you can Pick a Color!