Ludeon Forums

Ludeon Forums

  • August 17, 2022, 07:27:43 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

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.

Topics - Fluffy (l2032)

Pages: [1] 2 3
Bugs / [1.1.2624] Replace MapMeshFlag enum with def?
« on: May 17, 2020, 04:55:22 PM »
Enums are hardcoded and make modding harder. Please consider replacing this enum with a def-based system. I do realize that this might be a performance-sensitive area, but perhaps something smart could be done. For example, generating a bitmask from defs at game start should be possible?

Bugs / [1.1.2624] Replace OverlayTypes enum with def?
« on: May 17, 2020, 04:52:43 PM »
Enums are hardcoded and make modding harder. Please consider replacing this enum with a def.

I would expect this function to allow custom logic for when to allow placing over things. Instead, it is only ever called when placing objects over a Steam Geyser.

I have to assume that this is not working as intended, or otherwise, the virtual(!) function is severely mislabeled.

Unfinished / [WIP] Mod Manager
« on: September 14, 2018, 06:56:28 PM »
I've been working on a more flexible mod config screen, and I'd like your feedback!

The current version is rough, and not all functionality is implemented. Here's what it does;
 - Two side-by-side lists of mods, available and active
 - search (filter) both lists (with an option to highlight matches (vanilla way, default for active), or only show matches (more useful for large lists, default for avaiable)).
 - drag and drop activate and reorder
 - keyboard navigation (tab switches between filters and lists, arrows select mods, enter activates/deactives - there is currently no way to reorder)
 - deals with multiple versions of the same mod (click the little icons to switch between versions).
 - create local copies of steam mods (icon in bottom right)
 - delete local mods

What I plan to implement;
 - finetune/expand keyboard navigation
 - create/load modlists
 - mass create local copies of all steam mods in your mod list
 - ModSync integration (either modsync itself, or a similar approach)

Current issues;
Translation strings are not yet set, so you'll see weird (but readable) characters, much shorter tooltips, etc.

[attachment deleted due to age]

Unfinished / test 2
« on: September 12, 2018, 04:24:59 AM »
still a test

Off-Topic / Should political discussions be banned on these forums?
« on: June 26, 2017, 04:46:46 AM »
Please keep any discussion civil and to the point.

Problem description;
RequestHash uses the short hash of the buildableDef, optionally adjusted with the hash of the stuffdef, to cache the production costs of a buildableDef/stuffDef combinations.

There's two ways collisions can slip in here. First, buildableDefs can be either TerrainDef or ThingDef, each has their own hashtable - so the sets of hashes may overlap. Second, by offsetting with the stuff used, we're deviating from the unique hashes enforced while originally handing out hashes, again introducing a risk of collisions.

I ran into this issue with the following defs;

You can test by adding my StuffedFloors mod (which requires ArchitectSense), and trying to build the jade rough stone tiles and the multianalyzer. Whichever you look at first will be the cost for the other as well.

[attachment deleted by admin due to age]

Problem description;
ThoughtMaker.MakeThought( ThoughtDef, int ), applies the stage after Init() is called. This is a problem for thoughts that have the Thought_MemorySocial worker class, and have multiple stages.

(to my knowledge, this combination doesn't exist in vanilla so, for now, it's mostly a modding problem).

Specifically, ThoughtMaker has the following method;
Code: [Select]

public static Thought_Memory MakeThought(ThoughtDef def, int forcedStage)
Thought_Memory thought_Memory = (Thought_Memory)Activator.CreateInstance(def.ThoughtClass);
thought_Memory.def = def;
return thought_Memory;

And Thought_MemorySocial has the following Init() method;
Code: [Select]
// RimWorld.Thought_MemorySocial
public override void Init()
this.opinionOffset = base.CurStage.baseOpinionOffset;

Since Init() is called before SetForcedStage(), which in turn sets CurStage, the opinionOffset will default to that of the zeroth stage, regardless of the forcedStage argument.

How to resolve;
Simply switch the Init() and SetForcedStage() lines.

Description; as per title, and attached screenshot.
Steps to reproduce; make a pawn loose a limb.
Expected outcome; only the 'root' missing part is listed.

[attachment deleted by admin due to age]

