Ludeon Forums

RimWorld => Mods => Topic started by: Riph on November 06, 2014, 08:21:12 PM

Title: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Riph on November 06, 2014, 08:21:12 PM
One of the things I've been looking for in the mods section is a block which functions like the Dwarf Fortress drawbridge.  For those who don't play dwarf fortress, this is a wall panel that can be toggled by the user to flip up (as a shield) or flip down (as a walkable passage)

The reason for this is that I'd love to have certain areas of my colony protected by improvised turrets, but of course any random passing foe will just snipe them out rather than get in range.  With this item you could wait until the pirates are in range, then surprise them with a wall panel that opens up revealing guns.  I'd also like to be able to 'flip up' a protective armor plate in front of my colonists' pillbox during a firefight if one of them gets badly wounded and needs to withdraw.

The bridge part of the drawbridge is largely unnecessary because Rimworld doesn't feature z levels.  It could be implemented as an 'automatic window' toggleable by the user and it'd be great.

Also if anything like this exists now, please link me!
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Coenmcj on November 06, 2014, 10:50:20 PM
I Guess technically there is something similar to that, TechTree minami's blast doors, ( Or whatever subsidiary mod it came from) But those are 2x5 Monstrosities, rather large for hiding turrets I think.

Edit ; If someone does make a smaller one, what would the possibility of something having toggleable cover properties?
Like from something the height of a sandbag to a full blown wall?
For embrasure type pillboxes that turn into full-on bunkers at the click of a button
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: skullywag on November 07, 2014, 03:31:24 AM
Technically possible but would be a dll mod. Its trivial to change the properties of a thing on the fly.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Timber on November 07, 2014, 04:28:05 AM
How wide do you want it?
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Riph on November 07, 2014, 03:16:28 PM
Quote from: Timber on November 07, 2014, 04:28:05 AM
How wide do you want it?
I was thinking 2x1, though that's an excellent question.  I don't suppose it's possible to make it 1x1 so that the user can simply drag out as many as they like to get an exact width?  In my mind that's the best solution, but if there's unexpected difficulty then 2x1 or 3x1 is probably acceptable.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 07, 2014, 03:46:08 PM
This can be done rather easy with dll, and i say easy since my c# nobish self did that :D
Works preety well and its totally op :D
Draggable is preety hard for the animation :/
But its not hard if there is no animation.
Basic concept is that after button is pressed current object get destroy and the other object is spawned.
I dont have walls realesed but i did exackly same method on wierd lamps in clutter realese.
Problem with walls i did encouter is roof, even thrugh both object support roof, when you build a long walls and do switch on them all at once even thrugh its instant to human eye, sometimes roof will calapse .
Which can be fixed by spawning third object after pressing the button but before the first wall gets destroyed.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Riph on November 07, 2014, 03:51:33 PM
Quote from: mrofa on November 07, 2014, 03:46:08 PM
Basic concept is that after button is pressed current object get destroy and the other object is spawned.
Are you able to retain the building's HP?  Otherwise wouldn't it get a full heal every time you switch its state?
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: skullywag on November 07, 2014, 04:15:08 PM
I See this as when gui button press update texture and change passable paramater in def indstance, no need for spawning extra objects or anything. Ill whip up a proof of concept in the next few days.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 07, 2014, 04:20:46 PM
Quote from: Riph on November 07, 2014, 03:51:33 PM
Quote from: mrofa on November 07, 2014, 03:46:08 PM
Basic concept is that after button is pressed current object get destroy and the other object is spawned.
Are you able to retain the building's HP?  Otherwise wouldn't it get a full heal every time you switch its state?

Oh i didnt even think of that :D
But it can be done reather easily.

Quote from: skullywag on November 07, 2014, 04:15:08 PM
I See this as when gui button press update texture and change passable paramater in def indstance, no need for spawning extra objects or anything. Ill whip up a proof of concept in the next few days.
Oh that would be cool, good luck with that mate :D
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: minami26 on November 07, 2014, 08:35:53 PM
You just need to change the <fillPercent> paramter if it is greater than 0.9 then it is considered a wall that blocks line of sight,, i tried only changing textures in dll but it doesnt work for me that is, you need to make a custom Draw() function for that and instantiate the textures there. Oh and the blast doors are mine :) have fun working on it skully!
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Lozza on November 08, 2014, 05:34:20 AM
Really liking this idea! Can't help though, but I support it.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Riph on November 09, 2014, 01:53:43 AM
Quote from: Coenmcj on November 06, 2014, 10:50:20 PM

