Many Dll Questions

Started by Kirid, April 26, 2014, 04:06:49 AM

Previous topic - Next topic

Kirid

#15
If anyone wants to take a look, this is my frankensteined file so far. I was mostly just using it as code writing practice.
It started with creating a new Building_MedBed class. Building_Bed is referred to tons of times in the Assembly-CSharp.
I had to rewrite everything that refers to it, which usually just involved adding "Med" to the front.
My own changes to Pawn are titled XPawn, It's a new file entirely, but named so the two can be merged for compatibilty if needed.

Has an error with a yield in the JobDriver,  I dont understand those
And in Building_MedBed:   MedRoom room = Find.Grids.RoomAt(base.Position);  Find is refering to Room.class, but I'm using MedRoom.class
I still need to write several if statements and IEnumerators making sure the TakeToMedBed takes priority over TakeToBed (if possible). It won't work as is, It's a near identical clone of existing code.
Already wrote a couple like:
public void Kickout()
    if (!this.Medowner.healthTracker.Wounded)
        this.Medowner.medownership.UnclaimMedBed();


I'd love to know you anyone thinks I'm close, doing it all wrong, or what I'm trying is impossible.

[attachment deleted by admin: too old]
You can't rollerskate in a muffalo herd

Tynan

Don't subclass Room; it's a globally-managed data store for some fairly complex systems that you really shouldn't mess with. Also, subclassing ThingGrid is just crazy.

You're subclassing way too much. Even if you had a way to get this code running by the game (which won't run it since it'll just use the basic Room and ThingGrid etc), it would be a compatibility and sustainability nightmare. Just write the code you need to and work with existing interfaces.

The thing you're doing is rather low-value and very high-effort from your POV; I suggest you try another project since this really isn't well supported by the modding systems yet.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

pawnstorm

Quote from: Tynan on April 30, 2014, 06:13:06 PM
I suggest you try another project since this really isn't well supported by the modding systems yet.
But those are the most fun projects! :P

Kirid

Quote from: Tynan on April 30, 2014, 06:13:06 PM
The thing you're doing is rather low-value and very high-effort from your POV; I suggest you try another project since this really isn't well supported by the modding systems yet.
I completely agree. Way in over my head. :P My other project is making doctors able to heal, not much easier.

The only reason it expanding into editing the Room.class and then ThingGrid was because of this:
public IEnumerable<Building_MedBed> ContainedMedBeds
    {
        get
        {
            HashSet<Building_MedBed> hashSet = new HashSet<Building_MedBed>();
            foreach (IntVec3 current in this.crosses)
            {
                foreach (Thing current2 in Find.Grids.ThingsAt(current))
                {
                    Building_MedBed building_MedBed = current2 as Building_MedBed;
                    if (building_MedBed != null && !hashSet.Contains(building_MedBed))
                    {
                        hashSet.Add(building_MedBed);
                    }
                }
            }
            return hashSet;
        }
    }

Since posting I've moved that to the Building_MedBed class, I think that will work?
I also entirely removed anything dealing with prisoners, which got rid of tons of problems.
You can't rollerskate in a muffalo herd