[MOD] (Alpha 6) Colonist Only Doors (v1.2.3) Updated 8/16

Started by Neurotoxin, August 05, 2014, 06:10:37 PM

Previous topic - Next topic

Neurotoxin

Are you sick of feeding unwanted guests? Are your "guests" stopping by your prison and executing your valuable prisoners? Just don't like outsiders? This is the mod for you.

This mod adds a metal and wood door called a Colonist Only Door. Only colonists, as the name suggests, can pass. Your colonists still need their key to enter of course so don't lose it.


Screenshot: I'd love to demonstrate the doors working but the visitors just cluster at a random point outside the base rather than at the door because they can't use it.



Changelog:

v.1.2.3
    Fixed wood doors acting like powered doors
    Seperated 2 versions, 1 with standalone doors, 1 replace vanilla doors

v1.2.2
    Seperated wood doors added by this mod from the vanilla wood doors (Oops, oversight on my part)
    Added power transmission to Colonist only wood doors
    Now with 100% more awesome thanks to MonkeyWithAWrench's textures.

v1.2.1
    Hotfix for NRE caused by animals path-checking through doors

v1.2.0
    Update for alpha 6
    Fixed issue with visitors opening and closing doors constantly

v1.1.1
    Decided on a license.
    Added License to download archive.
    Made source available

v1.1.0
    Added lockable doors. Click a door, hit the UI button (Pending replacement, Borrowed from mrofa) and nobody can go through (without breaking it down).
    Added wooden Variant.
    Started work on power safety doors.

v1.0.2
    Open doors no longer allow everybody through. I can't fix both bugs and it's better the non-colonists don't come in.
    ^There's 2 methods for allowing people in doors, BlocksPawn(Pawn) which can be overridden (And that's what I'm using) and WillOpenFor(Pawn) which can't be overridden.
    ^^ I could theoretically use a NEW method to hide WillOpenFor but for some reason it doesn't want to work out.

v1.0.1
    Fixed open doors not allowing everybody through.

v1.0
    Initial Release


Known Issues:

Activating mod then loading into game can cause some texture glitches
to get around this activate then restart the game. This is on me, I need to assign the textures outside of the assembly.
I'm now not sure this CAN be fixed but stay tuned, might work something out.



TODO:


Textures to differentiate doors at a glance.
Create a door to work in conjunction with power switch. Powered = closed and unopenable, unpowered = open. (Think prison saftey cell doors).
Reorganize this thread.


Downloads:
The current version can always be found attached to this post. If you'd prefer a mirror I will provide Github links as well which also provides me a way to keep old versions available and easily maintained for me.
https://github.com/LtStingray/Colonist-Only-Doors/releases


Source Code:
https://github.com/LtStingray/Colonist-Only-Doors

License/Modpacks:
This modification is license under the MIT license.
Full license: http://opensource.org/licenses/MIT
TLDR license: https://tldrlegal.com/license/mit-license

Things to note for ModPackers:
If you intend to use this mod in a modpack, Supporting any version besides the current version is YOUR job and your job only.
That said, try to keep up to date. I would refrain from adding this in for the next couple days as the updates will be frequent. Goal of this weekend (soft) for full release.

It's also not REQUIRED but I would appreciate you notifying me that you intend to use my mod in a modpack. No real reason, just metrics/ would love to kno.w



Big thanks to MonkeyWithAWrench for offering up some textures. It's greatly appreciated.

Hope you guys enjoy the mod. Any comments, questions, concerns can be addressed in this thread.

Pick the ColonistOnlyDoors-v#.#.#-Replacer if you want regular doors to be replaced by colonist only doors. (This is not compatible with other mods that modify the base vanilla door)


[attachment deleted by admin: too old]

The_Shaikan23

It's super annoying to have about 25 people visit, get dirt all over the entire base, block the hallways, eat all my food and then leave without having contributed anything to the settlement. Great idea to make these doors.

Neurotoxin

