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

Topics - 1000101

#1
Outdated / [A14] Pastafarianism v3 (15/08/2016)
August 02, 2016, 01:06:28 AM


Our Pasta

Our Pasta, who "Arghh" in heaven, Swallowed be thy shame. Thy Midgit come. Thy Sauce be yum, On top some grated Parmesan. Give us this day our garlic bread. And give us our cutlasses, As we swashbuckle, splice the main-brace and cuss. And lead us into temptation, But deliver us some Pizza. For thine are Meatballs, and the beer, and the strippers, for ever and ever. RAmen.






A nice temple for the colonists


Don your colander and pray to the mighty FSM!




This mod requires Community Core Library v0.14.2 or later for ThinkTree injection points




This mod shows off a basic proof of concept for adding a religion framework to the game (to be expanded on and made modder friendly later).  Currently, it's a silly little mod made after a short conversation in the RimWorld Modding Slack.

This mod adds a new need - Pastafarianism - for your colonists and depending on the average colony level two different incidents can occur.  If the average need is low then the Flying Spaghetti Monster may downgrade some of your meals one level (lavish->fine->simple->paste) and if the colony average is high, then the FSM may upgrade some of your meals one level (paste->simple->fine->lavish).

Colonists also have thoughts based on the their "Pastafarianism need" ranging from a -10 mood debuff to a +10 mood buff.

The need is prioritized and balanced against the other needs so your colonists aren't starved for any single need and will take the appropriate actions at the appropriate times to fulfill them.  Right now the Pastafarianism need can only be filled when the colonist is allowed to to joy activities.  I may add special scheduling for this later but currently it works well and I feel it fits in with the joy scheduling.  That being said, this need is completely independent of joy and the only overlap is the scheduling.

To increase a colonists Pastafarianism meter build a totem for them to pray at.  If you have colanders for your colonists, they will put one on (stashing their current hat in their inventory) before praying which will double the effectiveness of their prayers.  Once done praying they will drop the colander and put their hat back on (and remember whether it was forced or not).



THIS MOD IS SILLY AND NOTHING ELSE!  IT IS ONLY A PROOF OF CONCEPT!


Credits:
Code: 1000101
Colander: 3dgrunge
Small Totem: Shinzy
Large Totem: Interwebs




changelog:
v3 (15/08/2016):
+ Pastafarianism need doesn't go down when a pawn is in bed
+ Mod now makes use of CCL's ThinkTreeDef injection points, specifically for needs so it doesn't completely overwrite the sub-trees
+ Prisoners can properly fill their Pastafarianism need as long as there is a totem in their prison
+ Small bugs fixed which would cause null reference errors for prisoners
+ Totems are "socially proper", colonists won't use totems in prisons and prisoners won't try to use totems outside of prisons