Edit ; If someone does make a smaller one, what would the possibility of something having toggleable cover properties?
Like from something the height of a sandbag to a full blown wall?
For embrasure type pillboxes that turn into full-on bunkers at the click of a button

This sounds fantastic.  The ideal implementation is probably something like a 'blast window' that, when set to the open state allows firing through but provides cover, and when set to the closed state is completely impassable to walking and shooting.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 09, 2014, 05:24:44 AM
Did a example mod with destroy method here (https://www.sendspace.com/file/h2r0wv).
And with fix to retain hp like Riph stated :D

Changing stuff like fillprocent or traversability on one objects is kinda beyond my abilities so i hope skully will make it so there will be from where to copy/place :D
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: kentauros87 on November 09, 2014, 09:16:50 AM
Urist would be so proud of that
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: skullywag on November 09, 2014, 03:25:58 PM
Been playing and made some progress, there was some hitches to how I thought this would but work my basic idea was sound.

So images below:

GoingIn.jpg - ive triggered the wall to be lowered (no texture for this yet, still doing the code part) Pawns can pass through no problem.

GoingOut.jpg - they can come back out no problem

CantComeOut.jpg - ive raised the wall with them inside, they cannot path out (one of the bugs is usually youd get "no path" popup, but here it tries to calculate.

As stated I have some bugs to iron out, but if people want to experiment, the place to look is:

Find.Map.pathGrid.

Ill go back to playing and hopefully iron some of these quirks out. To be clear no "thing" was destroyed, its the same object in that tile. ;)

Edit - actually ive found a rather cleverer way while experimenting, seems promising so far, ill post back soon hopefully

[attachment deleted by admin: too old]
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 09, 2014, 04:14:17 PM
Thats very cool, how did you do that ?
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: skullywag on November 09, 2014, 04:29:44 PM
Bah it was all going so well, regions are recalculated randomly throughout the game this breaks my way quite considerably as it technically resets my wall back to normal (but the gui button remains active)....there must be a way to not let my object update unless button is pressed...grrr...
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mipen on November 10, 2014, 04:09:58 AM
Hey guys, I have made a toggleable wall in my mod https://ludeon.com/forums/index.php?topic=7380.0 (https://ludeon.com/forums/index.php?topic=7380.0) How I got it to work well is to have the toggle button switch between two buildings: one which is a wall, and another which is a floor emplacement. The health is passed through the constructor so they have the same health. They require power to operate, and I will probably add a time limit between switching, however the time it takes to reconnect to the power when it switches is a few seconds which is reasonable enough. They are made from stuff so you can build them from anything as well. If I got permission from the guys who did the embrasures mod, I could also add a button which changes the wall into an embrasure. Let me know what you think! :D
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: skullywag on November 10, 2014, 04:14:41 AM
Yeah weve got building switching via changing objects sorted we are currently trying to do it all in one object. I have it working except some region madness.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: Riph on November 10, 2014, 04:57:52 AM
Looks good Mipen.  Can you tell us if you've tested if this wall will cause cave-ins if a long line of them are toggled at the same time (because for a brief instant they're in a nothing-state?)  That concern was raised earlier in the thread.

It's not a huge issue if it does, I'd just like to know.  It would be understandable if our amazing toggleable walls were not load bearing.
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mipen on November 10, 2014, 04:16:26 PM
Quote from: Riph on November 10, 2014, 04:57:52 AM
Looks good Mipen.  Can you tell us if you've tested if this wall will cause cave-ins if a long line of them are toggled at the same time (because for a brief instant they're in a nothing-state?)  That concern was raised earlier in the thread.

It's not a huge issue if it does, I'd just like to know.  It would be understandable if our amazing toggleable walls were not load bearing.
I have set both states to not support a roof, so either way it will cause a cave in :P it was just easier to do it this way, and I guess you could make up some lore of how to mechanisms to raise/lower the walls aren't strong enough to also support a roof :P
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 10, 2014, 04:20:05 PM
What do you mean load bearing ?
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mipen on November 10, 2014, 06:50:22 PM
Quote from: mrofa on November 10, 2014, 04:20:05 PM
What do you mean load bearing ?
To be able to support a weight other than its own, in this case a roof :)
Title: Re: [Mod Request] Toggleable Wall Panel / Dwarf Fortress Drawbridge
Post by: mrofa on November 11, 2014, 03:56:19 AM
Ahh than
Quote from: mipen on November 10, 2014, 06:50:22 PM
Quote from: mrofa on November 10, 2014, 04:20:05 PM
What do you mean load bearing ?
To be able to support a weight other than its own, in this case a roof :)
Ahh thanks :D

Make a check after pressing a button if any wall that is linked to selected wall is in sandbag state, selected wall wil not change.