{MOD} (ALPHA 7) Pforzheim - the jewelry mod - by JuliaEllie (18.10.14)

Started by JuliaEllie, October 17, 2014, 07:31:30 PM

Previous topic - Next topic

Cat123

This is fantastic - you've coded dynamic mood checks!

public static int amountofjewelry(Pawn pawn)
{
int num = 0;
foreach (Thing current in pawn.inventory.container.get_Contents())
{
if (current.def.defName.Equals("jewel"))
{
num++;
}
}
return num;
}

and the rest

// Pforzheim.predictates
public static bool morejewelry(Pawn pawn)
{
return predictates.amountofjewelry(pawn) >= 5 && predictates.amountofjewelry(pawn) < 10;
}


Quick question - are Addedbodyparts counted as inventory items? Also, can you make this type of check use tags? i.e. if (current.def.defName.Equals("jewel")) --> if (current.def.def???.Equals("<isbionic>true</isbionic>").

Basically looking for a code way of checking the % of a pawn's body for bionic / other tagged parts.

Also: // Verse.Corpse
public Thought GiveObservedThought()
{
if (!this.sourcePawn.RaceProps.humanoid)
{
return null;
}
Thing thing = this.StoringBuilding();
if (thing == null)
{
bool flag = false;
CompRottable comp = base.GetComp<CompRottable>();
predictates.amountofjewelry
{
flag = true;
}
if (flag)
{
return new Thought_Observation(ThoughtDef.Named("ObservedLayingRottingCorpse"), this);
}
return new Thought_Observation(ThoughtDef.Named("ObservedLayingCorpse"), this);
}
else


Is it possible to attach GiveObservedThoughts to items? In this mod's case. e.g.


if predictates.amountofjewelry = Pforzheim.predictates.shitloadjewelry (flag)
{
return new Thought_Observation(ThoughtDef.Named("Flashy Bastard"), this);
}



e.g. If someone spots a pawn with >15 jewelery it triggers a thought.conditional in another pawn? Please say it's possible, this would be amazing for various clothing / relationship mods.

JuliaEllie

Hehe not only dynamic mood checks but also dynamic items and item generation ;) I played around with the observer thought some time ago and it should be possible to do what you want to do. On the body part topic - added body parts are not parts or items in any way. They are represented through HealthDiffs but there is indeed a List somewhere in the Pawn_HealthTracker which is called AddedBodyParts you could check its .Length() or Count() (I always mix those up.. worked with too many languages in my life :D) against the "natural" amount of BodyParts and get your percentage from this. 

Cat123

Quote from: JuliaEllie on November 18, 2014, 05:39:00 PM
Hehe not only dynamic mood checks but also dynamic items and item generation ;)

Ye, I noticed that, but haven't got to a stage where I want to use it apart from a recipe. So.. hmm. I'll probably PM you later this week with a bribe & code askance. [Need to make a weighted table for a mutation on single body part --> choose single outcome from list]

Quote from: JuliaEllie on November 18, 2014, 05:39:00 PMI played around with the observer thought some time ago and it should be possible to do what you want to do. On the body part topic - added body parts are not parts or items in any way. They are represented through HealthDiffs but there is indeed a List somewhere in the Pawn_HealthTracker which is called AddedBodyParts you could check its .Length() or Count() (I always mix those up.. worked with too many languages in my life :D) against the "natural" amount of BodyParts and get your percentage from this.

Given that alpha #8 is all about temperatures, and I've seen Tynan state that at the moment it only checks if wearing parka = true ... you've basically already coded a system for temperature that works far better.

i.e. Every clothing item has a <insulation> stat, then your code here tots it up, generates a total #, and then you can check that against the global temp - with varying degrees of outcomes. e.g. "Cold" = minor activity penalties to Manipulation; "Freezing" = major penalties to Manipulation, Mobility etc, then "Hypothermia" where the pawn throws off all it's clothes ;)

[calc total insulation of all worn items] - [global temperature] = # variable that => mood outcome with penalties. It'd require adding some tags/classes to moods so that there's more than just morale penalties, but seriously - this is gold.

I'm fairly sure you know the potential, but this mod could be the basis for the entire temperature system. :o

JuliaEllie

I will be more than happy to help you out on your mod :)

You might be right about that point but Im not here to do Tynans job ;) I only know that there will be temperature but nothing more - I dont want spoil the  surprise for myself :) But thats what I do those concept mods for. Showing what is possible and inspiring people to use the mechanisms for their own ideas. I was also working on something to snowfall and actual water puddles but then Tynan announced it for alpha 8 and I stoped :D