Ludeon Forums

RimWorld => Releases => Mods => Outdated => Topic started by: sir q on January 29, 2017, 10:36:12 AM

Title: [A16] Riot Shield
Post by: sir q on January 29, 2017, 10:36:12 AM
Riot Shield

(http://i.imgur.com/dvmX2ws.jpg)

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.

(https://s3.amazonaws.com/grapher/exports/ksfybua0ey.png)

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
Title: Re: [A16] Riot Shield
Post by: Lennbolt7 on January 29, 2017, 04:13:35 PM
Any chance for a non steam download?
Title: Re: [A16] Riot Shield
Post by: sir q on January 29, 2017, 04:36:13 PM
Dropbox link added
Title: Re: [A16] Riot Shield
Post by: Lennbolt7 on January 29, 2017, 05:11:13 PM
Thanks!
Title: Re: [A16] Riot Shield
Post by: TerrorThomasCao on January 29, 2017, 05:52:52 PM
Just asking, but does the shield take percentage decreases each time it blocks a shot?
Title: Re: [A16] Riot Shield
Post by: 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?
Title: Re: [A16] Riot Shield
Post by: JaxelT on January 29, 2017, 08:59:28 PM
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.
Title: Re: [A16] Riot Shield
Post by: sir q on January 30, 2017, 09:23:34 AM
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.
Title: Re: [A16] Riot Shield
Post by: Razzoriel on January 30, 2017, 03:14:39 PM
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.
Title: Re: [A16] Riot Shield
Post by: rogerbacon on January 30, 2017, 08:16:04 PM
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.
Title: Re: [A16] Riot Shield
Post by: Dreamy on February 11, 2017, 07:46:26 AM
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! (http://imgur.com/a/vpr2h) (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>