private void Room_Open(On.Room.orig_Open orig, Room self, Door openingDoor, bool ignoreVisibility) { Dungeon d = SingletonManager.Get <Dungeon>(false); if (d.ShipName == mod.GetName()) { new DynData <Room>(self).Set <int>("DustLootAmount", 0); // Sets the dust value of this room to 0 mod.Log("Set the dust value of this room to 0!"); orig(self, openingDoor, ignoreVisibility); return; } orig(self, openingDoor, ignoreVisibility); }
private void Room_Open(On.Room.orig_Open orig, Room self, Door openingDoor, bool ignoreVisibility) { if ((mod.settings as DustGeneratorSettings).DustFromRoom) { // You can reuse a DynData wrapper for multiple get / set operations on the same object new DynData <Room>(self).Set <int>("DustLootAmount", (int)(mod.settings as DustGeneratorSettings).DustPerDoor); // Sets the dust value of this room to 10 mod.Log("Attempting to spawn: " + self.DustLootAmount + " dust in room!"); orig(self, openingDoor, ignoreVisibility); return; } orig(self, openingDoor, ignoreVisibility); mod.Log("Using default room collection: " + self.DustLootAmount); }