[A14] Community Core Library v0.14.3.1

Started by RWCCLTeam, October 20, 2015, 12:08:13 PM

Previous topic - Next topic

RWCCLTeam


v0.14.3.1

Compatible with RimWorld builds:
1220, 1230, 1232, 1234, 1238, 1241, 1249


This forum thread and the first 10 posts serve as the "manual".

Be sure to read this every time you upgrade, things change, these posts are here to tell you how and how to avoid the most common issues.



Table of Contents



Basic Description

This is a basic set of functions which modders can use to enhance their RimWorld mods. Most of the library can be used from xml without any additional C# skill or requirement.

If you are a user which has a mod using CCL, you only need to download the latest CCL release zip.  Make sure it is enabled immediately after the 'Core' mod and before any other mod.

If you are a modder, download the modders resource or the source package.



Install Instructions

ALWAYS delete any previous install of both the core library and the vanilla tweaks before installing a new version.  This will avoid most common problems.

Regular users download the "User Release" package.

  • Extract all the folders in the zip into your Mods folder.
  • Enable "Community Core Library" immediately after "Core" - This is REQUIRED and a popup window will open to correct this if the library does not detect the correct load order position.
  • The "Community Core Library - Vanilla Tweaks" is entirely optional but highly recommended.  It does not matter where in your load order it is as it uses injection to modify the vanilla game objects.  Other mods may make changes to the same vanilla game objects but the tweaks mod will still take affect as a result of this mechanic.  The only rule is that this mod must be loaded after the core library.
  • The "Community Core Library - Mod Tweaks" is also optional and likewise is highly recommended.  This mod should be enabled last after every other mod.

Modders download the "Modders Resource" package.

  • Do not unzip this into Mods.
  • Install the mod folders into your Mods directory and enable them as per the user release.  (Although, installing and enabling the tweaks mods is still optional.)
  • Turn on development mode in the games main options menu, and;
  • Check your output_log.txt!  It will contain valuable information if CCL encounters errors when handling your mod!  This will help you fix those trivial bugs.
  • Always refer to "Def Descriptions", "Examples" and these forum posts (#1-10) herein refered to as "the documentation" for how to use this library.
  • If something is not covered, please ask a question.  Be ready to be given a polite "rtfm" if it is covered in the documentation. ;)
  • As a modder, if you use the user release to develop your mod, no help or support will be given.  If you want help, use the modders release, turn on development mode and refer your your log file and the documentation FIRST.

C# Developers
  • If you are simply wanting to mod and take advantage of CCL, use the source download or fork from the master branch (recommended).
  • If you want to contribute, bug fix, nitpick, etc, you should fork from the unstable development branch and propose changes through pull requests.


Once installed and placed in the correct load order, your load order should look like this:



Download
Latest release | All releases | GitHub repository


Background

This project started in Alpha 9, continued to be developed in Alpha 10 (some ideas had to be dropped due to complexity) and was first publicly released for Alpha 11.  Ideas and suggestions plus a lot of help came from the RimWorld community on the Ludeon Forums.  If you have an idea which fits into the context of CCL, please leave feedback or better, develop your idea and submit code!  CCL and it's team could always be fleshed out with additional talent!



Basic Troubleshooting