Help / A17; changes
« on: May 06, 2017, 08:40:27 AM »
Let's consolidate our efforts, and report changes in the modding API in this thread.

You can now use xpath selectors to surgically change properties in vanilla and other mods' defs - so you don't have to replace them!.
Some examples;
Xpath selectors;

I'd like to invite Zorba and/or any modders that have tested this system to provide more examples and pointers.

All the Scribe_XXX.LookXXX() methods are now just Scribe_XXX.Look(), API doesn't appear to have any further changes.

Under the hood, saving and loading of data has been split into two subcomponents of the Scribe; Scribe.loader & Scribe.saver. If you used Scribe to manually load/save data, you'll have to do some minor refactoring. API doesn't appear to have any further changes. Note that the addition of Settings (see below) might mean you don't need to manually call the scribe at all anymore.

Mod Class
There's now a 'Mod' class you can inherit from. It's a simple base class, which gets constructed after all defs are loaded. As such, it's a useful entry point, but it can't completely replace HugsLib's ModBase class (specifically, there's no hook for running code after this mod is loaded, but before other mods further down the list are loaded).

Settings Class
The Mod class also gives access to a Settings object. Settings can basically be anything (but not references to objects in a game!), you'll have to provide your own ExposeData method to save/load the data. You'll also need to provide a Mod.DoSettingsWindowContents() method to render the UI parts. As far as I can see, there's no default settings handlers for simple data types, but they're easy enough to make yourself (hint; Verse.Widgets, or Verse.Listing).

GameComponent, WorldComponent, MapComponent
All of these now have a handy amount of virtual methods corresponding to various events in their lifecycles, making it much easier to attach data to the correct 'scope'. (e.g. attaching data to game/world/mapComponent to make sure it doesn't 'bleed' over when a player starts/loads another game, world, map). Finally, MapComponents are now injected into existing save games when the map is loaded and new mods are added! (or at least I think they are, that's what the code seems to imply).

'Pawn list' main tabs have been completely refactored, and are now def-based, with a def for each table and column. MainTabDefs themselves are now MainButtonDefs.

ApparelProperties.commonality appears to have been refactored into ThingDef.generateCommonality. The same may be true for weapons, etc.

Bugs / [A16] Modding: ResearchMod class broken.
« on: January 09, 2017, 04:29:48 PM »
There are two problems with researchMods;
1; The class itself is useless as a base class; the Apply() function is not virtual, and the specialAction field is private.
2; Assigning a researchMod type to the researchMods field in ResearchProjectDef XML leads to a 'Trying to parse to unknown data type' error.

Expected behaviour;
1; Apply() is virtual, and/or specialAction is public.
2; Setting workers in XML functions the same as setting workers for e.g. hediffs.

If the steam version is loaded outside of steam it gives a popup stating this fact, and that the game will now close.

Pressing <Esc> completely ignores this, and allows playing the game as normal. Possibly the worst DRM ever :P.

Bugs / [A13] Debug window cuts off top line of log
« on: May 20, 2016, 05:15:24 AM »
The in-game debug window cuts off the first line of output - this can be quite annoying, since the first line is often the most pertinent.

Replicate; clear the log, then log something.

Two different mods create custom Def class (that is class in the C# sense), with the same name, but in different namespaces.
The game errors during mod load, mod config is reset.

Since the classes are namespaced, there should be no conflict an the game should run fine.

Load the attached mod. It does absolutely nothing, but highlights the problem.

In Verse.XmlLoader.AllDefsFromAsset, change
Code: [Select]
typeof(Def).AllSubclasses().ToDictionary((Type x) => x.Name);to
Code: [Select]
typeof(Def).AllSubclasses().ToDictionary((Type x) => x.FullName);
( there may be more changes to be made, but this is the source of the issue ).

[attachment deleted by admin - too old]

In my latest mod, I'm trying to map colors to relationshipdefs. This works fine with a DefMap<PawnRelationDef, Color>, until I want to scribe the DefMap. The DefMap uses Scribe_Collections.LookList( x, x, LookMode.Undefined ) to automatically resolve to the correct mode, but for colors it erroneously picks LookMode.Deep.

Expected behaviour: LookMode.Undefined resolves to LookMode.Value for Color objects.

Pages: [1] 2 3