[Mod Request] Doors that prisoners can open.

Started by Igabod, October 28, 2014, 03:52:21 AM

Previous topic - Next topic

Igabod

I was wanting to build a jail where there is one central dining area with separate rooms around the outside of that. Problem is, the prisoners can't open the doors to their individual cells to get into the dining area. And if I don't put doors on the cells then it's basically the same as putting their beds in the same room. I know the penalty you suffer from that isn't a big deal, but for aesthetic reasons I still want my prisoners in individual cells and would rather not make them big enough to put a table in each room, nor would I like to spend all the resources on that. I'm pretty sure this is going to require some .dll work and I'm not confident in my programming skills enough to do that. If there is an easy way to do this using the xml files (doubt it) then I'll happily do the work myself if someone can point me in the right direction.

skullywag

I think this is all tied into the prisoner room system so gonna be hard to get in amongst it. Might be able to hack around it maybe if you can get a door to be openable and have the dining area as prisoner area as well...ill look into it.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Haplo

#2
Hmm, most likely it is enough, if you make a door that has just this change:


        public override bool WillOpenFor(Pawn p)
        {
            if (lockedInt)
                return false;

            return true;
        }


Voila, you'll have a door that opens for everyone except you lock it up :)

Or maybe a bit more:
(This is a door that can be locked, but opens up for your colonists who have a doorkey)


        public override bool WillOpenFor(Pawn p)
        {
            if (lockedInt)
                if (p.inventory != null && p.inventory.container.Contains(ThingDefOf.DoorKey))
                    return true;
                else
                    return false;

            return true;
        }



Hmm, i haven't tested it, but this should work:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using UnityEngine;
using RimWorld;
using Verse;

namespace Prison
{
    class Building_PrisonerDoor : Building_Door
    {

        public override bool WillOpenFor(Pawn p)
        {
            if (lockedInt)
                if (p.inventory != null && p.inventory.container.Contains(ThingDefOf.DoorKey))
                    return true;
                else
                    return false;

            return true;
        }
    }
}

Igabod

Quote from: Haplo on October 28, 2014, 05:30:09 AM
A bunch of coding stuff...

Ok, awesome. But where do I put these pieces of code? Do I make a new .dll file containing just the code you provided and put it in an assemblies folder in a mod that contains a new door? I've never done any .dll modding on this game. And thanks for the replies by the way.

Pan.Q

you mean something like in Prison Architect? add zones for prisoners and stuff?
Im the Excalibur weaponry wielder
Do you dare to step into the deadliest field of
Hardcore hip-hop, we laugh at your idols
Fuck your advice, I walk the path of the psycho.

Igabod

Quote from: Pan.Q on October 28, 2014, 09:34:30 AM
you mean something like in Prison Architect? add zones for prisoners and stuff?

I guess. I've never actually played the game and only saw a quick 20 minute video of it on youtube but they didn't even get prisoners in the prison before the end of that video so I got bored with it and never went back to it. I'm really just wanting to remove the restriction for prisoners to open a door (as in a new door separate from the regular door and the autodoor) and have access to a communal dining area. This could also be useful to allow them to go into a walled off courtyard outside so they don't get cabin fever (for those extended stay prisoners).

Pan.Q

maybe just try to make a big room with table and beds, make it prisoner room and then add walls and doors. i really can't help with coding but maybe there is some kind of bug or something that will allow you to do that like i said.
Im the Excalibur weaponry wielder
Do you dare to step into the deadliest field of
Hardcore hip-hop, we laugh at your idols
Fuck your advice, I walk the path of the psycho.

Pan.Q

i'll try to do it myself when i come back from work.
Im the Excalibur weaponry wielder
Do you dare to step into the deadliest field of
Hardcore hip-hop, we laugh at your idols
Fuck your advice, I walk the path of the psycho.

Igabod

Quote from: Pan.Q on October 28, 2014, 10:37:29 AM
i'll try to do it myself when i come back from work.
Don't bother trying it. I already tried it before. The problem of prisoners not being able to open doors prevents them from leaving their cell, hence this post.

Haplo

Quote from: Igabod on October 28, 2014, 08:42:43 AM
Quote from: Haplo on October 28, 2014, 05:30:09 AM
A bunch of coding stuff...

Ok, awesome. But where do I put these pieces of code? Do I make a new .dll file containing just the code you provided and put it in an assemblies folder in a mod that contains a new door? I've never done any .dll modding on this game. And thanks for the replies by the way.

Yes, this stuff is actually the source for an dll. But you need to create the dll first..
I'll make it for you later on, then you can try it out :)

Igabod

ok thanks. I appreciate you looking into this for me. :)

NoImageAvailable

You know, if the problem is tables you might want to look into the modular tables mod since it allows you to give prisoners a 1x1 table.
"The power of friendship destroyed the jellyfish."

Haplo

#12
Hmm, it is much more complicated than I thought at first glance.
The problem is, that the room is a prison and the outer room and also the door is not a prison.
Therefore the prisoner won't ever leave the room...

I've tried it with my lockable doors from miscellaneous and still cant get the prisoner to walk into the second room. Even a prison bed in there doesn't work, as the door stays a non prison room..

Sorry but it isn't easily done. It looks like it needs some deep pawn or some room definition coding.
Sorry, but no easy prison architect clone doable here..



If you want to try it yourself, here is my test mod with the LockableDoors code:
http://www.mediafire.com/download/rc3786cu6g96m4g/Prison.7z

Feel free to do with it whatever you like.


Igabod

I appreciate you trying. Is there any way to change what objects the prisoners can interact with? By this I mean, in previous alphas the prisoners were able to access NPD machines, but now the dispenser is outside the little orange glow that indicates the prison. Could you reverse engineer that but for doors?

Quote from: NoImageAvailable on October 28, 2014, 11:14:49 AM
You know, if the problem is tables you might want to look into the modular tables mod since it allows you to give prisoners a 1x1 table.

I already am doing this but it just doesn't fit in with my aesthetic vision. This request isn't really about function, just looks.

Wex

Quote from: Igabod on October 28, 2014, 06:59:46 PM
I appreciate you trying. Is there any way to change what objects the prisoners can interact with? By this I mean, in previous alphas the prisoners were able to access NPD machines, but now the dispenser is outside the little orange glow that indicates the prison. Could you reverse engineer that but for doors?
Also, can you make the dispenser work for prisoners, so I can stop wasting human meat on them? (also less hauling of food around)
"You are not entitled to your opinion. You are entitled to your informed opinion. No one is entitled to be ignorant."
    Harlan Ellison