Quote from: stigma on July 23, 2017, 12:01:09 PM
Is this safe to add/remove in an ongoing save?
It kind of sounds like it would be - but I'd rather ask than run into trouble later
-Stigma
Yeah, it's completely safe to add/remove in an ongoing save.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: stigma on July 23, 2017, 12:01:09 PM
Is this safe to add/remove in an ongoing save?
It kind of sounds like it would be - but I'd rather ask than run into trouble later
-Stigma
Quote from: Schwartz on July 20, 2017, 08:06:41 AM
Ran into a problem with this coupled with the Hospitality mod. A berserking visitor was impervious to bullets. I'm pretty sure he was punching my guys to death just fine though.
Quote from: Oblitus on July 19, 2017, 04:45:29 PM
Making friendly fire less likely for skilled shooters would make perfect sense.
BTW, what about turrets?
Quote from: moonra on July 19, 2017, 03:19:48 PM
What do you think would be the best way to configure this to make a skilled shooter be unlikely to shoot a friend without making this an OP mod?
Quote from: lorebot on July 14, 2017, 10:29:37 PM
I only asked cause I once annihilated a group of friendlies totally by accident when they showed up to 'help' me with an infestation...the bugs killed about half of them, but I killed the rest cause I couldn't stop them from going into the room with the bugs even tho I had embrasures to shoot through....
Quote from: lorebot on July 14, 2017, 09:56:31 PM
Does it remove friendly fire from other factions as well?
Meaning that Raiders won't shoot each other while shooting at your colonists?
Will it stop you from shooting friendly visitors or traders if they're at your colony during a raid?
using Verse;
using Harmony;
using RimWorld;
using System.Linq;
using System;
using System.Reflection;
using UnityEngine;
using System.Collections.Generic;
namespace NoFriendlyFire
{
[StaticConstructorOnStartup]
class Main
{
static Main()
{
Log.Message("Patching");
var harmony = HarmonyInstance.Create("venner.io.nofriendlyfire");
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch(typeof(Verse.Projectile), "ImpactSomething")]
public static class NoFriendlyFirePatch
{
// Harmony stuff
static void Prefix()
{
Log.Message("This works for some reason, but it's not what I need.");
}
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
Log.Message("Replacing method");
MethodBase from = typeof(Verse.Projectile).GetMethod("ImpactSomething", AccessTools.all);
MethodBase to = typeof(NoFriendlyFirePatch).GetMethod("ImpactSomethingElse", AccessTools.all);
return instructions.MethodReplacer(from, to);
}
// NoFriendlyFire method
static void ImpactSomethingElse()
{
Log.Message("I would appreciate it if you actually worked");
}
}
}