[Mod Request] Doors that prisoners can open.

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

Previous topic - Next topic

Humort

Может попробовать сделать такую дверь, которая будет делать комнату - закрытым помещением, но эту дверь, заключённые не будут воспринимать за дверь? (ну, как вариант, свежая мысль)...
I speak Russian if you don't understand that I wrote, Google Translator is guilty of it

Haplo

Please use english on this forum. Most people here can't even read the kyrillian alphabet..

Loki88

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..



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?

Haplo

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...

Carry

I think I got it - almost, maybe  :)

ProofOfConcept.zip

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]

ousire

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

Wastelander

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.

Vader

#22
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.

Facepunch

If ever someone uploads a solution to this issue, you will have forever gained my affections.

Wastelander

Well who could resist eternal affections?  :)

I've uploaded a mod that does this here: https://ludeon.com/forums/index.php?topic=10069.0