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.
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.
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;
}
}
}
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.
you mean something like in Prison Architect? add zones for prisoners and stuff?
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).
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.
i'll try to do it myself when i come back from work.
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.
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 :)
ok thanks. I appreciate you looking into this for me. :)
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.
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..
(http://s27.postimg.org/kej8cwgoz/Prison_Door.jpg) (http://postimage.org/)
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.
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.
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)
Может попробовать сделать такую дверь, которая будет делать комнату - закрытым помещением, но эту дверь, заключённые не будут воспринимать за дверь? (ну, как вариант, свежая мысль)...
Please use english on this forum. Most people here can't even read the kyrillian alphabet..
Quote from: Haplo on October 28, 2014, 11:58:39 AM
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..
(http://s27.postimg.org/kej8cwgoz/Prison_Door.jpg) (http://postimage.org/)
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.
Would this code still be viable in A8 or have things changed enough between alphas that this code isn't any good?
Honestly, I'm not sure. But the source I used for this is a slightly modification of the locked door part from the Miscellaneous mod. You can find the sourcecode there at the end of the first post.
I'm not home right now, or I would look for you...
I think I got it - almost, maybe :)
ProofOfConcept.zip (https://www.dropbox.com/s/3dt9nfwnec297zc/ProofOfConcept.zip?dl=0)
The file contains a new door and a workgiver. The door can be opened by anyone and the workgiver prevents wardens from escorting the prisoner back to his cell (if his current room is a cell).
Notes:
The room on the 'other side' needs a prisoner bed. Afaik that's the only way to turn a room into a prison.
Wardens still bring food to prisoners. I'm sure that can be turned off in the workgiver as well.
I didn't test anything besides the basic function - there might be side-effects.
Feel free to use the code. I don't have time to make a proper mod right now.
[attachment deleted due to age]
I think the best solution would be the ability to mark rooms as 'for prisoner use', and if two prisoner rooms are connected to each other, then they'll be able to freely move between the different rooms. Then you can have individual cells that connect to halls, dining areas, outdoor yards, you name it
QuoteI think the best solution would be the ability to mark rooms as 'for prisoner use', and if two prisoner rooms are connected to each other, then they'll be able to freely move between the different rooms. Then you can have individual cells that connect to halls, dining areas, outdoor yards, you name it
I've implemented this in a mod I'm working on... in total I had to:
-Create a new door that prisoners can access
-Override default human thinkTree so prisoners no longer just wanderRoom, they wander freely, or else they won't go to access shared resources outside their cell (nutrient dispensers)
-Override the warden workgiver to not haul prisoners who are out of their bedroom, and to not haul prisoners who are in 1x1 rooms (as the prison door itself creates a 1x1 room)
I'm at the point where they'll access their own bedrooms and leave the bedrooms to get food from a shared dispenser. Still on my list is to build an object that works like a bed but marks a room as a prisoner zone, because only prisoner-marked beds do that in core.
Looking at this code:
public void RoomChanged()
{
this.cachedCellCount = -1;
this.cachedOpenRoofCount = -1;
if (Map.Initialized)
RoofMaker.TryGenerateRoofFor(this);
this.isPrisonCell = false;
if (!this.TouchesMapEdge)
{
foreach (Thing thing in this.AllContainedThings)
{
Building_Bed buildingBed = thing as Building_Bed;
if (buildingBed != null && buildingBed.ForPrisoners)
{
this.isPrisonCell = true;
break;
}
}
}
I propose to make the prisoners detector, who will act as a "bed".
So it will be easy to determine which rooms can move prisoners. The detectors will be invisible object.
If ever someone uploads a solution to this issue, you will have forever gained my affections.
Well who could resist eternal affections? :)
I've uploaded a mod that does this here: https://ludeon.com/forums/index.php?topic=10069.0