Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Commit

Permalink
Development (#240)
Browse files Browse the repository at this point in the history
* Armor penetration fix

Fixed XML errors, armor penetration using wrong values. Added support
for pawn natural melee verbs to have armor penetration.

* Renamed folder

Renamed CombatRealism project folder to CombatExtended, improved armor
penetration algorithm to account for multiple melee verbs on pawn

* Melee error fix

Fixed some faulty logic in armor penetration code causing needless error

* Initial melee verb updates

* Embrasures experimental fix

Implemented experimental fix for embrasure AI problem and fixed
suppression.

Also unsquishified human torso, removed pointless second backpack, added
armor penetration to blunt melee weapons, rolled back loadbearing gear
sprites to original

* Melee Balance

* Ammo tweaks

Reverted Skyarkangel's changes to fragmentation
Added fragmentation effects to all rockets
Reverted Skyarkangel's changes to charge shot

* Oops.  Typo fixing

* Building damage tweak and more typo fixing.

Reduced building damage from explosives
I am an idiot.  Must test more.

* Turret Recipe fix

Add auto turret recipes and researches
Fix carry weight
larger magazine sizes on M240 and blaster rurret

* merge stuff

* Low-range hunting based on BodySize, pellet rework

Pellet destinations are now calculated using just the mechanical
randomization - one initial pawn-dependent calculation is done, then all
calculation uses just a single random factor.
Hunting job ranges are now directly proportional to hunted pawn body
size.
A typo in RightTools.EquipRightTool was fixed.

* "label (quality) {ammoSet}" format and reload upon ammoset change

All ammoSetUsers (including bows) now have their ammoSet's label added
to the end of their label, e.g "Pistol (normal 97%) {9x19mm Para}".
Changing ammoSets on any ammoSetUser now reloads the weapon. Changing
ammoSet to the current ammoSet only reloads if the weapon is not
completely full. Reloading the ammoSetUser when it is full does not
trigger an actual reload.

* Animal tweaks

Fixed research def typo
Tweaked animal armor piercing ratings
Added natural armor group to appropriate bodyparts in
Bodies_Animal_Quadruped

* Added Debugger release mode to quickly get debug-able builds out.

Some customized build settings that help me quickly get a debuggable build up and running (with breakpoints and stuff).  With CR I would waste quite a lot of time getting this setup on each branch I worked on.  I hope this doesn't step on anyone's toes.  I'm not overly familiar with the different settings.  Decided to make this a separate commit so that it might be easier to chop out later if need be.

* Fixed NullReferenceException when non-player pawns look for weapon.

This was similar to what I did in Combat Realism.  Basically when CE was looking for a gun with ammo nearby CE had assumed that all weapons in the list were ammo users (ie ranged).  By limiting the list of weapons considered to ranged weapon the NRE is avoided.

Also added a failover so that if a pawn cannot find a ranged weapon (with ammo) they will grab a melee weapon, assuming it met their other criterion besides being ranged.

It looks like the issue that popped up after this in CR didn't in CE :) which is that prisoners would get stuck in an infinite loop trying to grab a weapon they couldn't path to and could starve.

* Fix null dutyDefToSubNode error when new pawns visit.

This is the fix that doesn't make any sense to me if defined non-abstract defs are inherited.  Simply copied the new file from Core as it defines a ThinkTreeDef which is referenced by Humanlike.xml (LordDutyConstant).

* Fixed error when dropping minified thing from gear tab.

When a pawn has an empty loadout they can carry anything in their inventory.  If a pawn picks up a minified thing and then later the player hits the drop button on that thing, the error which no longer comes up was:
Verse.Pawn_InventoryTracker container tried to drop <thing> which it didn't contain.

The issue was that the gear tab shows the non-minified thing (which is probably good) but drop tried to act on that non-minified thing.

The fix was to check if the thing being dropped could be minified, if it can then search the current inventory for an item which contains the thing player tried to drop.  Used Thing.ThingID to identify.

* Fix for warden stuck in a loop giving/taking prisoner food...
If the food is in the warden's loadout and they want it to fulfill their loadout with it.

Tried using a predicate this time, hopefully avoided logic flaws and increasing readability from when I tried to do this in CR.

Basically (the goal is) if the pawn is of player faction, the item is nutritional, and the item is in a prisoner then the thing is ignored by a pawn trying to fulfill their loadout.  Reasoning is that you can't haul food from a prisoner's room.

Didn't add "using System;" at the top of the file for just one additional item...

* Enhancement: Weapons a player can't get aren't shown for loadouts.

This is a pretty minor and almost cosmetic alteration (also one I've done in CR).  The idea is if a weapon is one that a player's pawn can't get their hands on, don't show it in the loadout configuration.

I used menuHidden property as the deciding factor but I suppose dropOnDeath would work too.  Generally speaking menuHidden weapons are those which are on turrets, in the hands of mechanoids, or otherwise not meant for player's pawn's use.

I decided to toss this check onto melee weapons as well, though the situations where this is apt seems REALLY uncommon.

* Enhancement to make loadout slots unique (per def).

I didn't really test this in CE (just realized) but in CR things could get weird if you had 2 slots tracking the same thingdef (ie 2 pistols in loadout).

The idea is when a new slot is added to the pawn's loadout a check is done to see if that thing (def) is already being tracked by their loadout.  If it is then the existing loadout has it's count incremented, if not then the new slot is added to the loadout as usual.

* Feature: Add minifiable things to loadouts.

With the addition of caravans and especially with certain mods that add new camping gear it has become somewhat desirable (to me) to include minified things into a loadout.

This touches bits that a lot of things use (loadout system) and when I added this to CR it caused a fair number of problems which I think I managed to find pre-merge.  I'm still not the most comfortable with C#...

* Inventory stats, tac vest rendering

Rolled back to A13 implementation of inventory stats because new one
wasn't working properly.

Also started work on fixing the tac vest rendering over pawn apparel.
Currently works in all cases except where pawn has shell apparel.

* Remove broken file

* Added mod menu

Added mod menu powered by HugsLib

So far includes a number of cosmetic options and an experimental no-ammo
mode, essentially reverting the ammo system to pre-A13 behavior.

* Merged TacVest fix

Manuallly merged draw height fix by ProfoundDarkness

* Backpack fix

Extended tac vest draw height fix to backpack. Also fixed def error
causing backpack and tac vest to occupy the same slot.

* No ammo hunting fail and projectile height/impact overhaul

Hunting jobs fail when there is no ammo left in the weapon.
Impact heights are now a FloatRange to support height-increasing edifice
such as sandbags.
Projectile code has been revamped so it doesn't have negative heights
anymore, projectile trajectories are much and much more reliable due to
all calculations being based off of a float startingTicksUntilImpact as
opposed to an integer one. ticksUntilImpact is still integer.

* Removed logging from last commit

* Remove hold fire mode

Removed hold fire mode as vanilla now has equivalent functionality.

* New suppression algorithm

Changed the way suppressed pawns choose cover positions to run to.
Should reduce extreme sillyness such as running out of a room to the
other side of a wall.

Also fixed Mechanoids having too little carrying capacity for god knows
what reason.

* Misc cleanup

Removed unused or unneeded code

* Fragments rebalance

Halved fragment numbers across the board, buffed damage to compensate.
Also squashed some bugs.

* Hit height calculations

Added experimental hit height calculation for pawns, so pawns taking
cover behind sandbags won't get hit in the legs and such.

Also tweaked shotgun stats and fixed a bug with damage types with
spreadOut set to true only calculating armor once.

* Armor tweaks

Tweaked various armor/armor penetration values, warg stats, also changed
aiming system to target center mass against pawns in the open

* Add armor to animals and more ammo types

First pass on animal armor
Added 25mm grenade, .338 Lapua Magnum, .50 AE, .500 S&W, FN 5.7, and
5.45mm Soviet ammo types.

* Fixed VisibleAccessory apparel issues on downed/bedded pawns.

Also added a tidbit of remarked code should there end up being a visible head accessory though I didn't want to try and refactor all the code without something to test it against.

* Modified DrawnWornExtras to reduce branching and assignments.

Some of the changes include the fact that wearer.Spawned returns false if a pawn is being carried or is dead so was able to chop some parts out there.

Some additional code to handle moving some features into xml and expand capability towards Apparel_VisibleAccessory on the head.

The xml part hasn't been done as of this time and the mod is in a position to have that attempt and added feature chopped out easily while retaining the new logic.

* Heavily modified Apparel_VisibleAccessory.

Functionally it should work the same where visible accessories are above the shell layer but below head layer in all situations where it would draw such an accessory (when a pawn is not dead and not being carried for example).

Tried to reduce assignments (since I don't know how expensive some were) as well as branches in the code while retaining the logic that was present before.

There are now several constants as well as updated reference relating to different layers to aid in maintenance without having to dig through decompiled code. Proper altitude layers are consulted for different states of the pawn.

New workings - Apparel_VisibleAccessory is no longer abstract class, instead a new xml field "order" has been defined with a range of 1 to 4.  The upper bound may change pending further tests.  Apparel_VisibleAccessoryDef class handles the order and a helper function to clamp the value.  If order goes unclamped things could get weird looking.

'removed' Apparel_Backpack and Apparel_TacVest classes.  They aren't deleted but just disabled from being used in compile.

GetAltitudeOffset method functions similar to the old non abstract extended classes though now that various offsets are known it was less useful to extend the class.  This makes use of the order in the def and decides if a particular offset should be used.

New functionality (currently disabled pending testing/development) to add VisibleAccessory headgear.  Avoid using until this code path can be tested/developed further.

New helper property: onHead uses a cached dictionary of results.  How it works is if a value is not cached for a given def then for every body part that the apparel covers the bodypart parent is inspected until either the torso or head is found.  From that we know if the apparel is on body or on head and thus which offset to use.

* Squad AI start

Started work on new squad AI. Misc bugfixes.

* Suppress/Hunker mote WIP, projectile fixes

Projectile fixes:
Added a few get methods like Seconds, Ticks for projectile height
calculations.
Ensures that the projectile runs from 0, 1, 2, ... , n-2, n-1, n,
StartingTicksToImpact with n = IntTicksToImpact =
Mathf.CeilToInt(StartingTicksToImpact).

Suppress/Hunker WIP:
Added a very WIP version of motes being thrown upon
suppression/hunkering.

* Removed a lingering debug message.

* Added missing flag.

* Address issue #43 and add an optimization...

Attempt to address issue #43 as well as add in an optimization which should mostly improve frag grenades.

* Animal rebalance

Complete rebalance of animal body part coverage, size, health scale,
combat stats and armor.

Added new raceProperty bodyType to replace old hardcoded list for hitbox
calculation.

Fixed bug with projectiles spawning at 0 height

* Weapon range rebalance

Reverted ranged weapon stats to A13 values.

Introduced new range formula:
range (c) = effective range (m) ^ 1/1.55

* Fixed XML errors

Fixed some improperly set XML values

* Tried to clean up gitignore

Mostly removed old CombatRealism entries.  Also added an ignore for the obj directory as that should be generated on compile.

* Applied potential optimization for frag grenades.

This is similar to what I added when I was trying to figure out why frag grenades weren't hurting pawns. I added an exclusion of Projectiles and Motes from the list of things being considered for interception by projectiles.  Unlike at end of projectile lifetime where I could see hundreds of unnecessary objects being checked for collision this cuts the number of objects down by around 5 to 8 per projectile/tick.

Before the optimization I introduced I got significant hitching on grenade explosion and at the end of most of the projectile's life.  Now pretty much just on grenade explosion (the spawning of the projectiles I think).

Overall (including the optimizations before I looked at the related code) I don't think I'll avoid grenades so much anymore.

* Addressed NRE when pawn tries to swear with null map.

* Switched to proper build mode.
Forgot to switch off of debugger mode and clean up before previous commit.

* Suppression mote work

Finished work on new suppression mote, fixed mote showing at
inappropriate times.

Also fixed some more animal XML errors.

* Armor system refactor

Completely redid the armor system, should be much smoother and less
prone to bugs now.

Disabled body height targeting as it was buggy, seems to have issues
with enemies that don't have all their heights defined in BodyDef (e.g.
Centipede)

Misc bugfixes.

* Initial AI Commit (#71)

* Initial AI Commit

* Initial Commit

* IntialCommit

* Harmony patch comp tended (#75)

* Harmony CodeProcessor Patch Verse.HediffComp_TendDuration.CompTended
Goal: Reduce randomness when treating wounds.
Target constants -0.25f and 0.25f in line this.tendQuality = Mathf.Clamp01(quality + Rand.Range(-0.25f, 0.25f));

* Undid a change I made to compile...

* Injury rebalance

Rebalanced injury scarring and infection mechanics, as well as hediff
infection, scarring rates. Increased organ bleed and scar rates.

Added soft armor distinction when calculating armor damage. Added 45 day
delay to crashed ship event (same as mech raids). Purged some unneeded
code. Misc bugfixes and rebalance

* Projectile physics refactor + minor bugfixes

- ProjectileCE.Launch() now takes shotAngle, shotHeight, shotSpeed and
the new shotRotation (which is an angle in degrees between the shooter
and the target).
- An additional parameter for minimal collision distance was added for
the time being.
- Explosions can now spawn at different heights and fragments are
ejected in a sphere around the center.

Detours_PawnEquipmentTracker now checks whether primaryInt is null
before checking whether PrimaryEq is null - it was possible to start an
attack twice with grenades and cause an error when the second warmup
finished and no grenades were left to throw.

* Scar removal

Added surgery option to spend glitterworld meds on scar
reduction/removal.

Started work on stabilizing bleeding.

Changed body part armor to use a base value depending on health scale.
Also removed soft body parts ability to deflect sharp attacks.

* PR#79 Manual merge

Manually merged AI changes

* Fixed unable to drop from pack animals. (#81)

Issue #69
Basically lifted some code from Rimworld so can also drop items from prisoner inventories now too.

* Fixes for #45 and #64 along with addition of Rimfire ammo sets.

- The loading table is now evaluated whenever modsettings ammo is
enabled/disabled.
- All ammo sets from Rimfire (.22 LR, 56-56 Spencer, .500 S&W) were
added.
- All ammo now is menuHidden and destroyOnDrop by default.
- Loadouts now ignore any menuHidden things.
- Weapons without a magazine are now handled correctly and actually
don't error + play the sound on their last shot.

* Fix for #70

Pawns now take into account their loadout while UnloadInventory is being
processed.

* Stabilize bleeding

Pawns with medicine in their inventory can now be ordered to stabilize
bleeding pawns. Uses one medicine per pawn and temporarily reduces bleed
rates on all non-missing body parts. Overall reduction is based on
doctor skill and medicine potency and decreases over time.

* Painkillers

Added two painkillers, non-addictive paracetamol and addictive but
stronger methadone. These provide a negative pain offset to remove pain
from chronic injuries. Craftable at the drug lab after researching
medicine crafting.

* Issue 46 (Nothing loadout unchangeable, copy/clone loadout) (#83)

* Partial Issue 34 - Nothing loadout cannot be edited.
This was low hanging fruit for me and helped me get to know a little more about the loadout system as a whole.

I make the assumption that the default flag is only on the Nothing loadout.  So from there just don't show the Nothing loadout in the edit interface.

Additionally I had to make some changes to the AI system to compile.

* Added Loadout Copy feature.
So now when a player is in the loadout configuration screen and they are on a loadout they can hit copy and have a new loadout generated based on the current loadout.

Modified Dialog_ManageLoadouts to support the new button (and the 2 lines of code that make it work).

Modified MapComp_LoadoutManager to add a method overload to generate a unique label from a given string.

Modified Loadout and LoadoutSlot to support a Copy() method and a static Copy(object) method to handle making copies.

* Fixed animal inventory drop issue.

* Add dll files to gitignore

Because github throws a fit whenever two people recompile it

* Issue 46 take two (#92)

* Partial Issue 34 - Nothing loadout cannot be edited.
This was low hanging fruit for me and helped me get to know a little more about the loadout system as a whole.

I make the assumption that the default flag is only on the Nothing loadout.  So from there just don't show the Nothing loadout in the edit interface.

Additionally I had to make some changes to the AI system to compile.

* Added Loadout Copy feature.
So now when a player is in the loadout configuration screen and they are on a loadout they can hit copy and have a new loadout generated based on the current loadout.

Modified Dialog_ManageLoadouts to support the new button (and the 2 lines of code that make it work).

Modified MapComp_LoadoutManager to add a method overload to generate a unique label from a given string.

Modified Loadout and LoadoutSlot to support a Copy() method and a static Copy(object) method to handle making copies.

* Fixed animal inventory drop issue.

* Added ability for pawns to fulfill loadout needs from animals.
Also from prisoners...

Modified JobGiver_UpdateLoadout to look inside inventories of other pawns on the same map as the pawn with the loadout missing items once the other two item searches fail.

Added a new JobDriver TakeFromOther which handles the task of getting the pawn to the pawn with the item they want, reserving it, a brief pause and then taking the item.

If the item being taken is flagged to be equipped then uses CE's code to swap the item from inventory to equipped.

* Did a little touch up and testing...
Tried to limit how many pawn inventories are checked.
Also tried to use Pawn.inventory.GetInnerContainer() method instead of Pawn.inventory.innerContainer field following a suggestion that the field was probably intended to be private.

My knowledge of how things get optimized in .net is still very basic so not sure if what I did to limit the inventories checked helps or if it ends up neutral.

Basically after both searches of the map come up empty for an item it will now locate all pawns on the same map which are either pack animals of the same faction as the searching pawn or prisoners hosted by the same faction as the searching pawn... as long as their inventories are not empty.  It will then try to fetch an item which matches the desired def much like if it found a hit before.

* Taunt cleanup

Culled a bunch of taunts that were silly, situationally inappropriate or
otherwise gave reason for removal.

Adjusted blood loss consciousness penalty slightly to avoid magic
numbers.

Started work on rebalancing calibers added by High Caliber mod.

* Combat role determination

Added framework to determine whether a Pawn can do a specific combat
role for SquadBrain.

* Rebalance ammo added by High Caliber mod

Rebalanced ammo types needed by High Caliber mod patch.

Added AI tags to all the vanilla weapons as appropriate.

Fixed a bug with determining whether a pawn can fit the assault role.

* Kbatbouta development (#98)

* Initial AI Commit

* Initial Commit

* IntialCommit

* AI Prefomance Debugging

* PathFinding Fixed and Performance improvment

* Baisc commit

* Faction Brain

Implemented basic framework for FactionBrain, ready for further work.

* Squad ThinkTree hook

Added hook for SquadBrain into ThinkTree, pawns should now take orders
from squad if they have one.

* Fixed #82 and some JobGiver errors, added fragments to rockets

- Individual droppods for Scenarios_Classic now contains the correct
ammo type for each weapon
- A Fragment_RocketFrag was added for vanilla one-use rocket launchers
- fragSpeedFactor was added and grenades now have slower fragments than
other explosions
- CE_Utility.VerticalHeight now uses the actual min/max values for
FloatRange (Trench framework)
- CompAmmoUser now also has the bool checks hasAndUsesAmmoOrMagazine,
hasAmmoOrMagazine, canBeFiredNow and these are applied where appropriate
- projectileCE.canTargetSelf was added so fragments can hit their
shooter while projectiles can't (friendly fire)
- projectiles which collide instantly will call ImpactSomething()
earlier
- ProjectileCE.origin is always saved
- FreeIntercept now checks whether the cell is in bounds where it first
did not in very specific cases
- projectile height is now correctly updated and more often
- ThingsListAtFast is now used when we already know the cell is in
bounds
- List.Distinct() is now used to filter out duplicate pawns in intercept
calculations
- Reloading is now checked for using canBeFiredNow and hasAmmo

* CompInventory tiny fix

* XML fix

Fixed up some errors with AI XML setup

* Merge pr/101

Manually merged pr/101

* AmmoSet Refactor

AmmoDef no longer contains linkedProjectile. AmmoSet now contains
AmmoThing->Projectile pairings. Ammo defs reorganized into caliber-based
file groupings. Still need to rework description for ammo things as
simply displaying linkedProjectile stats no longer possible.

Added painkiller graphics.

* Learning concepts

Added learning concepts to explain various CE mechanics.

Renamed stats aim efficiency -> sights efficiency, shooting accuracy ->
weapon handling for more clarity.

Fixed various long-standing bugs, including GiveInjuriesToKill, turrets
missing shot report, Hediff error on world gen.

Increased blazebulb ingnition temperature to 28°C

* Stabilizing Pt2

Fixed broken stabilizing mechanic and added tutor concept.

* Ammo descriptions

-Added stats of all ammo types to gun info box. Now shows readout with
stats of all ammo types in caliber when fired from this gun.

-Re-enabled ammo class description appending to ammo info box. Also
added list all guns using this ammo to description.

* Ammo cook-off

-Added new cook-off mechanic. Small-arms ammo now spawns low-velocity
projectiles that fly off in random directions when taking damage.
Grenades/shells can randomly detonate.

-Added deterioration to ammo. Needs testing to see if this leads to
storage problems.

-Potential fix for fragment low hitrate. Adjusted launch angles and
fixed vanilla collision detection being used in tandem with new CE one,
as well as a bug with collision check canceling out too early.

* Loadout overhaul generics + HoldTracker concept. (#105)

* Added Generics to LoadoutSlots...

LoadoutSlots come in two flavors, those with a thingDef property (that's not null).  These are Specific in that they point to a particular item.  These are pretty much good old LoadoutSlots from before.

The new one has a property of genericDef which stores a few details connected to generics and to make things a little easier in the code by hiding some of what a generic is when it doesn't matter.  The key property of a Generic is it's lambda which is a Predicate<ThingDef> that defines the types of items that it covers (will try to pickup/drop).

Another new property of LoadoutSlots is the LoadoutCountType (enum) which has 2 states currently, PickupDrop and DropExcess.  At the moment this property is always available for a LoadoutSlot however it only really comes into play currently for Generics.  PickupDrop means the slot will try to fill a request as well as drop extras while DropExtra means ignore any amount of a matching item up to Count and then start dropping.

The behavior between Specifics and Generics are:
-When picking up: Specifics are deferred to first while maintaining Loadout Slot order.  If the sum of all items that fit specifics covered by the generic are less than what the generic wants, more are picked up.  If all the specifics add up to more than the generic, nothing happens.
-When dropping: Handling is currently incomplete as it still only considers one thing at a time and Generics need to consider multiple things...

The coverage idea behind mixed specifics/generics is that if you want a specific Item that may not be available the generic can fill the space.  Then later when the specific item becomes available the pawn fetches the specific and if the total count falls under the generic it may drop something the generic had picked up.

The other big concept of generics is to cover things where a pawn might automatically fetch something such as a meal (pawns like to keep one on hand), some raw food (to train an animal), or some drugs (to fill a drug policy).  By default those are DropExcess.

I've still got a few more things to sort out for Generics.  This includes a few bits for HoldTracker as well, currently in a separate file to keep it easier on me.

* Added HoldTracker concept as well as finishing most of Generics.
At this point the code is mostly done.  There are a few things that still need/would like to have done but it's functional and what is there is ready for further testing.

LoadoutSlot-Specific is a ThingDef and count.  Just like it used to be and there should be very little changed in functionality here.

LoadoutSlot-Generic is a genericDef with count and countType.  The genericDef basically has a lambda expression indicating what ThingDefs should get caught up by the slot.  A single slot can cover multiple items.  The count functions just like LoadoutSlot-Specific except there can be more than one ThingDef being counted.  countType indicates if the slot should try to pickup items or if items should only be dropped when in excess.

Unlike my first attempt all slots attempt to be fully filled so if there are only FMJ pistol rounds and you have a Specific slot looking for 10 and a Generic Pistol Ammo slot the pawn will try to collect 20 rounds.

The HoldTracker is a new concept which is surprisingly similar to the old LoadoutSlot system.  Basically if a pawn is instructed to pick something up and they have a non-empty loadout defined then the HoldTracker remembers ThingDef and count.

The HoldTracker functions vaguely like a LoadoutSlot-Generic set to DropExcess in that it won't trigger any pickups but will drop excess after all LoadoutSlots have been considered.

Additionally updated Harmony (It's not expected this will change in interface significantly) and modified the existing Harmony code to try and act as a guideline for how new patches should be done.  There are still some questions I haven't figured out but for MOST cases I've got a decent understanding of Harmony now.

* Some fixes and changes to the system.
Notably no more issues about generics that overlap.  In fact no issues with any LoadoutSlot that overlaps (so technically a user can add duplicate ThingDef slots if they wanted, though code prevents that still).

* Finished up finding the really obvious bugs.
Handing this over to testers/others to find/report bugs.

I don't expect to change the interface further.

* Post merge compile error fix

* Added new JobDriver_UnloadYourInventory and worked on Loadouts. (#106)

* Added new JobDriver_UnloadYourInventory and worked on Loadouts.
JobDriver_UnloadYourInventory:
-Disabled (but not removed) JobDriver_UnloadInvetory.  I don't know but I think this JobDriver was created for Issue #70 and if so was the wrong target.
-New JobDriver asks HoldTracker for information about what to drop.  Trying to keep drop code centralized for easier maintenance.

Loadouts:
-Loadouts not saving/loading properly.
-Moved some of HoldTracker's methods into LoadoutManager class as that gets instantiated which is necessary for saving.
-Altered HoldTracker's structure to be a Dictionary<Pawn, List<HoldRecord>> instead of Dictionary<Pawn, Dictionary<ThingDef, HoldRecord>> to make it a bit easier to save.
-Modeled HoldTracker saving off of LoadoutManager saving (dictionary to list and back again).
-Altered segments of code which had used Dictionary<ThingDef, HoldTracker> to work with List<HoldRecord> as well as logic where apt.
-Tried to speed up JobGiver_UpdateLoadout by skipping to the next LoadoutSlot sooner.  Also some alterations there in relation to above/bug fixing.
-Renamed HoldTracker class to Utility_HoldTracker to fit with the theme shift of moving some elements of the concept to LoadoutManager.

* Turned off Harmony debugging

Forgot to do that before PR.

* Tried to clean up from recent activity of PR #105 #106 (#107)

Mostly fixed up/added remarks/regions but also removed code which was verified as part of previous attempt at issue #70.

Said code had been disabled since I wasn't sure it should go.

* Issue 64 completed. (#108)

Started out with an idea to help someone else tackle this issue and stumbled on a way to just do the issue myself.

Basically, using Harmony and Infix, replace the Constant in GenRadial named RadialPatternCount as well as the -60/60 values in the two early loops inside SetupRadialPattern method.  The rest is handled by RimWorld logic.

Be warned that large radius values may be allowed but if the loops are still too small it won't look right.  Tried to constrain the range kept to keep things looking OK.

Also updated Harmony since I make use of features which received a bug fix.

* Fixed an error in Update Loadout JobGiver.

Got a little over attached to that subtraction...

* All CEVerb weapons that use ammo should do a reload before warmup. (#109)

* All CEVerb weapons that use ammo should do a reload before warmup.

Took some time to find the interesting point where a pawn switches from trying to shoot to the warmup but finally found it.  From there did a Harmony Hybrid Infixed Prefix (functions like a Prefix but is Infixed).

The infix patch passes the instance verb into a needs reload check.  If the check returns false that means there was work to do (yeah, backwards) and the pawn shouldn't enter the warmup stance.  If true then either it wasn't a gun with ammo or it didn't need reload, the pawn enters the reload stance.

Thanks to whoever created/maintained the CompAmmoUser.TryStartReload() as I had no idea how to get turrets reloading and that just handled it for me.

Also includes some side fixes related to loadouts.

* Forgot to turn off Harmony Debug again...

* Misc additions (#110)

* Misc rework

-Slightly tweaked suppression variables. Increased threshold, decay
rate. Could probably use some more tweaking.

-Added back SwayAmplitude for Verb_ShootCE. Need to clarify why this was
removed.

-Added cook-off to hand grenades

-Added stick bomb grenade type

* Suppression traits

-Added suppressability stat to pawns to determine how vulnerable to
suppression they are.

-Added traits that modify suppressability and also made GoJuice and Yayo
lower suppressability.

-Added stick bomb recipe

* Disable cookoff in inventory

Disabled cookoff for despawned (e.g. carried in inventory) ammo or cases
where damage is absorbed.

* Issue 21 (#111)

* All CEVerb weapons that use ammo should do a reload before warmup.

Took some time to find the interesting point where a pawn switches from trying to shoot to the warmup but finally found it.  From there did a Harmony Hybrid Infixed Prefix (functions like a Prefix but is Infixed).

The infix patch passes the instance verb into a needs reload check.  If the check returns false that means there was work to do (yeah, backwards) and the pawn shouldn't enter the warmup stance.  If true then either it wasn't a gun with ammo or it didn't need reload, the pawn enters the reload stance.

Thanks to whoever created/maintained the CompAmmoUser.TryStartReload() as I had no idea how to get turrets reloading and that just handled it for me.

Also includes some side fixes related to loadouts.

* Partial work on issue 21.
Successfully patched RimWorld using Harmony to get the calls I wanted but the actual work of determining if a target can be shot hasn't been done.

* Finished up code to get any shooting verbs to check cover.

Ended up needing to make a method in Verb_LaunchProjectileCE public so as to avoid copying code...  Don't know if this change is OK.

Also did some optimization, now it doesn't check the target's cover if the target is too far away.

* Fixed a lingering big of unused code.
From when I did the dynamicMethod directly instead of allowing Harmony to do things it's way.

* Fixed a bug in AttackTargetFinder patch code. (#113)

* Loadouts auto reload job+ (#114)

* Implemented Loadouts sorting.

Default is always first.
All other loadouts are sorted by name string.
Loadouts are sorted before showing the user a list of loadouts.
The base loadouts list in LoadoutManager class is sorted so original creation order is lost.  Can be modified to return a new sorted list instead...

* Added some optimizations to ManageLoadouts UI.

Specifically found an optimization I forgot about for Generic Ammo so the predicate can fail out sooner.

Also spread generic testing (if there is an item on the map satisfying the generic) out over time so that in any given frame only one generic is being tested.

Also modified Generic and Specific testing to instead of finding EVERY item on the map which satisfies it it will stop on the FIRST item that is satisfied so performance should be more consistent on very busy maps rather than slowing down.

* Caused the 'Add ammo for ...' UI to give a clip's worth of ammo.

So for example a pistol which holds 7 ammo, using the float menu instead of the list will give 7 (more) ammo.

Also should ammo default counts ever be implemented, it will fall back to that (useful for arrows and the like where there isn't a clip).

* Initial addition of automatic reload after UpdateLoadout.

Pawns are now concerned about 2 things:
1 - Are any of their guns low on ammo?
2 - Are any of their guns loaded with ammo that they don't have a LoadoutSlot/HoldRecord for a clip's worth?

If either of those are true and there is enough (approved by LoadoutSlot/HoldRecord) ammo, the pawn will do a reload (and a switch ammo if necessary).

* Fixed a bug in AttackTargetFinder patch code.

* +Generate Loadout from Inventory & MoteThrower to JobDriver_Reload

New button (suggestion of button from Karim) on Pawn's gear tab which creates a new Loadout from that Pawn's inventory.  Button only shown if the Pawn has no/empty Loadout and has equipment/inventory items.

Possible refinement: Only show the button if the items in inventory are not marked by Generics that are DropExcess only.

Also moved the motethrower associated with reloading into the JobDriver and out of two other sections of code.  May throw an exception if the creator of the job did insufficient error checking.

* 3 Bug Fixes...

-A new bug due to my lack of understanding how ThingContainer.TryAdd() works caused an attempt to destroy a thing twice (basically ended up trying to add a thing to a container AND drop it on the ground).

-Fixed a bug introduced when the default loadout became non-editable.  Basically an NRE.

-Fixed a really old bug (from before I got my hands on the code) involving creating an IEnumerable from a Dictionary and then altering the Dictionary (in particular changing things so that the IEnumerable clauses were no longer valid).  When I started on this code base the Remove button in Manage Loadouts wasn't properly removing Loadouts via the LoadoutManager but rather just from the list.  Early on I changed that to what seemed more correct and exposed the bug.  Since the list being manipulated by Remove button was the same object stored by LoadoutManager it worked but pawns with that Loadout assigned weren't having their assignment changed (along with anything else LoadoutManager might have done).

* Further separated out functions of CompAmmoUser.TryStartReload()

The Unload mechanic has been separated off (CompAmmoUser.Unload()) so that it can be called on it's own though TryStartReload() still takes a bool indicating to only perform an unload.  More work necessary to finish separating that off.  Though TryStartReload does error checking that Unload() does not.

Also Unload() will drop any items on the ground that didn't fit into inventory instead of destroying them.

Added CompAmmoUser.GetReloadJob() which takes a bool indicating if the job should be flagged PlayerForced or not.  This doesn't do any error checking and expects the caller to check for errors (atm).

This also sets the storedTarget and storedJobDef to null so the caller doesn't have to do that, if they should have some object stored in them the caller can do that after getting the Job.

More to do...

* Some more tweaks on CompAmmoUser.TryStartReload.

Changed some logic around to clean things up a little.

Renamed Unload() to TryUnload().  Returns false if there is something wrong with the weapon (would indicate can't do the reload job).  Returns true if the weapon is already unloaded or if the unload was successful.

Added an warning message if the ammo was destroyed because it couldn't be dropped.

Changed GiveJob() to TryGiveJob() and modified it's logic as well.

Modified TryStartReload() so that it no longer takes a bool.  Instead those wishing to unload a weapon would call TryUnload().  Modified all in project found references to CompAmmoUser.TryStartReload(true) to instead use CompAmmoUser.TryUnload().

Testing suggests behavior has been maintained.  Turrets and Pawns, if clip is empty, initiate a reload before aiming/warmup and resume the tasks they were doing before.  Pawns will initiate a reload when not otherwise busy when their clip is low on ammo.

Untested: Ammo in a gun not equipped gets reloaded.

* Attempt to have JobGiver_CheckReload's DoReloadCheck use cache.

Cache provided by CompInventory.

Still does a fair bit of enumeration but the cache already excludes a lot of stuff so the enumeration count is smaller.

* Cleanup of remarks from mid-development

* Bug Fix + Inventory Reload guns and Reloading mote on turrets.

First, first a bug in Utility_HoldTracker, GetStorageByThingDef could try to double add a dictionary key if ammo for a weapon had already been logged in the open and more ammo was found for a given gun.  Proper key check is in place now.

Next tested attempts to reload guns in inventory (this was a requested feature iirc) and found that the code was VERY specifically built to ONLY reload equipment and not inventory items.

Added a new property to CompAmmoUser named holder which is either the existing wielder property (equipment) or the pawn's inventory that is storing the item.  Should return null if the container is not a pawn's inventory at which time can't do a reload.

Additionally JobDriver_Reload was modified to use CompAmmoUser.holder instead of CompAmmoUser.wielder.  Code paths off of that (ie CompAmmoUser.LoadAmmo()) also use holder instead of wielder now.  wielder has a very specific sense that I didn't want to break in other code that I didn't look at.

Fixed a bug (old?) in JobDriver_Reload related to waitToil not having it's actor filled and thus the StopDead() clause never triggered properly.

Modified HasNoGunOrAmmo condition check (FailOn) so that if an item started out in equipment and was moved during reload, the reload is interrupted.  Same for if an item was in the inventory but is no longer.  Additionally a check for if a pawn's equipment changes at all to interrupt the reload.

Modified the "Reloading!" Mote (now that I understand what that was doing in it's original context) to be pawn specific and doesn't care about turrets.

Added the mote throwing code from 'original' CompAmmoUser.TryStartReload() related to turrets into JobDriver_ReloadTurret.

I didn't encounter any big bugs in my narrow test of firing off a turret (pawn manned) while another pawn auto-reloads their Survival Rifle (equipment) and then Pistol (Inventory).

* Crouching

- Reduced weapon sway factor across the board. Removed 0.25 multiplier
on vertical sway amplitude. Result should be less horizontal deviation
but more vertical.

- Added new crouching mechanic: humanlikes with combat jobs will crouch
down, making them harder to hit. Pawns will crouch down so they can
still shoot over the highest adjacent cover but not below half their
standing height.

- Removed squad AI logic from ThinkTree.

* Beta 1.0 Release

Compiled latest code into a new DLL and removed CompSquadBrain from
pawns that had it in preparation for Beta Release.

* Turret sway adjustment

Forgot to change turret sway. Should be fixed now. Also tweaked turret
research requirements slightly.

* (Hopefully) Fixed a bug with HoldTracker and dropping stuff. (#119)

* Suppression tweaks

- Removed duplicate research entries
- Fixed crouch calculations not accounting for adjacent cover
- Increased suppression radius for bullets from 1 to 3 tile
- Added additional suppression on impact in a 3 tile radius around the
projectile
- Fixed bullet tree collision chance being improperly calculated
- Re-implemented 0.25 multiplier on vertical sway

* Merging

* Some tweaks to the project file now that I have VS... (#121)

Moved some Debugger (build mode) specific things into the place that VS expects it and following some of the VS form for how to do things.

Also cleaned up the Xamarin options (those that Xamarin sees).

* Fixed issue #120 (#123)

Or at least hopefully fixed #120 regarding the red error text.  Not sure about the other issues as I haven't been able to replicate.  Pawns with multiple weapons and ammo definitions seem to pick things up fine.

The issue seemed to be caused by a failure to check if the weapons in the inventory rangedWeaponCache had CompAmmoUser before trying to use said comp.

* Flakvest texture beginnings

Fat back and front, and the on-floor image are done

* Pawn auto firing issues (#124)

* Fixed issue #120

Or at least hopefully fixed #120 regarding the red error text.  Not sure about the other issues as I haven't been able to replicate.  Pawns with multiple weapons and ammo definitions seem to pick things up fine.

The issue seemed to be caused by a failure to check if the weapons in the inventory rangedWeaponCache had CompAmmoUser before trying to use said comp.

* Attempt to fix various issues related to drafted pawns auto-firing.

Issue 1: The code that inserted the call in IL was inserting it in the wrong place, breaking the key logic of the function.

Issue 2: The call to Verb_LaunchProjectileCE.GetPartialCoverBetween() had the 2nd and 3rd arguments backwards from the correct order, so was checking if the shooter had cover and if so the target was invalid (heh).

Issue 3: An older bug in GetPartialCoverBetween where the checkedCells list wasn't being updated with the cells which had been checked potentially reducing performance in all situations related to shooting.

* Couple of tweaks (#129)

* Partial fix for pawns not auto shooting targets and optimization.

Added an optimization to Verb_LaunchProjectileCE to get rid of the cell list and instead use an object with very fast access time to check if a cell has been checked before (rather than walking a list each check).

Partially fixed a bug related to pawns not shooting at targets if the target has ANY cover instead of too much cover.

Disabled the old Harmony-AttackTargetFinder_BestAttackTarget_Patch as not only was it bugged (denying targets with ANY cover) but was also the wrong approach.

Added a new Harmony-JobDriverWait-CheckForAutoAttack_Patch which replaces the null argument to BestShootTargetFromCurrentPosition() with a predicate which will validate targets via Verb_LaunchProjectileCE.CanHitTargetFrom().

* Reverted Verb_LaunchProjectileCE, Cleaned up new Harmony patch.

Used git to view an older version of Verb_LaunchProjectileCE.GetPartialCoverBetween() and undid the change I made to add a static call to that method.

Also removed the old harmony patch.  While interesting it's no longer useful.

Cleaned up Harmony-JobDriverWait-CheckForAutoAttack_Patch.cs as I was all over the map trying to figure out how to store a new local variable when it turns out all I needed was to replace an ldnull with an ldloc_s <verb> and a call to a method to generate the predicate.

* Implemented shield mechanics and ballistic shield

* Finished FlakVest set graphics

Complete set of flak jacket textures in
<texPath>Things/Apparel/FlakVest/FlakVest</texPath>

* - Implemented shield two-handed weapon restriction, added one-handed tag to appropriate weapons

- Implemented shield graphics, displays between pawn and weapon whenever weapons are rendered

- Added learning concept explaining shield mechanics

* Merging csproj file changes (thanks VS)

* Compile for new beta release

* Re-fixed the button placement on inventory and added colonist check. (#136)

Instead of putting the divider down under the button saved a copy of the key variable for use by the button before drawing the divider.

* Fixed a lingering issue with the change to AmmoLinks... (#135)

* Fixed a save/load issue (red text) on turrets, also job failure. (#134)

* Fixed a save/load issue (red text) on turrets, also job failure.

There was some red error text on save load related to turrets, fixed.

Took a fair bit of back and forth with NIA but also fixed the issue with pawns dropping out of their job when reloading a turret (basically while going to the ammo to pick it up or when returning to the turret with the ammo in hand).

* Made requested changes and a little cleanup.

-Moved the turret reloading flag into the init action delegate of the wait toil right near the mote thrower.

-Copied the instruction to go to the turret as well as reserve the turret when the ammo system is disabled.

Converted the properties for the debug string, turret, and ammo from caching getters to expression properties (VC2015 minimum required, Xamarin can handle but SharpDevelop can't).  Added back the error check on the compReloader property.

* Put the reserve back on the turret
(Cut instead of copy)

* Moved the turret reservation out of the conditional...

* Fixed a bug in the logic of what to drop from loadouts/holdTracker (#139)

* Fixed a bug in the logic of what to drop from loadouts/holdTracker

Changed how HoldTracker was used and didn't propagate that logic change out.

Issue had to do with HoldTracker could be empty and not just null.

Also cleaned up some logic that caused drop finding code to goof up pretty spectacularly if more than 1 HoldTracker record existed and the inventory wasn't 'just right'.

* Cleaned up a comment and removed an unused local variable.

* Tweaked HoldTracker user interaction.  "forced" display and clear btn. (#138)

Forced held items now show forced much like apparel (uses the same string).

Also the assign tab now has an extra button after edit loadout button which will show up if the pawn has any forced held items.  This button will clear the HoldTracker for that pawn.

* Modified motes and reportStrings for Reloading (includes turrets). (#140)

* Modified motes and reportStrings for Reloading (includes turrets).

Looking for feedback before merge, in particular regarding turrets.

-Removed "Reloaded!" mote (from CompAmmoUser).
-Added Keys (Translation strings) for motes, weapon source, and turret types.
-Modified Weapon and Turret Reload JobDrivers to use the new formatted motes.
-Added GetReport() override to generate a more detailed report of pawn activity.

Some light rearrangement and cleanup.

* Tweaked reportStrings to stick towards lower case after first word.

-Ammo still has a first word upper case but that seems to be in the label field, not from code.

* Attempted Fix Pickup-Drop Loop and cleaned up harmony patches some. (#147)

Main Focus:
-Added a HoldTracker notification to the detour of WorkGiver_InteractAnimal.TakeFoodForAnimalInteractJob.
-Modified the HoldTracker notification code to be a little more sane about how many things to hold onto.
-Removed (remark) some debug messages related to Notify_HoldTrackerJob.

Assides included in this:
-Cleaned out a bunch of debug log messages that got left behind in various Harmony patches.
-Moved some utility methods out of a specific patch and exposed them in HarmonyBase for use by any patcher.
-Added a new utility method to HarmonyBase.
-Attempted to perform the WorkGiver_InteractAnimal.TakeFoodForAnimalInteractJob modification as a Harmony patch before checking if there was a Detour (which there was).  Code is excluded from the project but the file is likely useful in the future if we convert more Detours to Harmony.

* Fix shield null ref on empty weapon tags

* Compiled for 0.2.1

* Removed basic flag from Raw Food generic

With the interact animal job talking to hold tracker now it's not necessary to have this be in the default loadouts.

* Fixed siege building wrong mortar

* Removed duplicate comp_quality from bows by removing unnecessary abstract parent (#153)

* Fixed an NRE related to generic ammo fetching for loadouts. (#156)

Surprised I didn't stumble on this sooner considering how often I've had pawns fetching generic pistol ammo but kasidoo (Discord) found this issue with Charged Rifles.

Issue was some old code from before generics assuming that all loadoutslots were thingdef based.  Fixed by referencing the found thing's def instead of the slot to decide if ingestible.

* Attempt to partially fix issue with visitors digging through walls... (#157)

to get to a player's things.

Mostly looked for logical errors, also cleaned up some code a little bit in the vicinity of the predicates I examined.  Noticed a TODO had been implemented already in the past and implemented another TODO to pickup ranged non-CE weapons.

Also fixed a bug involving the new ammolink system and non-colonist pawns looking for guns to pickup.

Testing will reveal if this is actually fixed or not but initial testing doesn't show non-hostile pawns taking stuff from the player or drilling through their base.

Hostile pawns might still do so...

* Melee overhaul (#159)

* Added melee shield

* Added melee shield Attempt 2

* Various shield fixes

- Fixed raiders spawning with shields and two-handed weapons.
- Added new mercenary shield bearer PawnKind to Outlander and Pirate factions. Has same spawn frequency as merc slasher. Uses ballistic shield and one-handed weapon.
- Added new melee shield. Can be made of wood and steel/plasteel at smithy. Provides protection against primitive projectiles and melee attacks.
- Fixed error when hunter had two-handed weapon and shield equipped.
- Added alert to warn player when colonist has two-handed weapon and shield equipped.
- Fixed bug where body part damage was being calculated incorrectly due to natural armor.

* Started work on parry system

- Partially implemented Parry Tracker (still needs ExposeData implemented)
- Created Harmony prefix for Verb_MeleeAttack.TryCastShot()
- Added Critical hit chance stat
- Fixed bug where suppression cover search wouldn't consider pawn's current region
- Added LoS checks to suppression cover search, will now prefer locations without LoS to enemy that pawn has direct LoS to
- Added preliminary implementation of flak vest
- Fixed faulty turret recipes
- Fixed heavy auto-turret research having wrong prerequisite
- Fixed issue with mortars throwing errors because of faulty charge settings

* Trying to get Harmony patch working

* Fixed Harmony patch

* Melee system finished

- Disabled Harmony Verb_MeleeAttack patch. Implemented new Verb_MeleeAttackCE class. Reason: simplicity of code, we're already overriding verbs to add penetration stats and anything detouring vanilla Verb_MeleeAttack is likely to break CE functionality.
- Added parry/dodge/crit stats to pawns
- Implemented new melee system. Pawns will parry/crit/dodge. Currently uses placeholder formulas pending design of proper ones.
- Added height check to melee attacks. Attacks now are limited to collision height * 1.2 in terms of enemy body height they can hit, so no more squirrels tearing off colonists' heads.
- Fixed hands being classed as BodyPartHeight Bottom
- Fixed bug where sometimes shooter LoS calculations would incorrectly assume target is obstructed at very close range

* Implemented an infix to change TendUtility to orderby BleedRate... (#161)

ThenBy Severity.

Basically replaced part of/all of an original LinQ statement with a new one.  So less surgical than I'd like but born of my lack of knowledge and that the simpler approach was available.

Took some study since this was the first time I really looked at LinQ in IL.  If JUST BleedRate then would have been a simple prefix patch (helps to look at the code in a crummy debugger instead of the nicely patched ILSpy).

* Fixed a couple of quick issues to fix... (#163)

To tired to remember exactly and mind is already on the next bit of work.

* Medical tweaks (#164)

* Slight medical adjustments

- Doubled effectiveness of stabilizing
- Reduced stabilizing internal injuries penalty 0.5 -> 0.2
- Increased duration of analgesics, added duration to description
- Added unfinished ammo thing to ammo/grenade crafting.
- Cleaned up dirty edits in Recipes_Production
- Fixed auto-turret having the wrong research requirement
- Fixed auto-turret being buildable through architect menu (should be crafted through machining bench)
- Slightly adjusted melee crit/dodge/parry stats to give animals less godlike melee
- Added one-handed tag to grenades so they can be used with shields
- Cleaned up some leftover logging in Verb_MeleeAttackCE

* Compiled merged changes

* Undid accidental deletion of smelting recipe changes

* Various fixes and tweaks (#167)

* Added shot report explanations

If a shot can't hit the shot report now displays the reason (e.g. target obstructed by sandbags, out of range, etc.). Also enabled pawns for cover checks. Now other pawns are considered as cover for purposes of LoS, which should cut down on the friendly fire incidents.

* Small fixes

- Slightly nerfed incendiary launcher
- Changed research projects for turrets, automated turrets has been rolled into vanilla gun turrets, heavy weapons now overrides multibarrel weapons (without miniguns the research was just a trap choice)
- Adjusted formula for aimed shot to scale with weapon's sights efficiency. Buffed sniper rifle sights efficiency 1.25->1.5. Now sniper rifles will get thrice the effectiveness out of aimed shot that weapons with ironsights do.
- Fixed some minor bugs with Verb_MeleeAttackCE

* Made destroyed internal body parts continue bleeding

* Attempted to address reload job failure to load save. (#169)

Issue #166.

Tested reloading manually, reloading equipped weapon automatically, and reloading inventory weapon.  All saves mid reload, loaded successfully.

Iterated over a few different possible solutions such as using a TargetC as a flag.  Settled on searching the Pawn's inventory/equipment via RimWorld object/properties for where the item was being reloaded from since asking for CE object properties isn't safe.

Additionally:
Swapped out references to TargetThing<Letter> with more helpful properties like holder and weapon.  Swapped out references to TargetIndex.<Letter> with more helpful properties like indReloader and indWeapon.  Both of these swaps done as it's what I've seen in other situations and generally requires less thought while maintaining the code.

Added some comments and some error checks.  The error checks have comments about how important they are to proper function of the logic vs mostly just there for if the job gets misused.

Cleaned up the fail condition (HasNoGunOrAmmo) since one of the states being checked is more appropriately handled using built in RimWorld FailOn condition.

* Fixed issue #168 (#170)

* Misc fixes

- Fixed some minor bugs
- Made it so move speed penalty from being encumbered is capped at 50% to mitigate issue with caravans overloading their muffalo

* A17 update (#187)

* Started basic refactor

* Converted old detours to postfixes where appropriate.

Still need to do infixes/update existing Harmony infixes to new code

* Refactored TurretGunCE to be up-to-date with vanilla turrets

* Refactored def extensions into DefModExtensions

* Refactored MainTabWindow_OutfitsAndLoadouts into PawnColumnWorker_Loadout

Also fixed a bunch of outstanding refactoring for A17 update

* Refactored bodies and body parts to xpath patches, updated mech parts to A17

* More def-to-patch conversion

Converted: DamageDefs, DrugDefs, FactionDefs, JobDefs, IncidentDefs

Also cleaned up some leftover defs and dirty edits and bumped Mechanoid raid delay from 45 days to 60

* Converted Hediff edits to patches

Also refactored Hediff_InjuryCE away, now HediffComp_Stabilize functionality is implemented through Harmony postfix and can be applied to any class inheriting from HediffWithComps

* Even more patch conversions

Converted PawnKindDefs, RecipeDefs, ResearchProjectDefs, ScenarioDefs, StatDefs, BuildingDefs, ItemDefs, TraderKindDefs, WorkGiverDefs

All that's left is ThingDefs_Misc, races and ThinkTrees

* Cleaned up patch errors

* Patched apparel, filth, chunks and races

* Fixed various def and patch errors

* Converted special injectors to Mod class, HugsLib settings to vanilla

* Finished up settings window, fixed VisibleAccessory validation

* Removed some commented out code

* Finished def to patch conversion

Left pila as override, mainly because it uses CE specific abstracts

* Fixed various errors, started on loadout UI

Assign tab now has functional column for loadout assignment, but is still missing bulk/weight bars and is also oversized. Will probably need to mess with column workers of outfit and drug policy to reduce their width to 1/3 of the window

* Mass patch optimization

Also fixed an issue with tooltip postfix not doing anything

* Cleaned up some more patches

* Misc fixes

Fixed various patches and CanBeStabilized() returning wrong value

* First conversion, Detours_FloatMenuMakerMap into harmony patches. (#178)

Should be complete and initial tests suggests that they work.

Comments are a bit sparse/clumped and ugly.

* Converted Detours_VerbTracker to Harmony patch. (#180)

In pure IL (for the heck of it and because it was a short patch, also for speed since the alternative would involve an extra call).

Also fixed up my remarks from the previous harmony work.

* Various fixes

-Fixed Stabilize float menu option not recognizing missing body parts
-Fixed turrets dropping ammo into wrong map when reloading

* LoS overhaul

-Completely refactored the way partial cover obstructions are detected. Instead of clunky old raycast now uses more reliable bounding box-raycast intersection along entire line of sight (so sandbags won't suddenly stop blocking LoS if target is more than 3 cells away from them).

-Also refactored the way height is calculated, now uses new CollisionVertical struct instead of float range.

-Fixed some misc bugs with rocket launchers and changed how much quality affects sights efficiency.

-Added 50% sway penalty when under suppression.

-Implemented new debug options to the mod menu to better control commonly used debug functionality.

* Fixed turrets not initializing their gun properly

Also cleaned up some unused comps from the source files

* Reworked suppression jobs

Instead of ThinkNodes suppression reaction is now handled by having CompSuppressable issue a job. The advantage of this is that we can use vanilla functionality to continue previously assigned jobs once hunker ends.

* A17 detour to harmony3 (#184)

* Converted Detours_VerbTracker to Harmony patch.

In pure IL (for the heck of it and because it was a short patch, also for speed since the alternative would involve an extra call).

Also fixed up my remarks from the previous harmony work.

* Converted Detours_HediffComp_GetsOld to Harmony.

Also some cleanup of my previous harmony patches (an unused variable still being declared...)

Also a new utility function to safely cast nullable bool to bool, returns false if the nullable bool has no value (null) and the value of the bool if it has a value.

* Converted Detours_Pawn_HealthTracker to Harmony.

Also a new utility method in HarmonyBase.

* Converted Detours_TradeDeal to Harmony.

* Converted the last of the Detours...
Pawn_EquipmentTracker (a series of postfixes and one infix that is basically a method call conversion)
MassUtility (a postfix patch as that was fastest to do and fit fine).

Some more utility stuff in HarmonyBase, including a large remarked block.

* Refactored projectile collision detection

Now uses LoS algorithm and box intersections instead of raycast

* Harmony check... (#185)

* Converted Detours_VerbTracker to Harmony patch.

In pure IL (for the heck of it and because it was a short patch, also for speed since the alternative would involve an extra call).

Also fixed up my remarks from the previous harmony work.

* Converted Detours_HediffComp_GetsOld to Harmony.

Also some cleanup of my previous harmony patches (an unused variable still being declared...)

Also a new utility function to safely cast nullable bool to bool, returns false if the nullable bool has no value (null) and the value of the bool if it has a value.

* Converted Detours_Pawn_HealthTracker to Harmony.

Also a new utility method in HarmonyBase.

* Converted Detours_TradeDeal to Harmony.

* Converted the last of the Detours...
Pawn_EquipmentTracker (a series of postfixes and one infix that is basically a method call conversion)
MassUtility (a postfix patch as that was fastest to do and fit fine).

Some more utility stuff in HarmonyBase, including a large remarked block.

* Examined WorkGiver_InteractAnimal and Verb_TryStartCastOn patches.

Harmony-WorkGiver_InteractAnimal didn't really need any work, the target notation (HarmonyPatch) was a tad off but the code was fine.

Harmony-Verb_TryStartCastOn wasn't fundamentally changed, modified it to use more recent patch procedures but it didn't really need any work.

* Examined GenRadial.cs, nothing was needed to be done...

Except to modify it to use the new mechanic for running custom patches.  The infix code and such was basically unmodified.

Refactored somewhat to fit the pattern of patches.

* Inspected the remaining patches, no obvious work ne…
  • Loading branch information
NoImageAvailable committed Jun 10, 2017
1 parent 24f7d7e commit b08d3d5
Show file tree
Hide file tree
Showing 22 changed files with 2,666 additions and 2,468 deletions.
3 changes: 2 additions & 1 deletion About/About.xml
Expand Up @@ -3,5 +3,6 @@
<name>Combat Extended</name>
<author>CE Team</author>
<targetVersion>0.17.1557</targetVersion>
<description>Version: 1.0\n\nExtends combat mechanics to make them deeper and more tactical.</description>
<url>https://ludeon.com/forums/index.php?topic=33461.0</url>
<description>Version: 0.17.1.1\n\nExtends combat mechanics to make them deeper and more tactical.</description>
</ModMetaData>
Binary file modified Assemblies/CombatExtended.dll
Binary file not shown.
233 changes: 233 additions & 0 deletions Defs/Ammo/HighCaliber/12.7x108mmSoviet.xml
@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8" ?>
<ThingCategoryDefs>

<ThingCategoryDef>
<defName>Ammo127x108mm</defName>
<label>12.7x108mm Soviet</label>
<parent>AmmoHighCaliber</parent>
</ThingCategoryDef>

<!-- ==================== AmmoSet ========================== -->

<CombatExtended.AmmoSetDef>
<defName>AmmoSet_127x108mm</defName>
<label>12.7x108mm Soviet</label>
<ammoTypes>
<Ammo_127x108mm_FMJ>Bullet_127x108mm_FMJ</Ammo_127x108mm_FMJ>
<Ammo_127x108mm_HE>Bullet_127x108mm_HE</Ammo_127x108mm_HE>
<Ammo_127x108mm_Incendiary>Bullet_127x108mm_Incendiary</Ammo_127x108mm_Incendiary>
</ammoTypes>
</CombatExtended.AmmoSetDef>

<!-- ==================== Ammo ========================== -->

<ThingDef Name="Ammo127x108mmBase" ParentName="SmallAmmoBase" Abstract="True">
<description>Large caliber bullet used by many heavy machine guns and anti-materiel rifles.</description>
<statBases>
<Mass>0.17</Mass>
<Bulk>0.18</Bulk>
</statBases>
<tradeTags>
<li>CE_AutoEnableTrade</li>
<li>CE_AutoEnableCrafting</li>
</tradeTags>
<thingCategories>
<li>Ammo127x108mm</li>
</thingCategories>
<stackLimit>200</stackLimit>
</ThingDef>

<ThingDef ParentName="Ammo127x108mmBase">
<defName>Ammo_127x108mm_FMJ</defName>
<label>12.7x108mm cartridge (FMJ)</label>
<graphicData>
<texPath>Things/Ammo/HighCaliber/FMJ</texPath>
<graphicClass>Graphic_StackCount</graphicClass>
</graphicData>
<statBases>
<MarketValue>0.5</MarketValue>
</statBases>
<ammoClass>FullMetalJacket</ammoClass>
<cookOffProjectile>Bullet_127x108mm_FMJ</cookOffProjectile>
</ThingDef>

<ThingDef ParentName="Ammo127x108mmBase">
<defName>Ammo_127x108mm_HE</defName>
<label>12.7x108mm cartridge (HE)</label>
<graphicData>
<texPath>Things/Ammo/HighCaliber/HE</texPath>
<graphicClass>Graphic_StackCount</graphicClass>
</graphicData>
<statBases>
<MarketValue>0.71</MarketValue>
</statBases>
<ammoClass>ExplosiveAP</ammoClass>
<cookOffProjectile>Bullet_127x108mm_HE</cookOffProjectile>
</ThingDef>

<ThingDef ParentName="Ammo127x108mmBase">
<defName>Ammo_127x108mm_Incendiary</defName>
<label>12.7x108mm cartridge (AP-I)</label>
<graphicData>
<texPath>Things/Ammo/HighCaliber/Incendiary</texPath>
<graphicClass>Graphic_StackCount</graphicClass>
</graphicData>
<statBases>
<MarketValue>0.89</MarketValue>
</statBases>
<ammoClass>IncendiaryAP</ammoClass>
<cookOffProjectile>Bullet_127x108mm_Incendiary</cookOffProjectile>
</ThingDef>

<!-- ================== Projectiles ================== -->

<ThingDef Name="Base127x108mmBullet" ParentName="BaseBullet" Abstract="true">
<graphicData>
<texPath>Things/Projectile/Bullet_Big</texPath>
<graphicClass>Graphic_Single</graphicClass>
</graphicData>
<projectile>
<damageDef>Bullet</damageDef>
<speed>205</speed>
<dropsCasings>true</dropsCasings>
</projectile>
</ThingDef>

<ThingDef ParentName="Base127x108mmBullet">
<defName>Bullet_127x108mm_FMJ</defName>
<label>12.7x108mm bullet (FMJ)</label>
<projectile>
<damageAmountBase>45</damageAmountBase>
<armorPenetration>0.90</armorPenetration>
</projectile>
</ThingDef>

<ThingDef ParentName="Base127x108mmBullet">
<defName>Bullet_127x108mm_HE</defName>
<label>12.7x108mm bullet (HE)</label>
<projectile>
<damageAmountBase>28</damageAmountBase>
<armorPenetration>1.05</armorPenetration>
<secondaryDamage>
<li>
<def>Bomb_Secondary</def>
<amount>18</amount>
</li>
</secondaryDamage>
</projectile>
</ThingDef>

<ThingDef ParentName="Base127x108mmBullet">
<defName>Bullet_127x108mm_Incendiary</defName>
<label>12.7x108mm bullet (AP-I)</label>
<projectile>
<damageAmountBase>27</damageAmountBase>
<armorPenetration>1.05</armorPenetration>
<secondaryDamage>
<li>
<def>Flame_Secondary</def>
<amount>9</amount>
</li>
</secondaryDamage>
</projectile>
</ThingDef>

<!-- ==================== Recipes ========================== -->

<RecipeDef ParentName="AmmoRecipeBase">
<defName>MakeAmmo_127x108mm_FMJ</defName>
<label>make 12.7x108mm (FMJ) cartridge x200</label>
<description>Craft 200 12.7x108mm (FMJ) cartridges.</description>
<jobString>Making 12.7x108mm (FMJ) cartridges.</jobString>
<ingredients>
<li>
<filter>
<thingDefs>
<li>Steel</li>
</thingDefs>
</filter>
<count>31</count>
</li>
</ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
</thingDefs>
</fixedIngredientFilter>
<products>
<Ammo_127x108mm_FMJ>200</Ammo_127x108mm_FMJ>
</products>
<workAmount>5250</workAmount>
</RecipeDef>

<RecipeDef ParentName="AmmoRecipeBase">
<defName>MakeAmmo_127x108mm_HE</defName>
<label>make 12.7x108mm (HE) cartridge x200</label>
<description>Craft 200 12.7x108mm (HE) cartridges.</description>
<jobString>Making 12.7x108mm (HE) cartridges.</jobString>
<ingredients>
<li>
<filter>
<thingDefs>
<li>Steel</li>
</thingDefs>
</filter>
<count>27</count>
</li>
<li>
<filter>
<thingDefs>
<li>FSX</li>
</thingDefs>
</filter>
<count>4</count>
</li>
</ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
<li>FSX</li>
</thingDefs>
</fixedIngredientFilter>
<products>
<Ammo_127x108mm_HE>200</Ammo_127x108mm_HE>
</products>
<workAmount>12500</workAmount>
</RecipeDef>

<RecipeDef ParentName="AmmoRecipeBase">
<defName>MakeAmmo_127x108mm_Incendiary</defName>
<label>make 12.7x108mm (AP-I) cartridge x200</label>
<description>Craft 200 12.7x108mm (AP-I) cartridges.</description>
<jobString>Making 12.7x108mm (AP-I) cartridges.</jobString>
<ingredients>
<li>
<filter>
<thingDefs>
<li>Steel</li>
</thingDefs>
</filter>
<count>29</count>
</li>
<li>
<filter>
<thingDefs>
<li>Prometheum</li>
</thingDefs>
</filter>
<count>2</count>
</li>
</ingredients>
<fixedIngredientFilter>
<thingDefs>
<li>Steel</li>
<li>Prometheum</li>
</thingDefs>
</fixedIngredientFilter>
<products>
<Ammo_127x108mm_Incendiary>200</Ammo_127x108mm_Incendiary>
</products>
<workAmount>10250</workAmount>
</RecipeDef>

</ThingCategoryDefs>

0 comments on commit b08d3d5

Please sign in to comment.