Yeah, I had a few prisoners I was waiting to sell, I was broke and had nothing else worth selling. Some visitors came, walked into the prison and murdered all my prisoners. That was the last straw and thus the mod was born. Now that I've started I'm working on a few more door improvements (see TODO). Try it out and let me know how it works for you.

The_Shaikan23

That's just the worst visitor who arrives unannounced whenever they want, dirties up your carpets, empties your fridge and kills the people you have chained up in your basement... I mean colony.

Neurotoxin

Yes, yes it is. BTW door lock function is working perfectly but drawing the button on the UI uses some borrowed code so either I have to reimplement it or wait for permission from the original maker to use it. I'll wait for now and work on the powered doors and wood doors (That's just adding a new thingDef) until then. Maybe I'll try my hand at the texturing myself but, they gon' be ugly unless I just recolor the stock doors *thought*.

BetaSpectre

Is there a conflict with the Misc Mod?
If not then I'm totally gonna want this!!!
░░░░░░░░░░░░░░░░░─╤▌██ |
░░░░░░░░─╤▂▃▃▄▄▄███████▄▃|
▂█▃▃▅▅███/█████\█[<BSS>█\███▅▅▅▃▂
◥████████████████████████████████◤
                           TO WAR WE GO

Neurotoxin

I don't see how it could cause a conflict as I don't modify any base classes. All doors from this mod are a new instance of a different class that extends the base door class. But, give it a try and let me know, if there's an issue I'll try to figure out what could be causing it.


Looking at Haplo's mod, it looks like he does the same but overrides the Defs for the default doors, Shouldn't cause an issue but his locked doors are better than mine as he modifies the path grid. That'd be easy enough to implement, for the locked doors at least. I just need to figure out how to make taking the path undersirable for non-colonist friendly factions in the colonist only part.

BetaSpectre

The misc mod's doors don't seem to stop AI from WANTING to use the doors so then massive lag can be caused by pawns if enough are wanting to go through the door but can't.

I might try this mod...but I'm currently playing another game.
░░░░░░░░░░░░░░░░░─╤▌██ |
░░░░░░░░─╤▂▃▃▄▄▄███████▄▃|
▂█▃▃▅▅███/█████\█[<BSS>█\███▅▅▅▃▂
◥████████████████████████████████◤
                           TO WAR WE GO

Neurotoxin

Quote from: BetaSpectre on August 07, 2014, 02:19:36 AM
The misc mod's doors don't seem to stop AI from WANTING to use the doors so then massive lag can be caused by pawns if enough are wanting to go through the door but can't.

I might try this mod...but I'm currently playing another game.


Yeah I can see how that would happen, just making the path less desirable to use doesn't make them UNABLE to use it. If it's the only door to get somewhere (I.E. in and out of the base) they'll still try to use it. I suggest using Colonist Only doors only for places like the kitchen and prisons, places you don't want visitors. You CAN lock them out of the base entirely but they'll dog pile on the door and continually try to get in until they leave. I THINK when Alpha6 comes out and Tynan gives us the option to override WillOpenFor(Pawn) that should fix it because a Pawn, I think, shouldn't try to path through a door that won't open for them.


I suggest the same idea for using locking doors, don't use them as a "don't leave the base" door but as a way to modularily cut off access to certain parts of your base in cases of emergency (I.E. radiers dropping into base, mortar fire, etc..). The way it stands now, unless we figure out some techno-wizardry there's not much we can do for the bug besides making the path less desirable.


I'm working on a second project at the moment and once I'm done I'll be dedicating my time to trying to work around this.

Haplo

Quote from: BetaSpectre on August 07, 2014, 02:19:36 AM
The misc mod's doors don't seem to stop AI from WANTING to use the doors so then massive lag can be caused by pawns if enough are wanting to go through the door but can't.
...

I'm curious why you think that the misc mod doesn't stop the AI from wanting to go through the door?
In my tests, the pawns didn't try to path through the doors anymore. Do you have a different experience with it?
As far as I know, if the pathing to the target returns a value high enough, it is effectively not reachable.
So, because of this, they shouldn't try to use the locked doors from Misc anymore. At least in the newest version, where I've added the new pathing code.


Neurotoxin

Quote from: Haplo on August 07, 2014, 06:27:56 AM
As far as I know, if the pathing to the target returns a value high enough, it is effectively not reachable.


It makes the path undesirable yes but it doesn't technically invalidate the path. If it's the only route to somewhere they want to go they'll still probably try. Depending on the job and priority they will still attempt to go through undesirable paths. It should be easy to recreate. Enlist a pawn, build a room around him with only the locked door out and unenlist him, sooner or later he'll try to use the door anyway if he doesn't go nuts and break it down first.


It's nothing wrong with your code, and it works better than mine atm, it's just a limitation of what were able to modify. That said, I haven't used your mod or even tried the grid thing yet, these are just my observations of the code in play and the engine. I'll try it out to confirm and let you know what I come up with.



Edit: I'll leave what I said, but I can't recreate the pawns attempting to use a locked door using only your mod and core. I didn't test thoroughly but enough that 1 died of starvation before trying to use the door. I can still see how it could happen in theory but it does seem to make them rather die than use the door. Literally haha.

rsdworker


BetaSpectre

Quote from: Haplo on August 07, 2014, 06:27:56 AM
Quote from: BetaSpectre on August 07, 2014, 02:19:36 AM
The misc mod's doors don't seem to stop AI from WANTING to use the doors so then massive lag can be caused by pawns if enough are wanting to go through the door but can't.
...

I'm curious why you think that the misc mod doesn't stop the AI from wanting to go through the door?
In my tests, the pawns didn't try to path through the doors anymore. Do you have a different experience with it?
As far as I know, if the pathing to the target returns a value high enough, it is effectively not reachable.
So, because of this, they shouldn't try to use the locked doors from Misc anymore. At least in the newest version, where I've added the new pathing code.

I must have an old version I haven't been playing/DL'ing mods for a while.
░░░░░░░░░░░░░░░░░─╤▌██ |
░░░░░░░░─╤▂▃▃▄▄▄███████▄▃|
▂█▃▃▅▅███/█████\█[<BSS>█\███▅▅▅▃▂
◥████████████████████████████████◤
                           TO WAR WE GO

Neurotoxin

Updated for Alpha 6, fixed issues with pawns trying to path through unusable doors.

MonkeyWithAWrench

Hi there. I wanted a way to differentiate the doors, so I fired up photoshop and made a couple small texture changes so that they'd stand out a bit more. What I made is basically the same as the regular doors, only they have an "employees only" type name plate on them. I made two versions. One with a single warning plate that goes across the whole door, and one with two smaller plates that go on each side.
Here's what they look like:

Powered Door:
Wood Door:

I've included the images as well as the photoshop psd's in a file attached to the post, in case you'd like to use them yourself. Personally I prefer the look of the double plate doors, but I made both so I might as well include both.

Also I had two "problems" with the mod that were bugging me. First, installing it replaced ALL wood doors with the ones from this mod. It looks like this was caused by having <defName>DoorWood</defName> in the xml. I guess it was overriding the default for me. I simply changed it to <defName>DoorWoodCO</defName> and got the original doors back as well.
Second, The wood doors from this mod weren't carrying power. It appears to be caused by these doors missing a few lines in the xml, namely:

    <comps>
      <li>
        <compClass>CompPowerTransmitter</compClass>
        <transmitsPower>true</transmitsPower>
      </li>
    </comps>

Which is something that the vanilla wood doors do have. adding it to the mod's wood doors seems to restore power transmission just fine.

I call these "problems" just because they were issues that bugged me. I don't know if anyone else had these "problems" or if anyone even cared, but I figured I mention them anyway since I found a solution to them.

Anyway, thanks for the time.

[attachment deleted by admin: too old]