Increase rest without a bed?

Started by SlimeCrusher, March 03, 2014, 04:04:57 PM

Previous topic - Next topic

SlimeCrusher

I was developing a mod that will add a new crop and a recipe for Coffee, but i was wondering, is it possible to make it add rest instead of adding food? Although it could be easly abused to make colonists stay without resting basically forever, you have a colonist prepare drinks forever, thus a forever-standing colony, so i'd have to find a way to balance it out
Soo... Yea, is it possible to make a food increase the Rest bar?

Zagrom

I don't know how to do what your asking. But as far as balancing it, that should be pretty easy. Just make using it give give increasingly negative effects to happiness, less tired, more unhappy.

Good luck with this mod, could also try making like caffeine/sleeping pills that you could buy from traders, if you find the effects you could spread it into other items too.

Psyckosama

This actually gives me an idea for a booze mod... raise happy, raises tired.

Easiest way to recruit newbies: lock them in the wine cupboard.

Zagrom

Another idea, tranquilizer gun. Make people fall asleep.

Tho admittedly this would probably be harder then some of the other items we talked about here. As far as balancing on an item like this, I figure it would ether need to be limited on shots or have a % chance to be successful or something. Or be hugely inaccurate. Otherwise it would make things pretty massively easy. Just another idea though.

SlimeCrusher

Yea nice ideas, but until i know how to make it work, it seems impossible  :-\

Zagrom

Will, I mean it may sound obvious, but have you tried decompiling the code of the bed itself, find out what it does to reduce tiredness?  I havn't ripped into the code of the game myself, so I'm not sure how anything is handled right now myself.

I'm sure its doable, it just a matter of time before someone breaks down the how.

SlimeCrusher

Yea, i did, here's the code:
Quote   <ThingDef ParentName="BuildingBase">
      <defName>Bed</defName>
      <EType>Bed</EType>
      <Label>Bed</Label>
      <Description>A cozy mattress and sheets on a frame for resting. Rest effectiveness: 10/10</Description>
      <ThingClass>Building_Bed</ThingClass>
      <TexturePath>Things/Building/Bed/Bed</TexturePath>
      <IconMat_ForPrisoner>Things/Building/Bed/Bed_ForPrisoner</IconMat_ForPrisoner>
      <AltitudeLayer>Waist</AltitudeLayer>
      <MaxHealth>150</MaxHealth>
      <Size>(1,2)</Size>
      <WorkToBuild>175</WorkToBuild>
      <CostList>
         <ResourceCost>
            <thingDef>Metal</thingDef>
            <count>20</count>
         </ResourceCost>
      </CostList>
      <Bed_HealTickInterval>1000</Bed_HealTickInterval>
      <RestEffectiveness>1.0</RestEffectiveness>
      <Overdraw>True</Overdraw>
      <Beauty>Neutral</Beauty>
      <fillPercent>0.4</fillPercent> -Maybe has to do with rest filling?-
      <PathCost>60</PathCost>
      <LeaveResourcesWhenKilled>True</LeaveResourcesWhenKilled>
      <killedLeavings>
         <li>
            <thingDef>DebrisSlag</thingDef>
            <count>1</count>
         </li>
      </killedLeavings>
      <Bed_ShowSleeperBody>False</Bed_ShowSleeperBody>
      <StaticSunShadowHeight>0.17</StaticSunShadowHeight>
      <CastEdgeShadows>True</CastEdgeShadows>
      <DesignationCategory>Furniture</DesignationCategory>
      <Passability>PassThroughOnly</Passability>
      <DrawGUIOverlay>True</DrawGUIOverlay>
   </ThingDef>

That's all there is, not sure if anything hidden or anything

Zagrom

Ya, looks like every 1000 ticks it heals 4% of the full tiredness bar. The RestEffectivness being at 1 would mean it is 100% effective at healing the 4%, or at least that's what it seems.

The prime worry may be that the game only considered tiredness healing effects being objects that NPCs 'enter'. If that's the case you may need to change a core files on how it handles tiredness.

Another seemingly obvious thing, have you tried directly ripping the code from the bed and see if that will give the effects you need? From there trim off the unneeded until you get whats needed without breaking things.

SlimeCrusher

I think i'll wait until Alpha 3, it will more or likely don't work, i can maybe make a pod that uses coffee beans with a hopper to work, i'll see what i can do

Zagrom

haha, in the future you need a machine to inject your coffee into you.

I wouldn't say give up, but dropping the idea to work on other ideas could always help. Learning irrelevant things often helps with the ideas you want. Keep at it, one way or another.

Tynan

Food affecting fatigue is totally doable, but you need to code a new Thing, which means joining the test team (PM me!) or waiting for A3.
Tynan Sylvester - @TynanSylvester - Tynan's Blog