Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - DeaconBlues

#1
That's amazing.  And here I was trying to solve a problem that already had a solution.  Thank's for pointing this out  ;D
#2
Alright, so I managed to track down the code that tells the colonists to consume beer and I've attempted to adapt it to look for a random def that has <isPleasureDrug>.  Unfortunately it doesn't seem to be working and I'm not quite sure why -- I have no experience in C# so it could be a number of things.  I did try to point to one of my defs explicitly in case it was the random portion that wasn't working, but still no go.  I'm thinking (Predicate<Thing>)null is likely the issue, but I have no idea how to fix it.  Any help would be much appreciated.

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
using Verse.AI;
using RimWorld;

namespace FinerThings
{

  public class JobGiver_SeekOtherDrugs : ThinkNode_JobGiver
  {
    public static ThingDef RandomDrug()
    {
        return GenCollection.RandomElement<ThingDef>(Enumerable.Where<ThingDef>(DefDatabase<ThingDef>.AllDefs, (Func<ThingDef, bool>)(def =>
        {
            if (def.category == EntityCategory.Item)
            {
                return def.ingestible.isPleasureDrug;
            }
            else
            {
                return false;
            }
        })));
    }

    public static class DrugThingDefOf
    {
        public static ThingDef Coffee;
        public static ThingDef Espresso;
        public static ThingDef Cigar;
        public static ThingDef Cigarillos;
    }

    private static readonly SimpleCurve DrugUseIntervalFactorCurve_Mood = new SimpleCurve()
    {
      new CurvePoint(20f, 0.4f),
      new CurvePoint(60f, 1f)
    };
    private static readonly SimpleCurve DrugUseIntervalFactorCurve_Drunkness = new SimpleCurve()
    {
      new CurvePoint(0.0f, 1f),
      new CurvePoint(1f, 4f)
    };
    private const int BaseDrugUseInterval = 60000;
    private const int DrugUseIntervalBinging = 600;

    protected override Job TryGiveTerminalJob(Pawn pawn)
    {
      int num1 = pawn.story.traits.DegreeOfTrait(TraitDefOf.DrugDesire);
      if (num1 < 0)
      {
          return (Job)null;
      }
      int num2;
      if (pawn.mindState.broken.CurStateDef != null && pawn.mindState.broken.CurStateDef == BrokenStateDefOf.BingingAlcohol)
      {
        return (Job) null;
      }
      else
      {
          num2 = (int)(60000.0 * (double)JobGiver_SeekOtherDrugs.DrugUseIntervalFactorCurve_Mood.Evaluate(pawn.needs.mood.CurLevel));
        if (num1 == 1)
          num2 = (int) ((double) num2 * 0.5);
        else if (num1 > 1)
          num2 = (int) ((double) num2 * 0.280000001192093);
      }

      if (Find.TickManager.TicksGame - pawn.mindState.lastPleasureDrugUseTick > num2)
      {
          Job job = JobGiver_SeekOtherDrugs.ConsumeDrug(pawn);
          if (job != null)
          {
              return job;
          }
      }
      return (Job) null;
    }

    private static Job ConsumeDrug(Pawn pawn)
    {
      Thing thing = GenClosest.ClosestThingReachable(pawn.Position, ThingRequest.ForDef(RandomDrug()), PathMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, true), 9999f, (Predicate<Thing>)null, (IEnumerable<Thing>)null, -1);
      if (thing == null)
          return (Job)null;
      return new Job(JobDefOf.Ingest, (TargetInfo) thing)
      {
        maxNumToCarry = Mathf.Min(thing.stackCount, thing.def.ingestible.maxNumToIngestAtOnce),
      };
    }
  }
}
#3
Thanks everyone for your feedback, and for noticing that typo :).  While I get the concern regarding your colonists taking a smoke break when they could be doing something better, I'm leaning more towards the auto consume option myself.  This seems to be more in line with the overall gameplay of RimWorld as right now it involves quite a bit of micromanagement and direct player interaction.
#4
Very cool, this could serve as a good example for my mod -- assuming I can figure out the whole assembly thing  :).  I'm curious though, does anyone know what causes colonists to automatically consume beer?  I thought it was maybe related to <isPleasureDrug> but this doesn't seem to be the case.
#5
Thanks, I actually had some similar thoughts myself...  Maybe making smokers take a hit to their social in exchange for the boosts or adding a smoker trait so that they get a negative mood if they haven't smoked recently -- same could go for coffee too really.  I'll have to see how the hangover mechanic currently works as that could be a good way to implement crashing when coming down off of caffeine, but I think it might be more involved than editing some defs (or I just missed it).
#6
I believe your current world should work fine.  May want back up your save just in case though...
#7
The Finer Things...
Now with More Booze, Tobacco, and Coffee...
Updated to utilize the new Joy system!

Forging a new life after crash landing on a planet is hard work, as we all know, so why not inject a bit of luxury into your colony?  That's where the The Finer Things comes in...

