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 - marton

#1
Anyone else waiting for Quantum Storage before starting their first A17 game? :)
#2
Hey man, fantastic mods!

Have you thought about making quantum relays work across different colonies on different maps? I don't know how feasible this might be, but it'd really make small bases set up just for mining viable.

I know it'd be OP from many angles but it'd certainly complement my playstyle.

Having said that, is there a rough ETA for the A17 version?
#3
So as it turns out three of my guys were carrying 0-size stacks of lavish meals on themselves, and they were trying to eat these every time they went hungry.

Not quite sure how this happened but I don't think any of the mods are to blame.
#4
I decided to look in the save file instead. Fortunately it's just a big old XML.

I found this:

<li Class="ThingWithComps">
<def>MealLavish</def>
<id>MealLavish14540087</id>
<pos>(103, 0, 333)</pos>
<health>36</health>
<stackCount>0</stackCount>
<ingredients>
<li>Elephant_Meat</li>
<li>RawBerries</li>
<li>RawPotatoes</li>
</ingredients>
</li>


How does this even happen? Anyway, edited the stack size to be 1 and things seem to be OK now. Sorry for messing up the forums with this.
#5
Ok, so I removed all meals from quantum stockpiles, and I still get the same exception from time to time. It always seems to be on Thing_MealLavish14536182 or 14540087. I guess those are two specific stacks? I found one pile that always throws an exception when right-clicked while a colonist is selected (an "object reference not set to an instance" error in FloatMenuMakerMap) - I forbade this pile and now only Thing_MealLavish14536182 comes up for the colonist exception. I can't seem to find any problem with the rest of the piles though, so I'm not sure how I go about finding this.

Maybe I can sell all my lavish meals to a caravan, let them deal with the problem. :)
#6
Hey,

I have no idea if this is the best place to ask this, but how would you go about figuring out what mod is causing this?

http://i.imgur.com/DtgwKHz.png