v2 (03/08/2016):
+ Changes the ThinkTree to PreMain and uses a need priority sorter to balance the need with other needs and work jobs
+ Adds a room role for "temples"
+ Adds thoughts similar to the joy need thoughts to give a more immediate incentive to dealing with the need
+ Fixes a save/load bug regarding stashing hats (everything worked but apparently equiping apparel from inventory doesn't remove it from the inventory)
+ Tweaks the incidents weights for the average colony need as well as doubling the weight for "very high" (>90%) and "very low" (<10%)
+ Added the graphics for shinzy's small totem which I forgot to in the original release

v1 (31/07/2016):
+ First release showing a silly proof-of-concept mod for religion





Mods used in screenshots:

Note:  The above mods are mentioned only because they are depicted in the screenshots.

[attachment deleted by admin - too old]
#2
ModLister.InstalledModsListHash() always uses an alphabetical list of mods and not the load order list which means that it will not reload the mods when the load order changes.  I have detoured this in CCL to use ModsConfig.ActiveModsInLoadOrder and it correctly reloads the mods if the load order changes.
#3
Bugs / [0.14.1234] Cannot find siege spot...
July 16, 2016, 08:07:11 PM
If you build walls around your colony to completely encircle it at the very edge of the buildable area, the siege will spawn but will throw an error.

Could not find siege spot from (0, 0, 26), using (0, 0, 26)

Screenshot of colony (max zoom 960x960 px):
https://www.dropbox.com/s/tc9620oceseey1n/Siege_Error.png
#4
Prisoners & Slaves

This is a mod about the size and scope of Hospitality by Orion.  Unlike Hospitality, which deals with guests, this mod deals with wardens and the prisoners and slaves they need to keep in line.

When this mod is ready for release I will create it's own thread for it.  I only post this now because some people have seen it and others asked.  This is going to be kept to list form with a follow up post with some early screen shots.

Things that are done:

  • Custom door class with auto-replacer (only works for building new doors, existing doors when added to a save will be vanilla)
  • Restrictions for custom doors (allow prisoners, slaves, guests or only the room owners) as well as the ultimate override - Lock.  That's right, doors can be physically locked again (pawn flick job to [un]lock).  Wardens can also remotely auto-[un]lock autodoors (and designate other doors) when monitoring security stations (more on security stations below).
  • Room markers for designating that prisoners and/or slaves may enter it.  Two in-game objects exist for this, a simple no-cost sign and small material cost (and with some vanilla research) security cameras which have "observable cells" (controlled by placement rotation, FoV, range and LOS) which can be remotely monitored at...
  • ...Security stations for remotely monitoring multiple cameras in different areas at the same time which come in two tiers:

    • The first unlockable with security cameras can monitor three cameras at the same time.
    • The second tier research bench (after a little more vanilla research) can monitor 12 cameras at the same time.
    The warden monitoring the security station will cycle through all the colonies cameras based on how long it's been since it was monitored last.  If there is "something of interest" in a cameras observable cells (ie, a hostile threat, crime (WIP, see below), etc), the warden will "lock onto" that camera (until all the monitors are locked onto something) and auto-lock all doors to that room (see above).
  • A new utility minimap overlay to show security camera coverage to help you with...
  • ...the pawn minimap overlay overrides to restrict non-colonists (wildlife, prisoner, guests, hostiles, etc) to only showing up if "the colony" has a LOS to the pawn - either direct LOS from a colonist or in an observable cell of an actively monitored security camera.  (May make this toggleable for wussies.)
  • Wardens will enforce "laws" in the colony if they see one being broken - direct LoS, alerted by a warden monitoring a security station or monitored at a security station.
    Currently, there are only two laws:

    • Public drunkenness - If a pawn is "drunk" or more severely intoxicated and is in a "public place" (room they don't own), a warden will escort colonists to their private rooms to "sleep it off" or they will be arrested, taken to prison and released* after one day.  Non-lethal** force is authorised.
    • Social fighting - The instigating pawn will be arrested, taken to prison and released* after one day.  Non-lethal** force is authorised.
    * Releasing after their time is up is not yet implemented.
    ** "Non-lethal" means that the weapon has the "stun" effect.  They will still Rodney King his ass.
  • Non-lethal weapon(s):

    • A "side handled baton" - Currently the only non-lethal.  Common to police forces everywhere is the simple baton, does 1 physical damage but can stun the target.  Useful for subduing those pawns who resist arrest.
  • Lockable apparel which applies to separate and explicit hand cuffing and leg shackling, and the real reason you're hear - slave collars.
    These apparel items can be freely removed from corpses or the prisoner/slave has to be explicitly marked for cuffing/shackling which is a warden job.  Prisoners have an "interaction mode" for enslavement and slaves have an interaction mode for release.
    The only other way to try to remove them is to pick the lock.  Picking the lock is always successful but it takes time which is factored by the quality of the lock (apparel quality), manipulation capacity of the pawn, whether they are trying to pick the lock on an apparel they or someone else is wearing (it's harder to pick your own cuffs).
    The new "apparel":

    • Slave Collars - Shave a prisoners head and slap this around their neck.  Turn any prisoner into a slave who can then be forced to labour for the colony.  All work types unrestricted despite their back stories with the exception of warden which is always locked out to slaves.  Slightly reduces movement speed, global work speed and social impact.
    • Hand Cuffs - Reduces a pawns manipulation capacity by 90% (and prevents them from picking up items WIP)
    • Leg Shackles - Reduces a pawns moving speed by 40%.  Slow those prisoners and slaves down if they try to run.
  • New Prisoner/Slave tab on pawns.  New features added for new functionality, layout changed a bit for easier usage.
  • New Slave main tab.  A combination of the Work and Assignment tabs.

    • Work - Assign any work to a slave regardless of their back story restrictions.  The only work slaves can't do is warden.
    • Restrictions - Restrictions menu also allows you to quick set their daily schedule as well "gets food", "cuff", "shackle" and "medical needs" at a glance without having to open each individual slave.  Slaves can not be restricted by area, instead they have rooms they are allowed to enter using a room marker and the individual door settings (both mentioned above).
    I plan on doing a similar main tab for prisoners which will basically be the same as the slave restrictions tab (sans scheduling) for easier prisoner management.
  • Wardens, prisoners and slaves AI has been "heavily" modified - wardens have a couple new jobs, prisoners and slaves have a new think sub-tree.  Most of the changes relate directly to the above information.
    eg, prison escapes:  Relative movement speeds and distances to colonists with a LOS, their weapons range, visibility by security cameras (any, they don't know whether a camera is currently/ever monitored), etc all play into whether a prisoner/slave will try to escape.
  • Mod Configuration Menu for default global settings, some can be changed and saved per-game.
  • When buying slaves, they come as slaves (with collar, perhaps other restraints) [toggleable:  Bought slaves become colonists (no collars or restraints, vanilla behaviour)]
  • New random trait "empathic" which is the polar opposite of the vanilla "psychopath" trait.
  • Some vanilla memories have been changed in accordance with the new trait.  Only empathic pawns suffer debuffs from organ harvesting, executions, taking slaves, etc.  Inversely, psychopaths get the same mood buff for the same things.
    Everybody else is basically indifferent to your Orwellian Nightmare.
    The "harvested from me" memory is left untouched (-30 for harvesting organs for the harvestee).
  • Some new room role workers with room markers:

    • "Prison yard" - an outdoor area with 300 or more open roof tiles allowing prisoners.
    • "Prison commons" - indoors and outdoor areas with fewer than 300 open roof tiles also allowing prisoners
    • "Slave work area" - For rooms allowing slaves, a very low prioritised room role when no other better role exists.
  • An even more punishing mood debuff for slaves than "imprisoned".

Things to do:

  • Re-write the prison escape lord driver to factor deeper changes into account (such as picking locks on apparel items, doors, etc)
  • Look at additional laws for other anti-social behaviour.
  • Law main tab where individual laws can be enabled/disabled and have their parameters tweaked (allow use of lethal force to subdue, type of punishment (prison, house arrest), length of incarceration).
  • Slave smuggling jobs to take raw resources into prisons for...
  • ...prisoner crafting jobs at "hidden" crafting stations (ie, crafting spot hidden under a bed, only usable by prisners, etc) including simple weapons like shivs, and "pruno".
  • Stuff I'm forgetting I'm sure.

This future release is based in concept (and some assets) from Wastelanders Prison Improvements v1.1.  Assets used - Some of the graphics, core concept of the original code but it has been substantially expanded and virtually all of the original code has been re-written.

New assets (graphics) by 1000101 (icons), shinzy (basic security station, security camera) and mrofa (advanced security station).

Assets (graphics) used with the permission of Tynan from A9 (I think I used the A9 versions) - Lock icon and locked overlay.

July 22nd, 2016:

Pre-Release Download!
Requires CCL v0.14.1 or later

[attachment deleted by admin - too old]
#5
milon:
So it looks like you *can* inherit Abstracts from other mods (see quote from Ison below).  I'm locking this thread now, but I'm leaving it intact.  I'll leave it stickied for now so hopefully everyone will see the update.  If there are any problems/concerns, PM a moderator and we'll take the appropriate action. 

Quote from: ison on January 26, 2017, 09:46:50 AM
I've just tested it and it seems that it is possible to inherit XML nodes like BuildingBase from other mods, so I'm not sure if this thread is still valid.





To all modders

Apparently there is bad information regarding xml inheritance.  Specifically regarding abstract definitions.

The prevailing thought pattern is that abstracts are inheritable across mods.  This is not true.  An abstract can only be inherited across files within the mod that defines it.  This is known as scope and trying to inherit from another mods abstract will result in it being "out of scope".  This is similar to the "using" statement in assembly sources which defines a namespace as "in scope" allowing referencing to classes in the namespace defined without explicitly referencing the namespace.

The big offender is "BuildingBase" which many modders are not defining thinking that they can inherit.  While none of the abstracts are inheritable, "BuildingBase" is used most often.

Please check your output_log.txt/Player.log and resolve any errors before releasing your mods.  Don't rely on the debug window popping up!

The issue with abstracts and errors, however, is that they do not show an error or even a warning directly.  Trying to inherit from an abstract which doesn't exist will result in the fields in the def which are not set by the def to be set to the default for the class (eg, ThingDef).  This can cause subtle errors which may not show as a direct link to the missing abstract.

While the game may "work," these errors can cause problems with other mods.  The Community Core Library is especially sensitive to xml errors and many users are experiencing problems and reporting bogus/junk bugs due to this.

Thank-you for reading this,
1000101

Edited 12/08/2016:  Fixed some typographical errors and added information regarding the lack of errors when trying to use undefined abstracts.

Edit 15/11/2016:

TL;DR

If you don't define an abstract, don't use it.  No errors will be thrown by the game about missing abstracts but they can and will cause subtle errors which may not detectable at first or without other mods installed.

Bogus error reports and disgruntled users can be avoided by simply defining abstracts.

Guarantee the success of your own mods and others by defining every abstract you use.


Skullywag also posted this boiled-down information as PSAs:
[Mods Subforum]
[Help Subforum]
[Releases Subforum]
#6
e's small mods

This is the public release of some small RimWorld mods I made for myself.

All mods require the Community Core Library and unless otherwise noted, all mods work on existing saves.



Custom Population - v0.14.0
REQUIRES: CCL v0.14.0 or later

Adds an MCM to allow you to override the population settings of all installed storytellers.



Do Not Disturb - v0.14.0.2
REQUIRES: CCL v0.14.0 or later

Pawns don't like other pawns just waltzing into their personal rooms. When pawns really want privacy, they'll let you know by forbidding their room doors from other pawns.

This mod uses a map component which checks twice per second (every 30 "ticks") for the status of colonists. It won't forbid/unforbid while paused. Drafting sleeping colonists will unforbid their doors, give them half a second, they just woke up.



Mine Vein - v0.14.0
REQUIRES: CCL v0.14.0 or later

A handy tool to designate an entire vein of resources to be mined at once. You will find the new "Mine Vein" designator beside the "Mine" designator in the orders tab.  The designator will also appear directly on mineable resources when selected.



Mountain Temp - v0.14.0
REQUIRES: CCL v0.14.0 or later

Just below the surface of the planet, the rock is a fairly stable temperature. This mod stabilizes rooms with any portion of a natural roof to either the seasonal average, annual average or a fixed point temperature (configurable in the MCM). The more and thicker the natural roof, the more it will move towards this temperature. Extreme temperatures can still effect rooms deep underground through the passage ways leading to them so don't expect a constant temperature all the time.



Smooth Wall - v0.14.0.2
REQUIRES: CCL v0.14.0 or later

Requires Stonecutting research.

Tired of mining for rock chunks and coming up short? Want some strong, beautiful, natural walls? After digging a cave in the mountain you can just carve out a new environment by smoothing the walls. Because they are solid rock, don't expect to build anything under them. You will find "Smooth Wall" next to "Cancel" in the structures tab.  The designator will also appear directly on rock walls when selected.



Download

All mods are separate and unique downloads.

github



Credit

All credit for designator textures go to mrofa and shinzy.



Redistribution and General License

All source is original.

Permissions:  I am no longer modding RimWorld.  I give free and clear permission to anyone who wants to update and upload these mods.  Please give me credit for the original implementation but you are otherwise free to do with them as you will.
#7
For some reason when a part of my code is loading references from a save game, the reference being loaded changes class.

To wit:
Misaligned load ID request. Requests didn't match between the LoadingVars and ResolvingCrossRefs stage. Id MealSimple384145 was entered as a Verse.Thing but is being read as a Verse.Pawn.
Exception getting object with load id MealSimple384145 of type Verse.Pawn. What we loaded was MealSimple384145. Exception:
System.InvalidCastException: Cannot cast from source type to destination type.

  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_castclass (object,intptr)

  at Verse.LoadedObjectDirectory.ObjectWithLoadID[Pawn] (System.String loadID) [0x00000] in <filename unknown>:0


This happens between the LoadingVars (which is done without issue) and ResolvingCrossRefs stage when the error is thrown.  However, when it tries to resolve the reference, it complains the other way:
Misaligned load ID request. Requests didn't match between the LoadingVars and ResolvingCrossRefs stage. Id null was entered as a Verse.Pawn but is being read as a Verse.Thing.

The code which causes this is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using RimWorld;
using UnityEngine;
using Verse;
using Verse.AI;

namespace CommunityCoreLibrary
{
    public class RefrigeratorContents : IExposable
    {
        // This is to handle the degredation of items in the refrigerator
        // It is capable of handling multiple items in multiple cells
        public Thing                    thing;
        public int                      HitPoints;
        public float                    rotProgress;

        public RefrigeratorContents()
        {
            // Default .ctor
            // Needed for Scribing
        }

        public RefrigeratorContents( Thing t, CompRottable compRottable )
        {
            thing = t;
            HitPoints = t.HitPoints;
            rotProgress = compRottable.rotProgress;
        }

        public void ExposeData()
        {
            Log.Message( "\tRefrigeratorContents::ExposeData() {\n\t\tScribeMode: " + Scribe.mode );
            Scribe_References.LookReference( ref thing, "thing" );
            Scribe_Values.LookValue( ref HitPoints, "HitPoints" );
            Scribe_Values.LookValue( ref rotProgress, "rotProgress" );
            Log.Message( "\t} // RefrigeratorContents" );
        }

    }

    public class CompRefrigerated : ThingComp
    {
        private List< RefrigeratorContents >    contents = new List< RefrigeratorContents >();

        private CompPowerTrader         compPower
        {
            get{ return parent.GetComp<CompPowerTrader>(); }
        }

        private Building_Storage        thisBuilding
        {
            get{ return (parent as Building_Storage); }
        }

        public override void PostExposeData()
        {
            base.PostExposeData();

            Log.Message( thisBuilding.ThingID + "::PostExposeData() {\n\tScribeMode: " + Scribe.mode );

            Scribe_Collections.LookList<RefrigeratorContents>( ref contents, "contents", LookMode.Deep );

            Log.Message( "} // " + thisBuilding.ThingID + "::PostExposeData()" );
        }

        public void ScanForRottables()
        {
            // Check for things removed
            bool restartScan;
            do
            {
                restartScan = false;
                foreach( RefrigeratorContents item in contents )
                {
                    if( ( item.thing.Destroyed )||
                        ( item.thing.StoringBuilding() != thisBuilding ) )
                    {
                        // Modifing list, restart scan
                        contents.Remove( item );
                        restartScan = true;
                        break;
                    }
                }
            }while( restartScan == true );

            // Add new things
            foreach( Thing t in thisBuilding.slotGroup.HeldThings )
            {
                CompRottable compRottable = t.TryGetComp<CompRottable>();
                if( ( compRottable != null )&&
                    ( contents.Find( item => item.thing == t ) == null ) )
                    contents.Add( new RefrigeratorContents( t, compRottable ) );
            }

        }

        public override void CompTick()
        {
            base.CompTick();

            // Only do it every 60 ticks to prevent lags
            if( !Gen.IsHashIntervalTick( parent, 60 ) )
                return;

            RefrigerateContents();
        }

        private void RefrigerateContents()
        {
            // Only refrigerate if it has power
            // Don't worry about idle power though
            if( compPower.PowerOn == false )
            {
                // Clear it out
                if( contents.Count > 0 )
                    contents = new List<RefrigeratorContents>();
                // Now leave
                return;
            }

            // Look for things
            ScanForRottables();

            // Refrigerate the items
            foreach( RefrigeratorContents item in contents )
            {
                CompRottable compRottable = item.thing.TryGetComp<CompRottable>();
                item.thing.HitPoints = item.HitPoints;
                compRottable.rotProgress = item.rotProgress;
            }
        }
    }
}


There are caveman debugging messages in the code which is how I tracked it to happening between the two stages, but I can't figure out why.

Saving works and it writes the "contents" as it should.
<thing Class="Building_Storage">
<def>RefrigeratedMealShelf</def>
<id>RefrigeratedMealShelf147715</id>
<pos>(128, 0, 54)</pos>
<rot>3</rot>
<health>100</health>
<stuff>Steel</stuff>
<faction>Colony915677562</faction>
<contents>
<li>
<thing>MealSimple314344</thing>
<HitPoints>50</HitPoints>
<rotProgress>39310</rotProgress>
</li>
<li>
<thing>MealSimple384145</thing>
<HitPoints>50</HitPoints>
<rotProgress>855</rotProgress>
</li>
</contents>
<parentThing>RopeLight149507</parentThing>
<keepOnTicks>180</keepOnTicks>
<curPower>-200</curPower>
<curUser>null</curUser>
<settings>
<priority>Important</priority>
<filter>
<disallowedSpecialFilters>
<li>AllowCorpsesColonist</li>
<li>AllowCorpsesStranger</li>
<li>AllowBuried</li>
</disallowedSpecialFilters>
<allowedDefs>
<li>MealNutrientPaste</li>
<li>MealSimple</li>
<li>MealFine</li>
<li>MealLavish</li>
</allowedDefs>
<allowedHitPointsPercents>0~1</allowedHitPointsPercents>
<allowedQualityLevels>Awful~Legendary</allowedQualityLevels>
</filter>
</settings>
</thing>


And the meals exist in the save file:
<thing Class="Meal">
<def>MealSimple</def>
<id>MealSimple314344</id>
<pos>(128, 0, 54)</pos>
<health>50</health>
<stackCount>10</stackCount>
<rotProg>39310</rotProg>
<ingredients>
<li>WildBoar_Meat</li>
<li>Muffalo_Meat</li>
<li>Squirrel_Meat</li>
</ingredients>
</thing>
<thing Class="Meal">
<def>MealSimple</def>
<id>MealSimple384145</id>
<pos>(128, 0, 55)</pos>
<health>50</health>
<stackCount>2</stackCount>
<rotProg>855</rotProg>
<ingredients>
<li>Squirrel_Meat</li>
<li>WildBoar_Meat</li>
</ingredients>
</thing>


The full error log (less spam) of this problem:
RefrigeratedMealShelf147715::PostExposeData() {
ScribeMode: LoadingVars
RefrigeratorContents::ExposeData() {
ScribeMode: LoadingVars
} // RefrigeratorContents
RefrigeratorContents::ExposeData() {
ScribeMode: LoadingVars
} // RefrigeratorContents
} // RefrigeratedMealShelf147715::PostExposeData()
RefrigeratedMealShelf147715::PostExposeData() {
ScribeMode: ResolvingCrossRefs
} // RefrigeratedMealShelf147715::PostExposeData()
Misaligned load ID request. Requests didn't match between the LoadingVars and ResolvingCrossRefs stage. Id MealSimple384145 was entered as a Verse.Thing but is being read as a Verse.Pawn.
Exception getting object with load id MealSimple384145 of type Verse.Pawn. What we loaded was MealSimple384145. Exception:
System.InvalidCastException: Cannot cast from source type to destination type.

  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_castclass (object,intptr)

  at Verse.LoadedObjectDirectory.ObjectWithLoadID[Pawn] (System.String loadID) [0x00000] in <filename unknown>:0
RefrigeratorContents::ExposeData() {
ScribeMode: ResolvingCrossRefs
} // RefrigeratorContents
RefrigeratorContents::ExposeData() {
ScribeMode: ResolvingCrossRefs
Misaligned load ID request. Requests didn't match between the LoadingVars and ResolvingCrossRefs stage. Id null was entered as a Verse.Pawn but is being read as a Verse.Thing.
} // RefrigeratorContents
RefrigeratorContents::ExposeData() {
ScribeMode: PostLoadInit
} // RefrigeratorContents
RefrigeratorContents::ExposeData() {
ScribeMode: PostLoadInit
} // RefrigeratorContents
RefrigeratedMealShelf147715::PostExposeData() {
ScribeMode: PostLoadInit
} // RefrigeratedMealShelf147715::PostExposeData()


Anyone with any thoughts?
#8
This issue still exists but you did put it in the Mantis.  I see in the log that you made changes to deal with it, but it doesn't actually reduce the texture size as can be seen from the logs and the problem still being there.

Texture2D 4096x4096 won't fit, reducing size (needed mem=65536 used mem=48 allowedmem=26195)
Texture2D 4096x4096 won't fit, reducing size (needed mem=65536 used mem=48 allowedmem=26195)


Hope this helps some.  :)
#9
I'm not sure if I should have posted it here, it is a "real bug" but not one that effects actual game play.  If this is the wrong place for it, I apologise now.

This bug only really shows up when modding as it only becomes apparent when extending the Command class in conjunction with Gizmos.

In the Command class, there is a virtual property Desc which (in theory) allows commands description to be handled by inheritors.  Unfortunately, it doesn't seem this is ever invoked and the defaultDesc is always used.

This leads to unexpected behaviour when modding, namely, no description callback.  If your description is static no problem, use defaultDesc.

Unless I am totally missing the purpose of the Desc property...?

Sample code to reproduce:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using RimWorld;
using UnityEngine;
using Verse;
using Verse.AI;

namespace foo
{
    public class TestCommand : Command
    {
        public TestCommand() {
            // Give it the grow zone icon for testing
            icon = ContentFinder<Texture2D>.Get( "UI/Designators/ZoneCreate_Growing", true );
        }

        // THIS IS NEVER INVOKED!
        // Shows "No description."
        public override string Desc {
            get { return "Yes description."; }
        }

    }

    public class Building_Bar : Building
    {
       
        public override IEnumerable<Command> GetGizmos()
        {
            yield return base.GetGizmos();

            // Get the offending gizmo
            var bar = new foo.TestCommand();
            yield return bar;

            // No more gizmos
            yield break;
        }

    }

}
#10
The "Select Landing Site" window for Alpha 11 has been rendering the map scaled and offset from the wrong screen co-ordinates.

As can been seen here.

Initially I thought this may be due to mods so I completely re-installed and get the same problem.

Relevant machine specifics:
Intel Mobile Core 2 Duo T5500 (Dual-core 1.0-1.8GHz)
2GB DDR2
Mobile Intel 945 Express Chipset (256MB)

If you need more I can give you CPU-Z and GPU-Z hardware dumps.
#11
Outdated / [A12d] Community Core Library (v0.12.3b)
June 29, 2015, 04:18:48 PM


This is the old forum thread, please redirect yourself to the new thread here.
#12
Help / [Help/Info] Building Designators stacking
May 10, 2015, 04:47:06 PM
I was playing around with separating the walls a little so there are walls for material types.  Largely because I didn't like that plasteel is stonger than stone (no....just...no) and architecturally, it just wrong.  A wood wall does NOT look, act, have anything in common aside from being a "wall" than a stone or metal wall.  Construction techniques, methods, structural engineering etc is all different when building with wood/stone/metal.

Anyway, I found that if buildings share the same uiIconPath, they will stack in the designators menu.  So, if your menu icon for "WallWood" and "WallStone" are the same, you won't see two icons like you expect.

Is there any other "kooky" behaviour like this I should be aware of?
#13
This add-on requires: A2B Conveyor Belts

Not affiliated with A2B Corp. in any way.

Your mod order needs to look like this:RW_A2B
RW_A2B_Selector


This adds additional options for selector components.  It expands the options from the single core selector to a total of 12 different selectors.

There are five new selectors with different pathing options and six selectors which are "soft" filtered variants.  The difference between the normal ("hard") filtered selectors and the "soft" selectors is that the "soft" selectors will send an item which would be filtered to an alternate path if the filtered path is blocked.

The new selectors will show up in a new tab "A2B Selectors" beside the "A2B" tab.  The original selector has not been moved.  The same research is required to access the new selectors as the original - "[A2B] New Components".

The selectors are in individual xml files so you can remove the ones you don't want (all are enabled by default).


[attachment deleted due to age]
#14
Help / Help overriding the food system by mod.
May 06, 2015, 12:19:31 AM
I'm trying to extend Building_NutrientPasteDispenser to support additional modded features (different hoppers, different meals, more than one type of dispenser).

What works:  The new NPDs accept the new hoppers (buildings with CompHopper), the new WorkGiver_CookFillHoppers fill the hoppers, the alert is surpressed as long as the buildings which need hoppers have hoppers.

What fails:  The new methods are successfully injected to replace the private/hard-coded methods in Building_NutrientPasteDispenser but they don't seem to be called.  No errors are thrown, cave-man debugging logs nothing (and I have plenty of log messages just trying to trace this).  My example project to show that the code injection works, works and everything about the methods I'm injecting meet the criterion for code injection (call type, return type, method flags, parameter list, code target (IL, not x86), etc, etc) except...it doesn't?

Hopefully someone here is familiar with code injection and can help me here, I'm right stumped.  This is the only thing holding up the completion of the mod and being able to add some modding features to the food system in RimWorld for a variety of purposes.


[attachment deleted due to age]
#15
Help / [Poll - Proposed] Community Core Library
April 23, 2015, 10:00:17 AM
So, I've noticed quite the level of redundancy in the mods which are being produced.  Not so much in content of the mods but of the underlying code which drives them.  I propose that house some of those redundancies into a single core library and thereby have a "standard" of how to do common things as well as have a simple common requirement.  This will help for people on lower-end machines who may not have either the RAM or CPU to waste on code redundancies.  Further, it can also serve as an example of sorts for future modders who, quite frankly, don't have many good official sources to work off of and have to rely on examining the work of the existing mods on the forum and/or reverse-engineering the game (which has to be done to a certain extent anyway).

Where to get:  https://github.com/ForsakenShell/CommunityCoreLibrary

Please remember that this currently a WIP and not everything is 100%.  I am currently and actively working on the food system to allow new nutrient paste dispensers.

For those who voted on the poll and are interested in helping in any capacity (ideas, code, fixes, beer) - feel free to PM me and send the beer to...



Quote from: Original post for posterityTo that end, I present v0.1 of the "Community Core Library" for review by modders and feedback.  This is 100% open for discussion and debate as to how to approach a given problem.  I am providing everything thus far for peer review and hope to get a decent discussion going.

What it currently offers (everything is in the namespace CommunityCoreLibrary):

Alert_NeedMealSourceComplete : Alert_NeedMealSource
The new alert looks for any building with the CompFoodSource ThingComp instead of using hard-coded references.

Building_LightFixture : Building
Reduces the number of base light buildings.  You only need one def and it can support multiple colours after the appropriate research is complete.

Building_SunLampUV : Building
It's a sunlamp!  It's a temperature controller!

CompFoodSource : ThingComp
Flags a building as a food source.

CompPowerLowIdleDraw : ThingComp
Allows a building to use less power when idle.  No one leaves the stove on all night!
Currently operates in one of two modes, "InUse" (production tables) and "WhenNear" (doors, NPD).  Plan to add "GroupUse" for things like the television once I work out the detection code.

CompProperties_LowIdleDraw : CompProperties
Contains the values to influence how CompPowerLowIdleDraw works.
idlePowerFactor - Range 1.0 >= x >= 0.0 - Multiplier on basePowerConsumption for when the building is not in use.  Default 0.0
operationalMode - "InUse" or "WhenNear", determines when the building should come back to full-power.  Default "InUse"

PlaceWorker_OnlyOnItemSurface : PlaceWorker
Allows you to force placement on an existing building with an item surface.  Make sure the thing you're placing isn't an edifice.

PlaceWorker_OnlyUnderRoof : PlaceWorker
Allows you to restrict the placement of a new building to be under a roof.

PlaceWorker_WallAttachment : PlaceWorker
Force placement of the new building so it's "head" is against a proper support structure.  No floating wall lights!


Toils:  These are housed in the static class Toils_Common.

Toil SpawnThingOfCountAt( ThingDef of, int count, IntVec3 at )
Spawns count thingDefs of at location.

Toil ReplaceThingWithThingOfCount( Thing oldThing, ThingDef of, int count )
Removes oldThing and spawns count thingDefs of at the oldThings position.

Toil RemoveDesignationOfAt( DesignationDef of, IntVec3 at )
Removes designation of at location.

Toil RemoveDesignationOfOn( DesignationDef of, Thing on )
Removes designation of on thing.


Common functions:  Located in static class Common.

void ChangeThingDefDesignationCategoryDefOfTo( ThingDef t, string d )
Updates the thingdef to now use the new designation category.  Used internally by AdvancedResearch.

void ClearBuildingRecipeCache( ThingDef building )
Clears the buildings recipe cache.  Used internally by AdvancedResearch.

void ResolveDesignationCategoryDefs()
Rebuilds the designation categories after changing buildings designation category.  Used internally by AdvancedResearch.

bool ThingHasCategory( Thing t, ThingCategoryDef c )
Does this thing have a given thing category?


static class LightColour:  Contains the list of colours for lights (and anything else that wants colours in this fashion).


static class Icons:  Various icon refs used for the core library.


Advanced Research:  AdvancedResearchDef

This defines how multiple research projects interact as far as what recipes and buildings become available.  One AdvancedResearchDef can use multiple research projects to unlock multiple buildings OR multiple recipes on multiple buildings.  It is differentiated by an AdvancedResearchDef either containing recipeDefs or not.  If it does not contain any recipeDefs, then it will unlock tables.  If it has it, it will unlock recipes on tables.


The "mod" is mostly examples of how to do things, not a mod in-and-of-itself.  I'm also using some "borrowed" graphics to illustrate some aspects of the mod.
#16
After directing Famous Shoes to look into DefDatabase.AddAllInMods(), I thought I would take a look at it to see if I could resolve the issue I was having here with this problem.  Well, I found the solution.

It's a mere three lines of code and you can change what designationCategory a ThingDef uses.  In my case, I shall be using it to unlock buildings and tables based on more than one research tech.

Code to do this (so simple, really) provided in a nice neat function:public static void ChangeThingDefDesignationCategoryDefOfTo( ThingDef t, string d )
{
// Set the designation category on the thing
t.designationCategory = d;
t.menuHidden = ( d == "None" );

// Resolve all designation category defs
DefDatabase< DesignationCategoryDef >.ResolveAllReferences();
}


That's it.  Hope some other intrepid modders can make use of this tid-bit.




OP:

So, akin to the unlockable recipes by multiple research, I am attempting to be able to unlock buildings by multiple research.

The code is basically the same as the recipe code with the exception that instead of messing with a buildings recipes, the code is messing with its designationCategory.  Everything works in that respect except the build doesn't return to it's category after research.  The building is removed properly at first but not returned after research.

Now, one might ask if I am storing the old designations, well, of course I am otherwise I wouldn't know where to return it to.  The code is the same each way.

Remove:// Designator unlock on buildings
if( Advanced.originalBuildingDesignations == null )
Advanced.originalBuildingDesignations = new List< buildingDesignationPair >();

// Store the building designator
DesignationCategoryDef bDesignation = DefDatabase< DesignationCategoryDef >.GetNamed( building.designationCategory );
if( bDesignation == null ){
Log.Message( "Advanced Research :: buildingDefName( " + buildingDefName +" ).designationCategory( " + building.designationCategory + " ) resolved to null in AdvancedResearchDef( " + Advanced.defName + " )" );
return;
}
Advanced.originalBuildingDesignations.Add( new buildingDesignationPair( buildingDefName, building.designationCategory ) );

// Hide the building
building.designationCategory = "None";

// Rebuild the references
bDesignation.ResolveReferences();
Log.Message( "Advanced Research :: ThingDef( " + buildingDefName + " ).designationCategory = '" + building.designationCategory + "'" );


Re-addition:// Designator unlock on buildings
foreach( buildingDesignationPair bdPair in Advanced.originalBuildingDesignations ){
ThingDef building = DefDatabase< ThingDef >.GetNamed( bdPair.building );

// Set the designation category
building.designationCategory = bdPair.designationCategory;

// Rebuild the references
DesignationCategoryDef bDesignation = DefDatabase< DesignationCategoryDef >.GetNamed( bdPair.designationCategory );
bDesignation.ResolveReferences();

Log.Message( "Advanced Research :: ThingDef( " + building.defName + " ).designationCategory = '" + building.designationCategory + "'" );
}


The code reports the removal and re-addition of the building from the designation category but only the removal works.

Stumped here.  ���


Edit:

Trying to ResolveReferences() on the build too yields no results (which is to be expected since all derived methods are null functions).


Edit:

After spending days on end trying to figure this out, I am just going to have to pass this up for now.  The DesignationManager was a dead end, I can't decompile (and disassembly would be fugly) the main game executable so see how it's resolving research with table designators.

After exhaustive testing and huge log dumps describing all fields and members of the classes involved, it all points to one thing - The list of cached designators in a DesignatonCategoryDef is being updated and the list is valid.  I've looked at every decompilable reference to DesignationCategoryDef but nothing leads me to a usable result.

DesignationCategoryDef.ResolveReferences() properly rebuilds the list of Designators, the game just ignores it and continues not showing the menu option.

I am leaving this problem unresolved and thus not a possible feature in my mod.  I will just move on to something else unless someone can provide insights.
#17
Currently compatible with RimWorld Alpha 8 through Alpha 15 (A8-A15).



RimSearch is a tool for creating a nice neat png of your research tree based on your current set of mods.

This tool looks at your active mod list and generates a research tree graph.  Once the tree is generated, you have the option to move nodes around within their own level, the level is determined by the research prerequisites.  After you are satisfied with the changes, press [enter] to export to a png (RimSearch.png) or [escape] to exit without exporting.  Currently does not save node placement changes except as the finalized bitmap.

There are two small windows which will give you information while editing the tree.  One is the control window which simply lets you know the editors controls and the other is the info window which will tell you about a selected research tech.  This window also includes a list of the files which define the research and you can load the xml directly by clicking on the file in the info window.

Place RimSearch in the same directory as your RimWorld application directory (where RimWorld[Version][Platform][.exe] is located) and launch it from there.

changelog
Updated 11.07.2016

Adds support for A14.  ("totalCost" is now "baseCost")
Backwards compatible with older versions (looks for "totalCost" (A8-13) then "baseCost" (A14) if it's not found).

Updated 20.04.2016

The program will now check for abstract parents within a single file, no bad-xml cross-file-cross-references for abstract parents.  Would need to completely re-write the tool for this to happen.  Tested against RimWorld Alpha 13 (build 1135).

Updated 14.08.2015

Adds child high-lighting to show where a tech will lead to.  Helpful for users when deciding what branch of a complex tree they want to research next.
Added full source and project file of RimSearch.  This will probably be the last update of this version of the program.

Updated 28.07.2015

Fix so xml files will open properly.  I derped in some of my code changes.

Updated 28.07.2015

Added support for full directory structure transversal. (/MyMod/Defs/ResearchDefs/Some/Weird/Path/ToMy/File.xml)
Info window now truncates the displayed xml file path so the window doesn't become huge. (MyMod...File.xml)
Fixed small bug with selected/highlighted research being exported with the selection highlights.
Directly exports a png instead of a bmp.
Control window will move itself to a different corner of the screen if the mouse gets too close.
No longer opens a console window and by default does not log.  Logging can be enabled by the /lF[:Filename] command-line switch.

Updated 09.06.2015

Changed colour scheme (still hard-coded), improved UI (highlights tech tree on selected/hovered tech).

F5 reloading of all xml!

New Info Window!  Tells you:
Cost of research
Total Research to Tech (cost of all parent research plus itself)
xml files which define the research, click on a file to load it in your xml editor!

Updated 09.06.2015

Bug-fix for research with no prerequities tag.  Code was correct, compiler generated bugged output.

Updated 08.06.2015

Program now properly prunes extraneous branches which could be shared between techs with the same children.

Updated sample pic to show a heavily modified research tree.

Updated 08.05.2015

Added UI which allows final editing of bitmap before exporting or discarding changes.

Updated 14.04.2015

Now loads BOM encoded files properly!  No need to convert, should work out of the box.

Place RimSearch.exe in your RimWorld directory.
Execute it.
It will dump a log to the console and RimSearch.log.
When it says "Done", press any key to close the window.
It will now write RimSearch.bmp.

Outputs RimSearch.log and RimSearch.bmp

Updated 10.04.2015

Provides a much cleaner output.  See attached.  Sorry still about UTF-8 w/o BOM, I'll port the sources now that I have the "dirty" logic done.


[attachment undeleted due to age not being too old as I had uploaded replacements but the SQL query is too limited to get access modifiers]

[attachment deleted by admin - too old]
#18
After many hours examining code, trying to learn how RimWorld does what and what others have done to do things, I figured out my problem.  The method Saularain proposed below to remove and then re-add recipes from tables is the way to allow recipes to be unfinished.

I present my humble efforts at some sort of basic tutorial for those trying the same thing.  Not everyone will find this useful, but here you go to those that do.

Functional info:
AdvancedRecipeDefs define what recipes are linked with what research projects.  When a new colony is started, the MapComponent (DLL) loads all the AdvancedRecipeDefs, creates a list of the research to monitor for completion and then sits idle, periodically checking for research completion and unlocking recipes (re-adding the tables to the recipeDef) as they become available.


Notes:
In the XML for your recipes and tables, link the recipes to the tables and not the other way around.  That is, use <recipeUsers> in the recipeDef, not <recipes> in the building ThingDef.  The MapComponent is working on the recipe and not the table, the table itself is untouched except to have it's recipe cache flag cleared.



Quote from: OPThis is related to this post --> https://ludeon.com/forums/index.php?topic=11993.0

I have been trying to add recipies which may be unfinished dynamically to a table after research via DLL.  Everything works in that regard.  What does not, is that if a recipe can be unfinished (has an unfinishedThingDef), the job won't continue and exceptions are thrown.  Recipes without the tag work exactly as they should, it's only the unfinished ones.

Is there another table/list which needs to be updated for unfinished recipes to complete?  If so, then I would guess this is automagic in the xml loading and thus far hasn't become an issue.

Attached is a bare bones example of what's happening.

Tested against Core only on a new world and a new colony.

[attachment deleted due to age]
#19
I'm trying to create a basic mod which adds new recipes to work tables upon research completion.  I have everything working with one small exception.  Recipes which deal with unfinished things auto-generate a recipe to finish the recipe.  When assigning the parent recipe to the table using xml, the corresponding unfinished item recipe is auto-added.  When adding the recipe via DLL mod, either the recipe isn't generated or it isn't associated with the table (probably due to the lack of a table reference in the xml).  Added recipes which can be unfinished won't continue when DLL injected into a table.

I saw the thread about how meat is generated in alpha 3 and it seems to me that unfinished items would follow a similar vein.  Any clue to how the def name is generated so I can add said recipe to the table while adding the base recipe?


Edit:  After reading through the forums I found I could see the generated recipe name in the save file.  Only...it's the actual recipe def...

Which leads me to...why can I add a recipe with an unfinished item directly through xml and it works but not though DLL injection?  It adds it, starts crafting but can't finish the unfinished item.

grrrr
#20
I am posting this here because the bugs sub-forum is for unmodded reproducible bugs.  While this has happened to me on more than one colony, the game is modded and I can't explicitly reproduce this as I can't find the exact trigger for it.

Bad topic title in a way, hopefully I can elaborate:

When starting a new colony, everything works fine.  The game assigns deconstruct jobs and everything is good.  After "a while,"  I get exceptions with deconstruct orders.
Builder threw exception in WorkGiver Deconstruct: System.NullReferenceException: Object reference not set to an instance of an object

  at Verse.GenClosest.ClosestThing_Global (IntVec3 center, IEnumerable searchSet, Single maxDistance, System.Predicate`1 validator) [0x00000] in <filename unknown>:0

  at Verse.GenClosest.ClosestThingReachable (IntVec3 root, ThingRequest thingReq, PathMode pathMode, TraverseParms traverseParams, Single maxDistance, System.Predicate`1 validator, IEnumerable`1 customGlobalSearchSet, Int32 searchRegionsMax) [0x00000] in <filename unknown>:0

  at RimWorld.JobGiver_WorkRoot.TryGiveTerminalJob (Verse.Pawn pawn) [0x00000] in <filename unknown>:0

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)


This exception is thrown when a deconstruct job is automatically assigned and when manually assigned, however; when assigned automatically, the exception is thrown and the pawn finds something else to do.  When manually assigned, the exception is thrown and the pawn completes the deconstruct job.  This means I can always manually deconstruct but at some point the game fails to assign the jobs automatically.

I have spent hours trying to reliably reproduce it.  I can not find a single mod I use which changes the deconstruct work giver nor can I link it to a specific action or sequence of actions.

Sorry for the lack of info about this.  Maybe someone else has encountered this and knows what I did wrong?

I have attached my ModsConfig.xml and output_log.txt.  I didn't upload world/save due to the the need of the (sans Core) entire mod directory to go with it (due to individual mod tweaking).

[attachment deleted due to age]