[A16] Riot Shield

Started by sir q, January 29, 2017, 10:36:12 AM

Previous topic - Next topic

sir q

Riot Shield


Summary & Details
Manufacturable, equippable riot shields which dramatically improve pawn survivability at the cost of -5% workspeed, -0.05 movespeed and the inability to use rifles.

Shields have a chance to block based on their percentage health, according to this formula.



Compatible with Vanilla and Combat Realism.

License & Code
Coming Soon.
Thanks to the High Caliber mod for providing the starting point with its ballistic shields.

Download & Subscribe
http://steamcommunity.com/sharedfiles/filedetails/?id=852412886
https://www.dropbox.com/s/zn5sz8f5dzfvd9r/RiotShield129170231.zip?dl=0

Lennbolt7

Any chance for a non steam download?

sir q


Lennbolt7


TerrorThomasCao

Just asking, but does the shield take percentage decreases each time it blocks a shot?

rogerbacon

Very nice mod.
I'm curious though where the game calls your code. I've looked at some mods and it seems altered functionality is injected by short-circuiting existing method calls. Your code doesn't have that. How does the game know when to call your code?

JaxelT

Quote from: rogerbacon on January 29, 2017, 08:53:47 PM
Very nice mod.
I'm curious though where the game calls your code. I've looked at some mods and it seems altered functionality is injected by short-circuiting existing method calls. Your code doesn't have that. How does the game know when to call your code?
What you're referring to is a detour. This mod doesn't use any detours because it doesn't alter any functionality. Riot shields add new functionality, and this functionality is determined by the Apparel_RiotShield class. The actual riot shield items have their thingClass set to Apparel_RiotShield, so the existing method calls know to look there.

sir q

Quote from: TerrorThomasCao on January 29, 2017, 05:52:52 PM
Just asking, but does the shield take percentage decreases each time it blocks a shot?
Yes - the shield takes as much damage as the pawn would have taken (rounded up to at least 1 per hit). Above about 40 damage in a single hit, the shield scales to take a little more damage than the pawn would.

Quote from: rogerbacon on January 29, 2017, 08:53:47 PM
Very nice mod.
I'm curious though where the game calls your code. I've looked at some mods and it seems altered functionality is injected by short-circuiting existing method calls. Your code doesn't have that. How does the game know when to call your code?
Quote from: JaxelT on January 29, 2017, 08:59:28 PM
What you're referring to is a detour. This mod doesn't use any detours because it doesn't alter any functionality. Riot shields add new functionality, and this functionality is determined by the Apparel_RiotShield class. The actual riot shield items have their thingClass set to Apparel_RiotShield, so the existing method calls know to look there.

JaxelT is correct. I extend the abstract Apparel class and create a new class of type Apparel_RiotShield. Since my class extends from Apparel, the core code knows my code will implement a set of Apparel functions, and it can call them when needed - particularly CheckPreAbsorbDamage, AllowVerbCast and DrawWornExtras.

Razzoriel

Can we have curves injected into the xml to mess around with blocking chances? I'd be interested in using curve labels to assign different block values to different shields.

Also would be very interested in a functionality to add a tag to each weapon which is two-handed or not.

rogerbacon

Thank you JaxelT and Sir Q. I missed the thingClass in the xml file and the fact that apparel has a CheckPreAbsorbDamage as a method. It is all clear now.

Dreamy

#10
It's all nice, but it's not possible to store a riot shield in a stockpile. It's not in items or apparel categories.
Riot Suppression Squad inbound! (I've made a little retexture to fit my tiger camouflage theme.)



edit: If you just add this to the defs, it will become visible in the items tab in storage settings. It can't be hauled, through.
    <thingCategories>
      <li>Items</li>
    </thingCategories>