// Play a short "cutscene", forcing the player to climb a pole when starting a new game private void Room_Loaded(On.Room.orig_Loaded orig, Room self) { bool firstTimeRealized = self.abstractRoom.firstTimeRealized; orig(self); if (self.game == null) { return; } // Make sure this is the right room if (!self.game.IsStorySession) { return; } if (!firstTimeRealized) { return; } if (self.abstractRoom.name != StartRoom) { return; } if (self.game.GetStorySession.saveState.denPosition != StartRoom) { return; } self.AddObject(new SprinterStart(self)); }
private static void RoomLoadedPatch(On.Room.orig_Loaded orig, Room room) { if (room.abstractRoom.firstTimeRealized) { if (!room.abstractRoom.shelter && !room.abstractRoom.gate && room.game != null && (!room.game.IsArenaSession || room.game.GetArenaGameSession.GameTypeSetup.levelItems)) { for (int i = (int)((float)room.TileWidth * (float)room.TileHeight * Mathf.Pow(room.roomSettings.RandomItemDensity * room.roomSettings.RandomItemSpearChance * clubReplaceChance, 2f) / 5f); i >= 0; i--) { IntVector2 spawnTile = room.RandomTile(); if (!room.GetTile(spawnTile).Solid) { bool canSpawnHere = true; for (int j = -1; j < 2; j++) { if (!room.GetTile(spawnTile + new IntVector2(j, -1)).Solid) { canSpawnHere = false; break; } } if (canSpawnHere) { EntityID newID = room.game.GetNewID(-room.abstractRoom.index); AbstractPhysicalObject entity = new AbstractPhysicalObject(room.world, EnumExt_NewItems.Club, null, new WorldCoordinate(room.abstractRoom.index, spawnTile.x, spawnTile.y, -1), newID); room.abstractRoom.AddEntity(entity); } } } } } orig(room); }
private void Room_Loaded(On.Room.orig_Loaded orig, Room self) { if (self.game != null) { LOSController losController; self.AddObject(losController = new LOSController(self)); self.AddObject(new ShortcutDisplay(losController)); } orig(self); }
private static void Room_Loaded(On.Room.orig_Loaded orig, Room self) { orig.Invoke(self); //Enable Weather Per-Region based on Config if (self.game != null && !self.game.IsArenaSession) { if (Downpour.rainRegions.Contains(self.world.region.name)) { noRain = false; } else { noRain = true; } } else { noRain = false; } //Add lightning effect to rooms. if (!noRain) { //Add Rain Sound Object if (self.game != null && self.roomRain != null) { self.AddObject(new RainSound(self)); } } if (Downpour.snow && Downpour.blizzard) { if (self.game != null && !self.abstractRoom.shelter) { self.AddObject(new WeatherSounds(self)); } } }
private static void Room_Loaded(On.Room.orig_Loaded orig, Room self) { if (self.game == null) { return; } bool firstTimeRealized = self.abstractRoom.firstTimeRealized; orig(self); if (firstTimeRealized) { for (int m = 0; m < self.roomSettings.placedObjects.Count; m++) { if (self.roomSettings.placedObjects[m].active) { PlacedObject placedObj = self.roomSettings.placedObjects[m]; //PlacedObject.Type type = placedObj.type; //CustomWorldMod.Log($"Checking if [{type}] is {EnumExt_PlacedObjectType.VultureMaskSpawn}"); if (placedObj.data is PlacedObject.MultiplayerItemData && UnityEngine.Random.value <= (placedObj.data as PlacedObject.MultiplayerItemData).chance) { PlacedObject.MultiplayerItemData.Type typeMulti = (placedObj.data as PlacedObject.MultiplayerItemData).type; switch (typeMulti) { case PlacedObject.MultiplayerItemData.Type.Rock: // if ((self.game.session is StoryGameSession) && !(self.game.session as StoryGameSession).saveState.ItemConsumed(self.world, false, self.abstractRoom.index, m)) { CustomWorldMod.Log("Added abstract reliable rock"); AbstractPhysicalObject obj = new AbstractPhysicalObject(self.world, AbstractPhysicalObject.AbstractObjectType.Rock, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID()); self.abstractRoom.entities.Add(obj); } break; case PlacedObject.MultiplayerItemData.Type.ExplosiveSpear: //if ((self.game.session is StoryGameSession) && !(self.game.session as StoryGameSession).saveState.ItemConsumed(self.world, false, self.abstractRoom.index, m)) { CustomWorldMod.Log("Added abstract explosive spear"); AbstractPhysicalObject obj = new AbstractSpear(self.world, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID(), true); self.abstractRoom.entities.Add(obj); } break; case PlacedObject.MultiplayerItemData.Type.Spear: //if ((self.game.session is StoryGameSession) && !(self.game.session as StoryGameSession).saveState.ItemConsumed(self.world, false, self.abstractRoom.index, m)) { CustomWorldMod.Log("Added abstract spear"); AbstractPhysicalObject obj = new AbstractSpear(self.world, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID(), false); self.abstractRoom.entities.Add(obj); } break; case PlacedObject.MultiplayerItemData.Type.Bomb: // if ((self.game.session is StoryGameSession) && !(self.game.session as StoryGameSession).saveState.ItemConsumed(self.world, false, self.abstractRoom.index, m)) { CustomWorldMod.Log("Added abstract scavenger bomb"); AbstractPhysicalObject obj = new AbstractPhysicalObject(self.world, AbstractPhysicalObject.AbstractObjectType.ScavengerBomb, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID()); self.abstractRoom.entities.Add(obj); } break; case PlacedObject.MultiplayerItemData.Type.SporePlant: if ((self.game.session is StoryGameSession) && !(self.game.session as StoryGameSession).saveState.ItemConsumed(self.world, false, self.abstractRoom.index, m)) { CustomWorldMod.Log("Added abstract scavenger bomb"); AbstractPhysicalObject obj = new AbstractPhysicalObject(self.world, AbstractPhysicalObject.AbstractObjectType.SporePlant, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID()); self.abstractRoom.entities.Add(obj); } break; default: // Extended enums go here if (typeMulti == EnumExt_MultiplayerItemDataType.VultureMaskSpawn || typeMulti == EnumExt_MultiplayerItemDataType.KingVultureMaskSpawn) { CustomWorldMod.Log($"Added {(typeMulti == EnumExt_MultiplayerItemDataType.KingVultureMaskSpawn ? "king" : "")} vulture mask"); EntityID newID = self.game.GetNewID(); AbstractPhysicalObject obj = new VultureMask.AbstractVultureMask(self.world, null, self.GetWorldCoordinate(placedObj.pos), newID, newID.RandomSeed, typeMulti == EnumExt_MultiplayerItemDataType.KingVultureMaskSpawn); self.abstractRoom.entities.Add(obj); } else if (typeMulti == EnumExt_MultiplayerItemDataType.OverseerCarcassGreen) { CustomWorldMod.Log("Added abstract overseer green carcass"); AbstractPhysicalObject item = new OverseerCarcass.AbstractOverseerCarcass(self.world, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID(), new Color(0.447058827f, 0.9019608f, 0.768627465f), 0); self.abstractRoom.entities.Add(item); } else if (typeMulti == EnumExt_MultiplayerItemDataType.OverseerCarcassBlue) { CustomWorldMod.Log("Added abstract overseer blue carcass"); AbstractPhysicalObject item = new OverseerCarcass.AbstractOverseerCarcass(self.world, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID(), new Color(0f, 1f, 0f), 2); self.abstractRoom.entities.Add(item); } else if (typeMulti == EnumExt_MultiplayerItemDataType.OverseerCarcassYellow) { CustomWorldMod.Log("Added abstract overseer yellow carcass"); AbstractPhysicalObject item = new OverseerCarcass.AbstractOverseerCarcass(self.world, null, self.GetWorldCoordinate(placedObj.pos), self.game.GetNewID(), new Color(1f, 0.8f, 0.3f), 3); self.abstractRoom.entities.Add(item); } break; } } } } } }