Menu

Show posts

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

Show posts Menu

Messages - OpalMonkey

#1
Support / Re: SendOwl and Steam both?
July 15, 2016, 06:15:51 PM
Thanks for clarification on this, Tynan!

One related question though. Can the Steam version be launched sans Steam? I know (at least at one time, it may have changed) some games could be downloaded through Steam, then if launched directly from the EXE they act as DRM/Steam free versions. Steam didn't even mark them as running or record time played.

Just wondering if RimWorld works this way since I often leave it running in the background for a long time (thanks for making it not use much for resources when minimized!) and it bugs me if it's running through Steam all the time.
#2
For me it was watching WeaselZone on YouTube. After watching him get several colonies killed off with what I thought were stupid mistakes, I bought the game... And proceeded to run long line of colonies into the ground with "stupid mistakes".

Heh, that'll teach me for thinking I can do better :P
#3
Quote from: 1000101 on May 21, 2015, 01:32:00 PM
Quote from: OpalMonkeyIf you don't mind my asking, how did you go about getting it working?

Everything to do it is in the first code block of the first post.

Heh... I uhh, misunderstood the structure of the first post. Derp.

Are you referring to the ChangeThingDefDesignationCategoryDefOfTo method? I had to try it again to be sure, but that isn't working for me. Maybe it's conflicting with something else in my mod, but it actually causes some weird issues. No errors, but it messes with the menu hotkeys and some other things. Maybe that's why I misunderstood the post.

Just tried it out in a fresh project with no new ThingDefs, just a single extra research and a copy of the sandbags def that removes the designationCategory.

class ResearchModsSpecial
{
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();
}

public static void Test()
{
ChangeThingDefDesignationCategoryDefOfTo(ThingDef.Named("TurretGun"), "None");
ChangeThingDefDesignationCategoryDefOfTo(ThingDef.Named("Sandbags"), "Security");
}
}


When I finish the research the turret is gone and the sandbags are back, as the are supposed to be. Problem is, the normal and EMP mortars also disappear from the menu (leaving the incendiary mortar) and all the hotkeys (except for things like deconstruct and cancel) are removed. No errors.

Guess getting this result is what confused me about your original post and drove me to the conclusion that this was never resolved. Sorry for the misunderstanding.

Since I've got it working another way I'll just leave it be. Maybe it's just something I'm not understanding properly.
#4
@E:
Ah, I was wondering if that might have been the case. Glad you still found this interesting. Many ways indeed. If you don't mind my asking, how did you go about getting it working?

And yes, from my tests so far having research require itself as a prerequisite seems to work. I honestly hadn't expected it to but tried on a whim anyways. That said, nothing in my mod is tested under actual gameplay conditions yet. I've just been using dev mode to test everything quickly. So there could be some issue I haven't noticed yet.

@Tynan:
Thanks! It's been an interesting three weeks making this mod and hope to release it before too long. Just need to finish adding some content, but I think the technical issues are pretty much done with. Then I can finally get back to actually playing RimWorld rather than just launching it 50 times a day to test things. Haven't even played Alpha 10 properly yet  :o
#5
Hi E,

Thought I'd leave my two cents on your unresolved issue, in case it helps at all. Plus I guess I need to make my first post on these forums at some point  :D

I'm in the process of making my own RimWorld mod and found this thread when searching for info on how to do similar things. Now, the way I ended up getting this to work isn't actually the same thing, so depending on how you want things to work this may or may not work. I did make my own attempts to get your method working, to no avail.

Rather than removing buildings from the menu by changing the designationCategory I decided to try using research to hide/unhide them. By changing the researchPrerequisite you can get a similar result. They'll all still show up when in God Mode, but that shouldn't really be a serious problem.

I also noticed research projects can basically be locked permanently by setting themselves as a prerequisite. So I created a permalocked research that never even shows up in game, like so:

<ResearchProjectDef>
<defName>Permalocked</defName>
<label>permalocked</label>
<totalCost>99999</totalCost>
<prerequisites>
<li>Permalocked</li>
</prerequisites>
</ResearchProjectDef>


And wrote an extension method for ThingDef that acts on one ThingDef (the one to remove) and takes another ThingDef (the one to add):

public static class Extensions
{
public static string lockedResearch = "Permalocked";
public static void ReplaceInMenu(this ThingDef pOld, ThingDef pNew, ResearchProjectDef pResearchToHideWith = null)
{
pOld.researchPrerequisite = (pResearchToHideWith == null ? ResearchProjectDef.Named(lockedResearch) : pResearchToHideWith);
pNew.researchPrerequisite = (ResearchProjectDef)null;
}
}


A call to it would look like so:
ThingDef.Named("ThingToLock").ReplaceInMenu(ThingDef.Named("ThingToUnlock"));

Now this is just a stripped down version of what I'm using, to illustrate what I'm doing. Since I'm swapping one item for another when completing research, this works nicely. But of course could be changed to work for other situations.

Hope this helps in some way! I know it's not quite what you were after, but does mimic the result for the most part. And if I've done anything horribly wrong or undesirable, please let me know. This mod is my first time using C# and most of my coding experience before this point has been with scripting languages.


PS: Loving the game, Tynan! This is the first game that's truly inspired me to make a full-fledged mod, learning C# in the process. I look forward to seeing what RimWorld will become over time.