Bed that acts like the Enertron from Chrono Trigger?

Started by AileTheAlien, January 17, 2019, 10:37:43 PM

Previous topic - Next topic

AileTheAlien

I've wanted to make a bed-like device, that acts like the Enertron in Chrono Trigger. ("You feel rested and healthy, but you're still hungry.") How much of this would be possible with XML only?
- rests pawns quickly
- keeps pawns alive
- heals disease
- gives some kind of debuff or negative mood
- feels futuristic and post-apocalyptic

Looking at normal beds and bedrolls, it seems like I could use these tags to get close:
- <BedRestEffectiveness>: This would be set very high.
- <Comfort>: I can make it avery uncomfortable bed, and I *think* that would give a bad mood.
- <ImmunityGainSpeedFactor>: this would keep pawns alive if I cranked it up, but I'd rather have the pawns dependent on the device full-time, and not gain immunites. Is there something that would stop diseases from progressing instead?
- <SurgerySuccessChanceFactor>: I'd set this to 0, since the thing should be self-sufficient, and not be useful for surgery, but I'm worried pawns would still try to use it, and fail constantly.
- I could give it a suitable sprite, or just use the cryptosleep casket or something.

Kirby23590

I'm not sure if that being possible in XML, Since it heals disease or infections and gives some sort of debuff or negative mood when used...

I think you can do the part where the pawn sleeping on it is standing up or invisible when used is inside it like a cryptosleep casket with mostly XML...

I think it requires some parts of C# Coding for this when it heals and removes diseases and gives a negative moodlet when used...

If you look at the <ImmunityGainSpeedFactor> of the Hospital bed and the Regular bed, it feels a bit different when fighting against diseases, i think it speeds up the Immunity of which the Disease can be healed when the pawn is sleeping on it.

And no, there is no way to to stop Diseases from progressing unless using some sort of magic of C# Coding or borrowing some code from the Cryptosleep casket... There is some some modding tutorials of C# Coding in the Sort-of Official Rimworld Wiki...

but you're still hungry... -5 mood


One "happy family" in the rims...
Custom font made by Marnador.



AileTheAlien

Unfortunately, I don't have the time/energy to make anything more complicated than XML mods at the moment (coding is my day-job, so I try to relax on the weekends / evenings). So, instead of acting that closely to Chrono-Trigger, the bed now:
- sleep 10x
- immunity gain 2x
- some medical tend bonus
- some surgery bonus
- super ugly
- super uncomfortable
- very expensive (adds to colony wealth, for raids / makes it hard to trade for)

AileTheAlien

#3
One more thing - this bed appears to give the "slep on ground" debuff. Anyone know how that is triggered / ignored / whatever? I can't find anything in the base game's XML files that defines what counts as an "on the ground" bed.

Mehni

The thingClass has to be a Building_Bed or subclass thereof.

AileTheAlien


Mehni

//RimWorld.Toils_LayDown.ApplyBedThoughts

if (building_Bed == null || building_Bed.CostListAdjusted().Count == 0)
{
actor.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SleptOnGround);
}


It also can't be free. Add a costlist

AileTheAlien

Thanks!
OK, new one - is there a minimum time that pawns need to be asleep, before they'll get any kind of bedroom and/or sleep thoughts? It seems like if I jack the sleep-effectiveness past about 2x, they no longer get any debuffs from a horrible bedroom.

Mehni

Not that I see, though they can only get those thoughts once a day. Again, Toils_LayDown. Grab your decompiler and take a look.

A non-exhaustive list of things that matter:
- Does the pawn have a mood need? (For humans: almost certainly yes)
- The thingClass has to be a Building_Bed or subclass thereof. (previously established)
- The bed has to be assigned to/owned by/claimed by the person sleeping in it.
- The bed is not for prisoners.
- The sleeping pawn isn't ascetic.
- The role of the room (barracks or bedroom).
- The role of the bed (i.e. non-prisoner, non-medical).

AileTheAlien

Thanks! I don't actually have a decompiler; Last time I tried getting into that, none of the instrucitons had anything for Linux. All of the things you list should already be true (unless I Missed something), so I'll just do some experiments with sleep-speed, to see if I can get something consistent.

LWM

There's some instructions floating around the forum for installing mono-develop for Linux, but if you go to the https://www.monodevelop.com/ website, there's fairly easy instructions (if you pick the right repository to add ;p I got into trouble by picking the wrong one).  Mono develop has a decompiler built in for Linux.  It's not my favorite, but it does work!

If you already code for your day job, the C# to get closer to what you exactly want should be fairly easy, actually.  There's probably an easy way to make the bed give an xml-defined debuff via C#?  <glances at Building_Bed.cs>  Never mind.  Adding a comp class would do it fairly easily tho - your comp class could add a debuff to the bed owner every 2000 ticks, ever day, whatever?

Altho you seem to have managed a fair bit via XML ^.^

--LWM