If all else fails, read all of the documentation ("Def Descriptions", "Examples" and this forum thread posts #1-10), don't skim over anything.  Especially read "note" sections.

Always do a "clean" install.  Delete the old version from /Mods/ before copying the new version.  Do not overwrite an existing copy.

RWCCLTeam

#1
Known Issues

RimWorld has a well known bug regarding the Mod menu.  Simply opening it will cause issues with mods.  Always restart RimWorld if you open the Mods menu.

Changing languages, mod load order (including enabling mods) and certain game options requires RimWorld to be restarted.

There is a lot going on when RimWorld starts as far as CCL is concerned.  The best practice is to restart RimWorld if you change any setting more complicated than the volume.

Software of any complexity is bound to have bugs, CCL is no different.  Please report bug by using the github issues tracker.  This makes it faster and easier to get bugs fixed and they can be linked directly to the commit that fixes them.  We appreciate feedback and want a bug free library for all but, with multiple team members, sending a PM or using the forum to report bug is now becoming inefficient.



Bug Reporting

What we need:

  • You to use the github issues tracker.  Going forward, issue reports on the forums will be directed to the issues tracker.  Using the forums, issues can be lost.  Help us by using the issues tracker.
  • Your full game log file found in /RimWorld[build][platform]_Data/ (not a screen shot of).  eg, RimWorld914Win_Data/output_log.txt
  • If the issue is gameplay related, as much detail as possible on how to reproduce the error and if relevant a screen shot of the problem.
  • Your save game and world file if the issue is save/load related.  Please zip these files before sending them.



Report A Bug
GitHub Issue Tracker

RWCCLTeam

#2
What the "Core" mod offers

Help Menu
With the help system implemented in v0.12.0, CCL will generate help for most of the standard things you'd expect to find help for.  You can easily navigate buy clicking directly on list items in the description and for items not in the help database, it will provide a tool-tip when hovering the mouse over the item.

The list of auto-generated help includes virtually every in-game object and more information is added with each new release of CCL.  This help will tell you virtually everything you can need about the topic including but not limited to item stats, research requirements, recipes, etc.

If you decide you don't want the auto-generated help, you can use the command-line switch "-nohelp" to disable it.  This will only disable the auto-generated help, you will still get explicitly defined help.  If you use the "-quicktest" command-line switch, auto-generated help will similarily be disabled.

"Nothing" and "Nudist" Outfits
v0.14.2 adds OutfitDef and two new outfits for pawns, especially those for those nudists who actually want to wear nothing!

Minimap
v0.13.2 adds a resizable, draggable, moddable minimap framework.  It comes with a basic set of minimaps and overlays including showing colonists, non-colonists, wildlife and the power grid.  By default the minimap is disabled and needs to be turned on in the Mod Configuration Menu.

Mod Configuration Menu (Mod Options)
If any mods are installed with an MCM, the main menu will display a "Mod Options" button which will allow you to set configuration settings for the mod(s).

Proper Refrigeration
Buildings implementing refrigeration will refrigerate rottable items without the usual "rot-unrot" cycle.  CCL automatically handles refrigerated buildings properly by simply not rotting the item.

Restart Warning
Under certain situations the game will need to be restarted.  These situations include changing mods and the language.  Any time CCL detects such a change, it will open a window to warn the user that a restart is required.


What the "Vanilla Tweaks" mod offers

Power Savings
Most buildings will not draw power when they are not in use. This includes the cookstove, television, etc but will remain connected to the power grid. Some exceptions include the comms console which always draws full power.

Auto Doors draw less power when they are not actually opening or closing.

Hydroponics basins "cycle" power at a rate of 50W for 5000 "ticks" and then 100W for 2500 "ticks" and will offer to share their growing options with other hydroponics basins.  (A "tick" is 1/60 of a second, there are 60000 "ticks" to a game day.)

Advanced Research Recipes
Artillery Shells require 'Mortars' research to be complete before they are available to be crafted at the smithing and machining workbenches.  Hops requires 'Brewing' before it can be planted and grown.

Colored Lights
The standing lamps have been reduced to a single object which takes advantage of a new comp allowing dynamic color changes on a single building, reducing the architects menu clutter.

Neighbourly Growers
Hydroponic basins and plant pots can share growing information with other hydroponic basins and plant pots.  No need to select each grower individually when setting everything up.

Nutrient Paste Dispensers
The nutrient paste dispensers use the generic hoppers provided with the core library and the vanilla hopper is hidden from use.  This allows easier management of the dispensers by automatically programming the hoppers connected to them.


What the "Mod Tweaks" mod offers

Power Savings for mod added work tables
Similar to the Vanilla Tweaks, the Mod Tweaks will make changes to mod added work tables which require power so that they will not use power then not in use.  Works with all mods without specific patches.


Remember!
All changes are defined in xml in the tweaks.  If you only want the core library, don't enable the tweaks.  If you do use the tweaks, you can change ANYTHING as it's all defined in xml, so break out your text editor (such as notepad)!  It's so easy a cave man could do it!

RWCCLTeam

#3
Modding Features

Remember to always refer to /Def Descriptions/ and /Examples/ for specific details about the xml involved.  C# features will require looking at the CCL source.  If you find something isn't covered that you feel should be, please give us feedback to help improve the documentation.


New Defs (xml)

  • Advanced Research - Allows recipes and buildings to be locked and unlocked by multiple research requirements.
  • Backstory - Def to add new backstories for pawns.
  • Help [Category] - Define in-game help which is accessible from the main tab beside research (by default).
  • Main Menu - These defs define and control the main menu buttons.
  • Mini Map - Mini map defs define mini map categories and have overlays which draw specific data.
  • Mini Map Overlay - This is the work-horse of the mini map framework.  These do the actual drawing of the mini map itself.  Each one has it's own unique texture to draw to and the final results of all visible overlays from all mini maps are composited to the mini map window.
  • Mod Helper4.1 - Define mod friendly injectors and minimum CCL version dependency.
  • Name - Def to add new first, last and nicknames for pawns.
  • Outfit - Add new outfits with a simple def instead of having to write C# code to inject them.
  • Pawn Bio - Def to add new pawn biographies.
  • Toggle Settings - Defines the toggle buttons in the lower-right corner of the map screen.

Def Extensions (xml)
  • Terrain With Comps - Allows usage of special place workers with terrain.

New Buildings (xml)

  • Automated Factory - This building class is similar to work table in that it has associated recipes and produces goods however, it will produce goods on it's own without a pawn to work it4.2.
  • Hopper - A powerful generic hopper system which allows a hopper to be programmed with the items the machine (user) accepts and wants.  This is the base building for hoppers.  CCL provides two hoppers already (refrigerated and unrefrigerated).
  • SunLamp Heat Controller - It's a sun lamp, it's a heater, it's controllable.

New Comp Properties (xml)

  • Automated Factory - The operational mode and output vector for automated factories.
  • Colored Lights - Used to define the available colors and research requirement for CompColoredLight.
  • Hide Item - Control flags for CompHideItem.
  • Hopper User - XML definition of resource thing filter for hopper storage.
  • Low Idle Draw - Defines the settings for how CompPowerLowIdleDraw modifies the power usage of the building.
  • Milkable Renameable - Allows you to specify the string which will show up for milkable animals instead of the default "milk fullness."
  • Restricted Placement - Defines the restrictions for place workers.
  • Shearable Renameable - Allows you to specify the string which will show up for shearable animals instead of the default "wool growth."

New Interfaces (C#)

  • IConfigurable - Only applicable to MiniMap and MiniMapOverlay, this interface allows linking into the Minimap MCM and exposing persistent data.
  • IHelpDefView - Applicable only to window classes, this interface is used to handle window interactions with HelpDefs.
  • IHopperUser - A programmatic interface for programming hoppers.  This allows for more powerful programming of a hoppers resource filter.

Helper classes (C#)
  • ColorPicker - A color picker dialogue and supporting helper functions. Allow users to select colors with a full HSV/alpha color picker.
  • Detours - Helper method to facilitate detouring all4.3 calls to any (including core) function to another function.
  • Inter Mod Communication - Allows mods to register a callback to handle messages when sent as well as send messages.  This enables mods to communicate without explicitly depending on each other.

New ITabs (xml)

  • ITab_AutomatedFactory - This is an optional ITab for automated factories to allow the user to enable or disable individual recipes.

New ThingComps (xml)

  • Automated Factory - This is used to house the production mode and output vector for Building_AutomatedFactory.
  • Colored Lights - One building can have multiple glower colors defined (or it can use the default internal list of seven colors) and a button will be made available to the user to cycle through the options. The cycle button is hidden until the appropriate research is complete (by default "ColoredLights").  Additionally can program other lights colors, respecting their own research.  Uses color matching by name so your "red" and my "red" don't have to be the same red but are accepted as "red."
  • Glower Toggleable (internal) - Allows the glower to be toggled by program code (C#).  This comp will replace CompGlower automatically and does not need to be implemented directly.
  • Hide Item - Hide stored items for storage buildings that represent containers rather than racks.  Functionally, this disables rendering of the item and it's label.  Can optionally prevent players from selecting the items in the building.
  • Hopper - Used as part of the generic hopper system.  Provides hopper-side functions.
  • Hopper User - Used as part of the generic hopper system.  Provides user-side functions.
  • Lifespan Powered - The same function as CompLifespan but, this will only count-down it's life while it is actively powered.
  • Neighbourly Grower - Adds gizmo's to Building_PlantGrower derived buildings (such as Hydroponics) providing the user the ability to share growing information.
  • Milkable Renameable - Specify the inspection string name for the resource gathered by milking.
  • Power Low Idle Draw - Allows anything4.4 with a CompPowerTrader to draw less depending on it's operational mode.  Current operational modes include "InUse", "WhenNear", "GroupUse", "Cycle" and "Factory".
  • Refrigeration - Flags any Building_Storage as preventing foods from rotting.  If CompPowerTrader is present, the food will rot if the power is disconnected or the building is turned off.
  • Restricted Placement - Used to store settings for restricted place workers.
  • Shearable Renameable - Specify the inspection string name for the resource gathered by shearing.

New PlaceWorkers (xml)

  • Hopper Magnifier - This will highlight hoppers which will connect to a building when in blueprint placement mode.
  • Hopper User Magnifier - This will highlight buildings requiring hoppers which will connect to a hopper when in blueprint placement mode.
  • Not On Terrain/Only On Terrain4.5 - Restricts placement to a list of valid terrain.  Can be used to reject (Not) or accept (Only).
  • Not On Thing/Only On Thing4.5 - Restricts placement to a list of valid things.  Can be used to reject (Not) or accept (Only4.6, 4.7).
  • Only On Surface4.5, 4.7 - Only on an item surface.  Useful for things which would be "on" something but not so specific as to the thing it's on.
  • Only Under Roof4.5, 4.7 - Require that a roof exist in the cell.
  • Restricted Count4.5 - Restrict the amount of buildings of a given type in the world.
  • Wall Attachment4.5, 4.7 - Requires a supporting wall (natural or man-made) to build against.  If you want to build something in the same cell as a wall, use OnlyOnThing instead.

RWCCLTeam

#4
Detours of Core Methods (Internal)

CCL detours many core methods to allow greater flexibility and functionality for modders when creating new game objects (xml defs, C# classes, etc).  The following list represents the core methods which have been detoured and the reason for it.  Generally speaking, the changes are to allow for custom assets to follow the same core logic as their vanilla counterparts (ie, a custom door5.1 should behave the same as a vanilla door).

These detours are done automatically by CCL and require nothing other than having CCL installed.  This section is simply for reference if you choose to detour methods and want to know what CCL is already detouring.


  • RimWorld.CompRottable.CompInspectStringExtra - Properly displays rotting status of things in buildings with CompRefrigerated.
  • RimWorld.CompRottable.CompTickRare - Prevents rotting of items in storage buildings with CompRefrigerated.
  • RimWorld.FoodUtility.GetFoodDef - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.FoodUtility.FoodSourceOptimality - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.FoodUtility.ThoughtsFromIngesting - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.FoodUtility.BestFoodSourceOnMap - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.GenConstruct.CanBuildOnTerrain - Makes PlaceWorker_OnlyOnTerrain supercede terrainAffordance which allows placing buildings on any terrain which is specifically allowed.
  • RimWorld.JobDriver_FoodDeliver.MakeNewToils - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JobDriver_FoodFeedPatient.MakeNewToils - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JobDriver_Ingest.GetReport - Display the proper job report string when using custom nutrient paste dispensers5.2 and automated factories5.5.
  • RimWorld.JobDriver_Ingest.MakeNewToils - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JobDriver_Ingest.PrepareToEatToils_Dispenser - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JobDriver_Ingest.UsingNutrientPasteDispenser - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JobDriver_SocialRelax.MakeNewToils - Allows pawns to take alcohol from automated factories5.5.
  • RimWorld.JobGiver_BingeAlcohol.BestConsumeTarget - Allows pawns to binge on any ingestible with the HediffDef Alcohol.
  • RimWorld.JobGiver_GetFood.TryGiveJob - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • RimWorld.JoyGiver_SocialRelax.TryGiveJobInt - Allows pawns to relax and drink any ingestible with the HediffDef Alcohol.
  • RimWorld.MainMenuDrawer.DoMainMenuButtons - Enables defining the main menu buttons in a def.
  • RimWorld.MainMenuDrawer.MainMenuOnGUI - Enables defining the main menu buttons in a def.
  • RimWorld.MainTabWindow_Research.DrawLeftRect "NotFinished" predicate - Adds an additional check for IsLockedOut() to prevent showing research projects which can never be researched.
  • RimWorld.OutfitDatabase.GenerateStartingOutfits - Enables creating new outfits by defs.
  • RimWorld.Pawn_RelationsTracker.AttractionTo - Allows all humanlike pawns of the same flesh type (Normal) to be attracted to each other.
  • RimWorld.Pawn_RelationsTracker.CompatibilityWith - Allows all humanlike pawns of the same flesh type (Normal) to be compatible with each other.
  • RimWorld.PlaySettings.DoPlaySettingsGlobalControls - Enables toggling settings defined by defs.
  • RimWorld.PlaySettings.ExposeData - Enables saving toggle settings defined by defs.
  • RimWorld.SocialProperness.IsSociallyProper - Fixes logic where prisoners not in the same room as the thing being checked would return false, even if the prisoner could path to the thing and both rooms are prison cells.
  • RimWorld.PageUtility.InitGameStart - Adds PostLoadInjector cache reset when a new game is started.
  • RimWorld.ThingSelectionUtility.SelectableNow - Support for CompHideItem to prevent item selection by the player for buildings which should represent containers.
  • RimWorld.VersionControl.DrawInfoInCorner - Display whether CCL is up to date with the github repo below the games version checker.
  • RimWorld.Toils_Ingest.TakeMealFromDispenser - Fixes issue with multiple pawns accessing dispenser at the same time causing the hoppers to become empty and not satifying the requirements to dispense.
  • RimWorld.WorkGiver_Warden_DeliverFood.FoodAvailableInRoomTo - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • Verse.CompGlower.ShouldBeLitNow - Makes the comp CompPowerLowIdleDraw aware and respect CompGlowerToggleable.Lit.
  • Verse.CompHeatPusherPowered.ShouldPushHeatNow - Makes the comp CompPowerLowIdleDraw aware.
  • Verse.MentalStateWorker_BingingAlcohol.StateCanOccur - Allows pawns to binge on any ingestible with the HediffDef Alcohol.
  • Verse.ModLister.InstalledModsListHash - Fixes faulty hash strategy in core when changing mod load order which would never trigger the mods to be reloaded.
  • Verse.PlayDataLoader.LoadAllPlayData - Adds hooks for showing the Warn/Restart window.
  • Verse.PlayDataLoader.ClearAllPlayData - Adds hooks for showing the Warn/Restart window.
  • Verse.PreLoadUtility.CheckVersionAndLoad - Adds PostLoadInjector cache reset when a game loads.
  • Verse.ThingListGroupHelper.Includes - Allows custom nutrient paste dispensers5.2 and automated factories5.5 to be properly selected by pawns searching for food.
  • Verse.UIRoot_Entry.ShouldDoMainMenu_get - Adds hooks for showing the Warn/Restart window.

RWCCLTeam

#5
Current Team Members
1000101
mipen
Fluffy
skullywag

Inactive Team Members
Latta


Contributors*
DAOWAce
kaptain_kavern
profound_darkness
mrofa
isistoy
noimageavailable
shinzy
TheKrush
MossieuLeblanc
skyarkangel
Ohar

* Hey!  We added something!  Be it code, a translation, graphics, etc!  Join our ranks by helping with CCL in some small way!


Credit Where it's Due (We didn't contribute directly but otherwise helped.)
(Excluding Tynan because it goes without saying.  Also, if you'd like to implement anything from this into RimWorld, you are welcome to all the assets - code, graphics, etc!)

Haplo for the "How to make an [sic] .dll-mod" tutorial.
mipen for his Mechanical Defence 2 mod and through it's dissection the AdvancedResearchDef was born.
OpalMonkey for clueing me (1000101) into a better way to hide buildings behind research.
soltysek for spending countless hours reviewing My Bad Code (tm).
mrofa for wasting his time reading the help forum threads and his general ideas (of which there are lots!).
Vas for CompLifespanPowered (requested in here).
TheGentlmen (GENT) for tracking down and reporting many subtle bugs.
RawCode for figuring out unity4 / Mono x86 JIT method detouring, which is likely to be a gamechanger (pun intended).
wivex for many suggestions on improving the Mod Configuration Menu (MCM).
macrosblackd for helping fix the "feature" of pawns eating raw food over meals.
Everybody in the RimWorld Modders Slack for general feedback and testing the pre-releases.

To anyone else who may have been forgotten, you know who you are and we appreciate the contributions, feedback and help you have provided.

RWCCLTeam

#6
Changelog

For the full list of changes in each version, please refer to the commit log.  This section is just for convenience sake.

v0.14.3.1 - Fixes planning tool and mining minimap overlays not clearing their texture before drawing, removes left-over debug message.
v0.14.3 - Mod Tweaks, Russian translation, ToggleSettingDef, traits to BackStoryDef, ITab injector, reverse designators, more utility minimap overlays and some rare occurance bugs fixed.
v0.14.2.1 - Small bugs stomped
v0.14.2 - Adds OutfitDef and additional C# API methods.
v0.14.1 - Adds BackstoriesCore, fixes small bugs.
v0.14.0.1 - Bug fixes fixes for FoodUtility and ResearchProjectDef_Extensions as well as fixing a core bug regarding eating raw food over meals.
v0.14.0 - Alpha 14 update.
v0.13.4 - More API extensions, small MCM bug fixed for labels with special characters (adds saveKey)
v0.13.3 - API Additions & Bugs Bashed
v0.13.2.1 - Fixes load/save issue with minimaps.
v0.13.2 - New Minimap feature!  Fixes some bugs in CCL and in core (BiomeDef).
v0.13.1.1 - Bug fixes
v0.13.1 - Adds InterModCommunication, CompGlowerToggleable, fixes some issues reported.
v0.13.0 - Alpha 13 update.
v0.12.7.2 - Small bug-fixes and additional MCM functionality
v0.12.7.1 - Small change to the MCM
v0.12.7 - Detouring of core methods, automated factories, main menu def, mod configuation menu (MCM), research tree, more changes and additions to the help menu system, tighter control of the mod load order (CCL must be #2), as always more bugs quashed and different ones introduced.
v0.12.6 - Per-mod verbosity for debugging, help for terrain & flooring, helper functions for getting a mod by def, even more bugs fixed.
v0.12.5.x - (Modder pre-release of new features) - More bugs fixed, internal refactoring, hidden storage comp, color picker and method detouring.
v0.12.4 - Many, many bugs fixed, help menu overhaul, research menu overhaul, new comp & property.
v0.12.3b - Fixes Advanced Research Def to recognizes plants using plants with an override class.
v0.12.3 - Bug fixes, Ice boxes (CompRefrigerated no longer *requires* CompPowerTrader but will respect it), Post Load Injectors, removes research requirement from Xerigium.
v0.12.2 - Alpha 12d update.  Refactors CompRefrigerated, fixes several bugs, graphics by mrofa.
v0.12.1 - Alpha 12c update and bug-fixes.  First release with AutoGen Help!
v0.12.0 - Alpha 12 update.  Adds menu help system and mod helper system.  Separates vanilla tweaks from core.
v0.11.4 - Fixes CompRefrigerated save/load issue, fixes lights and growers not sharing through link type properly sometimes, move repository to a team organization.
v0.11.3 - Better placement restriction support.  Now handles destroying things and alerting the player.
v0.11.2 - Additional place workers, you can build on steam geysers, PlantGrowers can program other PlantGrowers, Lights can change other lights.
v0.11.1 - Advanced research can now lock or unlock recipes and buildings.  Adds Action callbacks to advanced research.  Additional PlaceWorker restrictions.
v0.11.0 - Initial public release


RWCCLTeam

#7
Usage Terms AKA Licensing

You are free to use CCL in any mod or modpack.  If you are creating a mod using CCL, do not include CCL with your mod.  This is not a license issue but a compatibility issue.  Simply state the minimum version of CCL which you require and link8.1 to this thread.  You can include CCL with a modpack however, it is recommended that you don't.  It is better to link8.1 to this forum thread to allow users to separately download and update.

For more information on the license CCL is released under, please refer to the unlicense.



CCL Badging

If you have a mod or modpack using CCL, linking back to this thread is the best way to keep users running with the latest updates.

Powered By


[color=orange]Powered By[/color]
[url=https://ludeon.com/forums/index.php?topic=16599.0][img]http://tinyurl.com/pd78ovl[/img][/url]


CCL logo and badge courtesy of mrofa.

RWCCLTeam

#8
Notes

4.1 A ModHelperDef is required for any mod using CCL.  Without this def, the library will throw an error.  There can only be one of these defs per mod or, again, an error will be thrown.  This was previously a soft requirement but is now a hard requirement.
4.2 Depending on the operational and output mode of the factory.  Two examples are provided, an automated stonecutter (fully automated) and a food synthesizer (pawn-interaction).
4.3 Certain methods are too small to be detoured and may be optimized into the call site ("inlined") by the JIT.  These methods are about the only exception to method detours in that they canot be detoured.
4.4 Building's which directly control their own power are the obvious exception (eg: heaters, coolers, etc).
4.5 Requires RestrictedPlacement_Comp and RestrictedPlacement_Properties for information and/or support ticking.
4.6 Want to place that building on (instead of near) a steam geyser?  You can, the core method which hard-codes steam geysers to geothermal generators has been detoured to allow any building with the PlaceWorker_OnSteamGeyser or PlaceWorker_OnlyOnThing to allow placement on steam geysers.
4.7 Depending on your needs, use a normal or rare ticker to fire the periodic check to make sure the supports still exist.  If the support is removed, the thing is destroyed and an alert is fired to inform the player.  Normal tickers only check every 250 ticks.

5.1 Only ThingDefs with thingClass, or a class which inherits, RimWorld.Building_Door will work.
5.2 Only ThingDefs with thingClass, or a class which inherits, RimWorld.Building_NutrientPasteDispenser will work.
5.3 Only ThingDefs with thingClass, or a class which inherits, RimWorld.Building_OrbitalTradeBeacon will work.
5.4 Only ThingDefs with thingClass, or a class which inherits, RimWorld.Building_CommsConsole will work.
5.5 Only ThingDefs with thingClass, or a class which inherits, CommunityCoreLibrary.Building_AutomatedFactory with an output vector of "DirectToPawn" will work.
5.6 Only ThingDefs with thingClass, or a class which inherits, RimWorld.Fire will work.

8.1 Please refer to the badging in the license section for linking to this thread.



Important Packaging & Release Notes


  • You should NOT include any of CCLs assets with your mod directly.
  • You should NOT copy the dll to your mods assembly directory.
  • You should NOT copy the xml, languages, textures, etc unless your are explicitly overriding them with new settings.  Doing so WILL cause errors and will be the fault of the modder who copies files they shouldn't.
  • Repackaging ANY part of CCL with your mod automatically disqualifies you for assitance with your mod from the CCL team.  If you are repacking CCL assets (DLL, xml, textures, etc) you are accepting the responsibility of being an advanced modder and do not need help.
Simply put - if your mod needs CCL, then it needs CCL to be properly installed and loaded before your mod as a separate download, not included with.  This is true for all mods and "mod packs."  The only place users should be getting CCL from is the official github releases, any other place is not an "official" copy (although perfectly legitimate, see the unlicense) or the modder using CCL has made a colossal mistake by packaging CCL assets directly with their mod.

RWCCLTeam

#9
<reserved>

TheGentlmen


Chestburster

#11
Heya,

i've ran into some problems with the AdvancedResearchDef. My game is always throwing cross-reference errors (BuildHMGTurret) when adding the advanced defs. Could someone tell me what i did wrong? (Bills work when i remove the advanced defs)

<AdvancedResearchDef>

<defName>CraftHMG</defName>
<Priority>0</Priority>

<researchDefs>
<li>BasicTurretCrafting</li>
</researchDefs>

<recipeDefs>
<li>BuildHMGTurret</li>
</recipeDefs>

</AdvancedResearchDef>

---------------------------------

<ResearchProjectDef>
<defName>BasicTurretCrafting</defName>
<label>Basic Turret Crafting</label>
<description>Allows you to build the Tinker's Workbench.</description>
<totalCost>500</totalCost>
<prerequisites>
<li>AdvancedGunTurret</li>
</prerequisites>
</ResearchProjectDef>

---------------------------------

<RecipeDef>
<defName>BuildHMGTurret</defName>
<label>Build M2 Browning</label>
<description>Build a M2 Browning Turret Gun</description>
<jobString>Building M2 Turret Gun.</jobString>
<workAmount>8000</workAmount>
<workSpeedStat>SmeltingSpeed</workSpeedStat>
<effectWorking>Smelt</effectWorking>
<soundWorking>Recipe_Smelt</soundWorking>
<skillRequirements>
<li>
<skill>Crafting</skill>
<minLevel>6</minLevel>
</li>
</skillRequirements>
<ingredients>
<li>
<filter>
<thingDefs>
<li>Heavy_Component</li>
</thingDefs>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>Weapon_Parts</li>
</thingDefs>
</filter>
<count>10</count>
</li>
<li>
<filter>
<thingDefs>
<li>Spare_Parts</li>
</thingDefs>
</filter>
<count>10</count>
</li>
<li>
<filter>
<thingDefs>
<li>Parts_Steel</li>
</thingDefs>
</filter>
<count>5</count>
</li>
<li>
<filter>
<thingDefs>
<li>SyntheticMaterials</li>
</thingDefs>
</filter>
<count>2</count>
</li>
</ingredients>
<products>
<MGTurret_Crate>1</MGTurret_Crate>
</products>
<fixedIngredientFilter>
<thingDefs>
<li>Heavy_Component</li>
<li>Weapon_Parts</li>
<li>Spare_Parts</li>
<li>Parts_Steel</li>
<li>SyntheticMaterials</li>
</thingDefs>
</fixedIngredientFilter>
<workSkill>Crafting</workSkill>
</RecipeDef>

---------------------------------

<ThingDef ParentName="BenchBase">
<DefName>TableTinker</DefName>
<label>Tinker's Workstation</label>
<ThingClass>Building_WorkTable</ThingClass>
<Description>A workbench with tools for producing turrets.</Description>
<graphicData>
<texPath>Things/Building/Production/Tinker_Workbench</texPath>
<graphicClass>Graphic_Single</graphicClass>
<drawSize>(3,1)</drawSize>
</graphicData>
<stuffCategories>
<li>MetallicParts</li>
</stuffCategories>
<costStuffCount>15</costStuffCount>
<CostList>
<Spare_Parts>5</Spare_Parts>
<ElectronicComponents>5</ElectronicComponents>
<Mechanism>5</Mechanism>
</CostList>
<AltitudeLayer>Waist</AltitudeLayer>
<fillPercent>0.5</fillPercent>
<useHitPoints>True</useHitPoints>
<statBases>
<WorkToMake>4750</WorkToMake>
<MaxHitPoints>300</MaxHitPoints>
<Flammability>1.0</Flammability>
<Cleanliness>-3</Cleanliness>
</statBases>
<Size>(3,1)</Size>
<DesignationCategory>Production</DesignationCategory>
<Passability>PassThroughOnly</Passability>
<pathCost>70</pathCost>
<hasInteractionCell>True</hasInteractionCell>
<interactionCellOffset>(0,0,-1)</interactionCellOffset>
<surfaceType>Item</surfaceType>
<recipes>
<li>BuildHMGTurret</li>
<li>BuildAvengerTurret</li>
<li>BuildChainTurret</li>
<li>BuildVulcanTurret</li>
<li>BuildAGLTurret</li>
<li>BuildEMPTurret</li>
<li>BuildLaserTurret</li>
<li>BuildPLaserTurret</li>
<li>BuildPlasmaTurret</li>
<li>BuildAMTurret</li>
<li>BuildCannonTurret</li>
<li>BuildHowitzerTurret</li>
<li>BuildDevastatorTurret</li>
<li>BuildLMSTurret</li>
<li>BuildMMSTurret</li>
<li>BuildHMSTurret</li>
<li>BuildSteelBase</li>
<li>BuildPlasteelBase</li>
<li>BuildCopperBase</li>
<li>BuildAluminiumBase</li>
<li>BuildTitaniumBase</li>
<li>BuildVancidiumBase</li>
<li>BuildCarbonBase</li>
</recipes>
<inspectorTabs>
<li>ITab_Bills</li>
</inspectorTabs>
<building>
<spawnedConceptLearnOpportunity>BillsTab</spawnedConceptLearnOpportunity>
</building>
<comps>
<li>
<compClass>CompPowerTrader</compClass>
<startElectricalFires>true</startElectricalFires>
<basePowerConsumption>500</basePowerConsumption>
<soundPowerOn>PowerOnSmall</soundPowerOn>
<soundPowerOff>PowerOffSmall</soundPowerOff>
</li>
<li>
<compClass>CompAffectedByFacilities</compClass>
<linkableFacilities>
<li>Stool</li>
<li>Small_ToolCabinet</li>
</linkableFacilities>
</li>
<li Class="CommunityCoreLibrary.CompProperties_LowIdleDraw">
<compClass>CommunityCoreLibrary.CompPowerLowIdleDraw</compClass>
<idlePowerFactor>0.1</idlePowerFactor>
</li>
</comps>
<researchPrerequisite>BasicTurretCrafting</researchPrerequisite>
<placeWorkers>
<li>PlaceWorker_ShowFacilitiesConnections</li>
</placeWorkers>
</ThingDef>


Edit: Improved formatting

1000101

In your ARDef you aren't specifying the building the recipe should be added to.  You need to specify both the recipes and buildings (thingDefs) they apply to.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Chestburster

I tried that earlier and it didn't work (it just removed the table from the architect menu after i added the thingDef). Tried it again just to make sure.. still the same errors.

<AdvancedResearchDef>

<defName>CraftHMG</defName>
<Priority>0</Priority>

<researchDefs>
<li>BasicTurretCrafting</li>
</researchDefs>

<recipeDefs>
<li>BuildHMGTurret</li>
</recipeDefs>

<thingDef>
<li>TableTinker</li>
</thingDef>

</AdvancedResearchDef>


Just wondering.. is there some sort of caching going on in rimworld? I removed the other ARDefs but they are still throwing errors (even after restarting my notebook).

1000101

#14
It's because it's thingDefs not thingDef.  Make sure you spell the tags correctly and read the documentation thoroughly.

<AdvancedResearchDef>

<defName>CraftHMG</defName>
<Priority>0</Priority>

<researchDefs>
<li>BasicTurretCrafting</li>
</researchDefs>

<recipeDefs>
<li>BuildHMGTurret</li>
</recipeDefs>

<thingDefs>
<li>TableTinker</li>
</thingDefs>

</AdvancedResearchDef>
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By