(Sorry for image of text but I couldn't figure out how to copy the stack trace from the debug window.)

I have a few pawns that will occasionally just stand around and starve. Maybe 3 out of 20. It's always these guys though, doesn't happen to others. When they space out like this, if I set them to do a task, they will do it - but will resume creepily staring at me through the screen right after. Unless I order them to eat a meal; in which case they will gobble it up and then carry on with whatever it is that needs their attention. (The trace seems to suggest they were trying to eat <= 0 lavish meals when the exception was thrown?)

I am running a whole lot of mods, but nothing unusual. All of Fluffy's stuff, most of the Edb mods, the Misc mods, quantum storage, etc. This started happening recently but I haven't added or removed mods in a while. Yes, the meals are in quantum stockpiles but they have been for a while, and there were never any issues.
#7
Help / Re: Problem with door mod - help?
August 04, 2016, 01:18:50 PM
I inherited from Building, not Building_Door, as I wanted it to be a reimplementation - I wanted to change things you can't change by overriding one or two members as the class relies heavily on private data fields. So I guess the notification is only called by the engine for Building_Door, and not for other classes derived from Building?
#8
Help / Re: Problem with door mod - help?
August 03, 2016, 10:18:07 PM
As a start I made an exact copy of the code from Building_Door.cs and the associated XML; the only thing I changed was the namespace and the class name. The new door was buildable in game, but wouldn't play the open animation when someone tried to walk through it. Perplexed, I put in logging into every function and noticed that the notification wasn't being called at all.

Don't sweat it too much though. Like I said, this isn't blocking anything because the other approach works. Inheriting from Building_Door lets me use the base class for everything, and the base class handles the notification and animation just fine.
#9
Help / Re: Problem with door mod - help?
August 03, 2016, 01:09:32 PM
Holy cow, that's awesome, thank you! I'll give it a try.

How do you know this stuff? The Core mod doesn't have it, none of the 50 mods I have installed have it, and the C# source that ships with the game references it in exactly one place:


if( passability == Traversability.Impassable || thingClass == typeof(Building_Door) || temporaryRegionBarrier )
        regionBarrier = true;


This of course explains the root cause of the problem. But.. mind blown.

Would you also happen to know why Notify_PawnApproaching isn't called if I create a new class that reimplements Building_Door under a different name by inheriting from Building? Without that callback I can't start opening the door for friendlies. This is purely academic: the hack job above with regionBarrier will work perfectly, but I spent an hour on this approach last night and gave up in the end.
#10
Help / Re: Problem with door mod - help?
August 03, 2016, 09:18:33 AM
Ah ok - at first I thought you meant the CCL specifically addressed the issue with doors already. Thanks, I'll look into the detour stuff.
#11
Help / Re: Problem with door mod - help?
August 03, 2016, 06:23:32 AM
Thanks for the quick response! I do actually have CCL loaded and enabled, and it doesn't help. Or would I have to make my mod CCL-specific in some way?
#12
Help / Re: Problem with door mod - help?
August 03, 2016, 04:44:30 AM
Just some clarification on what the code does: the XML is a lightly modified copy of the DoorBase and AutoDoor ThingDefs. The main thing (other than upping the hitpoints, work, and cost) is the thingClass that ties it to the C# code.

The assembly itself is super simple. The new door hijacks the toggle gizmo that's normally used to hold a door open, and replaces it with its own gizmo that calls the original toggleAction in my ToggleDoor function; this is realCommandToggle.toggleAction.Invoke(). It's a hatchet job but I did not want to copy & paste code from the game and the original code is a lambda that's only accessible from the original gizmo's toggleAction member. (If I don't do this, I pretty much have to reimplement Building_Door as I can't do what I need to do with inheritance, due to the fact that all the important variables are set private.)

Anyway, longwinded explanation aside, I don't think any of this matters when it comes to the indoor/outdoor problem. I just wanted to make sure you understand what's going on in the code.
#13
Help / Problem with door mod - help?
August 03, 2016, 04:27:23 AM
Hey guys,

I'm trying to create a simple mod that lets you construct an autodoor that can be opened and closed remotely. It's all fine, except for one thing: the door doesn't actually close a room to make it "indoors". Again, everything works: remote open, remote close, pawns walk through and open the door, it blocks enemies, etc - just like with regular autodoors. If, however, I create a simple 3x3 room outside with my door at the entrance, the room will remain outdoors. If I use a regular autodoor instead, everything is fine and the test room is now indoors.

The code is pasted below. The wacky thing is that if I change the XML so that thingClass is Building_Door instead of my new class RemoteDoor.Building_RemoteDoor, the test room is "indoors" again - of course I lose the remote open/close functionality because the C# code is never called.

So the problem is either in C# (which I find hard to believe as the code is super simple and inherits everything from RimWorld.Building_Door), or it's the fact that the thingClass is not Building_Door (but why would that matter)?

XML:

<?xml version="1.0" encoding="utf-8" ?>
<Buildings>

  <!--========================= Doors =============================-->

  <ThingDef ParentName="BuildingBase" Name="RemoteDoorBase" Abstract="True">
    <thingClass>RemoteDoor.Building_RemoteDoor</thingClass>
    <blueprintClass>Blueprint_Door</blueprintClass>
    <category>Building</category>
    <blueprintGraphicData>
      <texPath>Things/Building/Door/Door_Blueprint</texPath>
    </blueprintGraphicData>
    <altitudeLayer>DoorMoveable</altitudeLayer>
    <fillPercent>1</fillPercent>
    <useHitPoints>true</useHitPoints>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
      <li>Stony</li>
    </stuffCategories>
    <statBases>
      <MaxHitPoints>500</MaxHitPoints>
      <Flammability>1.0</Flammability>
    </statBases>
    <leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
    <selectable>true</selectable>
    <tickerType>Normal</tickerType>
    <rotatable>false</rotatable>
    <soundImpactDefault>BulletImpactMetal</soundImpactDefault>
    <terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
    <designationCategory>Structure</designationCategory>
    <holdsRoof>true</holdsRoof>
    <staticSunShadowHeight>1.0</staticSunShadowHeight>
    <blockLight>true</blockLight>
    <drawerType>RealtimeOnly</drawerType>
    <building>
      <soundDoorOpenPowered>DoorOpenPowered</soundDoorOpenPowered>
      <soundDoorClosePowered>DoorClosePowered</soundDoorClosePowered>
      <soundDoorOpenManual>DoorOpenManual</soundDoorOpenManual>
      <soundDoorCloseManual>DoorCloseManual</soundDoorCloseManual>
      <ignoreNeedsPower>true</ignoreNeedsPower>
      <canPlaceOverWall>true</canPlaceOverWall>
    </building>
    <comps>
      <li Class="CompProperties_Forbiddable"/>
    </comps>
  </ThingDef>

  <ThingDef ParentName="RemoteDoorBase">
    <defName>RemoteDoor</defName>
    <label>Remote Door</label>
    <description>Divides rooms. Powered operation allows people to move through the door without slowing down.</description>
    <statBases>
      <MaxHitPoints>1500</MaxHitPoints>
      <WorkToMake>2200</WorkToMake>
    </statBases>
    <graphicData>
      <texPath>Things/Building/Door/Autodoor_Mover</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <damageData>
        <enabled>false</enabled>
      </damageData>
    </graphicData>
    <uiIconPath>Things/Building/Door/Autodoor_MenuIcon</uiIconPath>
    <costList>
      <Steel>40</Steel>
      <Component>4</Component>
    </costList>
    <costStuffCount>50</costStuffCount>
    <comps>
      <li Class="CompProperties_Power">
        <compClass>CompPowerTrader</compClass>
        <basePowerConsumption>80</basePowerConsumption>
      </li>
      <li Class="CompProperties_Breakdownable"/>
    </comps>
    <researchPrerequisites>
      <li>Autodoors</li>
    </researchPrerequisites>
  </ThingDef>

</Buildings>


C#:


using UnityEngine;
using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using Verse;
using Verse.Sound;
using Verse.AI;
using Verse.AI.Group;
using System.Diagnostics;

namespace RemoteDoor
{
    public class Building_RemoteDoor : RimWorld.Building_Door
    {
        Command_Toggle realCommandToggle = null;

        public void ToggleDoor()
        {
            if (realCommandToggle != null)
            {
                realCommandToggle.toggleAction.Invoke();
                if (DoorPowerOn)
                {
                    if (realCommandToggle.isActive())
                        DoorOpen();
                    else
                        DoorTryClose();
                }
            }
        }

        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                Command c = (Command)g;
                if (c.icon == RimWorld.TexCommand.HoldOpen)
                {
                    // this is way messier than I'd have liked but
                    // the base class keeps the holdOpenInt variable private...
                    // things would be so much cleaner with direct access to it
                    Command_Toggle ct = (Command_Toggle)c;
                    realCommandToggle = ct;

                    Command_Toggle ro = new Command_Toggle();
                    ro.defaultLabel = "Cycle door";
                    ro.defaultDesc = "Cycle the door remotely";
                    ro.icon = RimWorld.TexCommand.HoldOpen;
                    ro.isActive = ct.isActive;
                    ro.toggleAction = new Action(this.ToggleDoor);
                    yield return ro;
                    continue;
                }
                yield return g;
            }
        }
    }
}