Now that the official Joy system has dropped, the inclusion of further alcohol and other joy giving substances seems all the more appropriate.  I've taken some liberties in how these various items are categorized as far as Joy's concerned, just to spread them across the spectrum of Joy built into RimWorld, but I think an argument could be made for their current classifications.  Details can be found below:

Alcohol
- Adds Strawberry Wine, Saki, Vodka, Whisky and Tequila
  - These function essentially just like beer, but, as some are more potent forms of alcohol, can result in greater intoxication when consumed by your colonists.  Be wary of the tequila  ;)
- Adds the Still.  This serves as the workbench where the above alcohol is distilled

Tobacco
- Adds Cigarillos and Cigars
  - In addition to providing a mood boost when consumed, tobacco products also boost a colonist's move speed and manipulation.
- Adds the ability to grow and harvest tobacco
- Adds the Tobacconist Workbench.  Here colonists can roll packs of cigarillos and cigars
- Consuming Tobacco products falls under the "Meditative" kind of Joy.  While admittedly both a Chemical and Social experience in certain settings, I felt that a lone colonist enjoying a Cigar would have plenty of time to reflect on their current state of being and take in the world that surrounds them.  Or at least that's my been experience.

Coffee
- Adds Coffee and Espresso
  - Once again, in addition to providing a mood boost (we are trying to keep those colonists happy), coffee products also boost a colonist's move speed and consciousness.
- Adds the ability to grow and harvest coffee
- Adds the Coffee Machine.  Here colonists brew both coffee and espresso
- Coffee products fall under the Social kind of Joy.  After all, coffee houses, depending on where you go of course, tend to be very social places.

Updates 4/20/2015
- In addition to the Alpha 10 mandated updates, I've also rebalanced tobacco and coffee.  Both plants now take much longer to grow, but the raw resources also sell for more with traders than most agricultural products -- the idea being that, since they can't be used for food, they're basically cash crops.  Hopefully I didn't go overboard.
- Once again, thanks to everyone for their suggestions so far.

Notes
- If anyone wants to adapt/re purpose parts of my mod, be it code or graphics, or include it in a mod pack please feel free.  I only ask for a credit  :)

Known Issues/Future Plans:
- No known issues at this time.  If one does find bugs please let me know.
- I do plan on adding more luxury type items in the future so stick around!

[attachment deleted due to age]
#8
Thanks, I tried to keep to the overall RimWorld style.

On a different note, the bug with the Still should be fixed now, my apologies, and everything seems to be basically working.  I'm still working on the mood benefit from statues and I really like the suggestion on trading so I'll look into that for both the booze and statues (why not right?).  Maybe I'll throw in some rock crafts for those especially dwarfy colonies... :P
#9
My thoughts exactly... :D

I'll have to look into the trouble with Still.  I had it working on my end but maybe I missed something.  The colonists do partake of the alcohol for sure, though in my experience they reach for the meals first.
#10
Yea... I'm still working out how to post images in line, but you raise a good point so I've included some preview images as attachments.
#11
The Finer Things...
Now with Booze and Sculpture!

Forging a new life after crash landing on a planet is hard work, as we all know, so why not inject a bit of luxury into your colony?  That's where the The Finer Things comes in...

Currently The Finer Things includes two additions, Alcohol and Statues.  The goal of the mod, besides adding more production options of course, is to make life a bit more bearable for your colonists.  I've haphazardly "balanced" everything, but I'm certainly open to suggestions.  Anyway, more details can be found below:

Alcohol
- Adds Strawberry Wine, Vodka, and Tequila
   - These are categorized as meals and give your colonists a positive boost in their moods, though the Strawberry Wine's is lessened due to it being the "cheap" alcohol
   - They do provide a nutritional benefit as well, but less so than their prepared meal equivalents
- Adds the Still.  This serves as the workbench where alcohol is distilled

Sculpture -- Artists now have a purpose
- Adds a simple, fine, and lavish statue
  - These serve as new resources once created which can then be "installed" by building them from the decoration section of the architect menu
  - Once installed, the statues carry the Gorgeous tag which, though I haven't seen it first hand so far, will hopefully make the environment more desirable.  If nothing else they do pretty the place up a bit  :P
- Adds the Sculpture Workshop.  This serves as the workbench where your Artists will create statue "parts".

Known Issues/Future Plans:
- Currently there is no boost (based on art skill level) to production time for creating statues.  I tried to add a new SkillNeedsDef but for some reason it was never recognized  :-\
- I would prefer the statues impart a mood bonus when witnessed, basically the opposite of corpses, but I was never able to find corpses in the core defs to act as an example.  Many thanks in advance to anyone who can help out...
- I do plan on adding more luxury type items in the future so stick around!

Download
https://dl.dropboxusercontent.com/u/96453975/finer_things.zip


[attachment deleted by admin: too old]