Menu

Show posts

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 Menu

Messages - RawCode

#1666
Help / Re: Logging and Acessing Protected Values
August 03, 2014, 11:16:41 PM
with a bit of magic you can IO process memory directly, including any fields of any objects no matter what flags are set.
you can google solution with unsafe c# and marshal as keywords.

some fields cannot be changed this way because they INLINED at compile time and changing field wont change codeflow, you should double check implementation before trying to hack it.
#1667
Help / Re: Firing multiple projectiles from weapons?
August 02, 2014, 03:47:09 AM
XML allows to change only things specially defined by developer as "changeable".

same with assembly - you can define methods and ever entire classes as dynamic and change them at runtime, but this is not easy and fun.
#1668
Mods / Re: [Request] Enhanced Faction Relations!
August 01, 2014, 07:26:31 PM
you can at least try coding what you described in this thread.

1) trading - possible with few not very dirty hacks
2) again possible
3) also possible
4) still possible
#1669
Help / Re: Firing multiple projectiles from weapons?
August 01, 2014, 07:17:18 PM


modding is not for everyone, it's ok if you dont understand c# or dont know where is creative tools
#1670
Help / Re: Firing multiple projectiles from weapons?
August 01, 2014, 06:43:28 AM
Not possible without custom assembly.

Sample mod attached to message.
Source

   public class ProjectileHook
    {
        public Projectile target2;
        public ThingDef type;
        private IntVec3 source;
        public bool canFreeIntercept = false;

        public ProjectileHook(ThingDef type, IntVec3 source)
        {
            this.type = type;
            this.source = source;
        }

        internal void Launch(Thing thing, Vector3 drawPos, TargetPack targetPack)
        {

        for (int i = 0; i < 30; i++)
{
                target2 = (Projectile)ThingMaker.MakeThing(type);
                GenSpawn.Spawn((Thing)target2, source);
                target2.canFreeIntercept = canFreeIntercept;
                target2.Launch(thing, drawPos, targetPack);
}
        }
    }

    public class Caerbannog_Gun : Verb_Shoot
    {
        protected override bool TryShotSpecialEffect()
        {
            ShootLine shootLine;
            if (!this.TryFindShootLineFromTo(this.owner.Position, this.currentTarget, out shootLine))
                return false;
            Vector3 drawPos = this.owner.DrawPos;
            ProjectileHook projectile = new ProjectileHook(this.verbProps.projectileDef,shootLine.source);
            float num = this.verbProps.forcedMissRadius;
            float horizontalSquared = (this.currentTarget.Loc - this.owner.Position).LengthHorizontalSquared;
            if ((double)horizontalSquared < 9.0)
                num = 0.0f;
            else if ((double)horizontalSquared < 25.0)
                num *= 0.5f;
            else if ((double)horizontalSquared < 49.0)
                num *= 0.8f;
            if ((double)num > 0.5)
            {
                int index = UnityEngine.Random.Range(0, GenRadial.NumCellsInRadius(this.verbProps.forcedMissRadius));
                if (index > 0)
                {
                    IntVec3 intVec3 = this.currentTarget.Loc + GenRadial.RadialPattern[index];
                    projectile.canFreeIntercept = true;
                    projectile.Launch(this.owner, drawPos, (TargetPack)intVec3);
                    return true;
                }
            }
            HitReport hitReport = this.HitReportFor(this.currentTarget);
            if ((double)UnityEngine.Random.value > (double)hitReport.TotalNonWildShotChance)
            {
                shootLine.ChangeDestToMissWild();
                projectile.canFreeIntercept = true;
                projectile.Launch(this.owner, drawPos, (TargetPack)shootLine.dest);
                return true;
            }
            else if ((double)UnityEngine.Random.value > (double)hitReport.HitChanceThroughCover && this.currentTarget.Thing != null && this.currentTarget.Thing.def.eType == EntityType.Pawn)
            {
                Thing thing = hitReport.covers.RandomBlockingCoverWeighted();
                projectile.canFreeIntercept = true;
                projectile.Launch(this.owner, drawPos, new TargetPack(thing));
                return true;
            }
            else
            {
                if (this.currentTarget.Thing != null)
                    projectile.Launch(this.owner, drawPos, new TargetPack(this.currentTarget.Thing));
                else
                    projectile.Launch(this.owner, drawPos, new TargetPack(shootLine.dest));
                return true;
            }
        }
    }


Special Caerbannog Pistol can be spawned with creative tools, that gun will shot 30 projectiles in narrow cone.

[attachment deleted by admin: too old]
#1671
Mods / Re: {Idea/Request} Lighting+
July 31, 2014, 10:10:40 PM
just try to implement your mod, if failed - ask for help.

you obviosly not ever tryed
#1672
Ideas / Re: MMB for pause/resume
July 31, 2014, 10:05:56 PM
there are zillion applications to redefine keys, ever if game does not support keymappings you still can map anything to anything for specific application with such tools.
#1674
you allowed to provide custom assembly for incident maker and calculate events based of something different.

control without AMS injections severely limited but still possible to alter how things flow.
#1675
Ideas / Re: Gas/Chemical Warfare
July 29, 2014, 07:39:39 AM
IRL chemical weapons are forbidden worldwide, usage of such weapons should feature some kind of penalty for colony.

also there is no viable way to control gas cloud, IRL such weapons always cause major "frendly fire" and your troops will need protection, nothing can stop cloud from moving to your own living area.
#1676
General Discussion / Re: Steam
July 28, 2014, 09:30:08 PM
moding "native" part of game to mod assembly will allow version selection...

simply game will have mods "core_A1" "core_A2" and soo on with all native part moved to mod stored assemblyes.
this will greatly increase game size but will allow to select version.

implementing this possible by coding something like reinstrumentation classloader (class loader that able to alter byte[] of class before class is defined)
#1677
grenades or molotovs have short talk with items.
#1678
suggesting to alter something in codeflow (like conditions) is obvious waste of time due compiler>decompiler artifacts.

BUT suggestion to mark some methods virtual to allow overrides, or change classchain (what class extends what) is perfectly valid since compiler>decompiler does not generate any artifacts at type signatures.

I have perfectly valid suggestion to merge weather control classes into single weathercontoldef and allow mod developer to fully overide it or lowskill developers to alter behaivior with xml defs.
same suggestion may apply to many other classes.

Other perfectly valid suggestion is event handling entrypoints inside core classes.

Like PawnSpawnEvent or MapInitializeEvent, first event will allow to redefine pawn to be spawned and perform some actions before game actually started.
#1679
Mod can perform all actions that game can.

I plan to enumerate all assemblies and all types inside that assemblies for compatible methods and invoke them on specific event.

like invoking all onMapInit() methods of all defined types on that event.

basically iam going to copy cbukkit implementation of event system with minor modifications

#1680
Small addition: always prisoners


    public class StoryIntender_PopulationImpl : StoryIntender_Population
    {
        override public float PopulationIntent
        {
            get
            {
                return 100f;
            }
        }
    }


initialized by


Find.Map.storyteller.intenderPopulation = new StoryIntender_PopulationImpl();