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

#1
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.
#2
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;
            }
        }
    }
}