public bool HandleEvent(BrewingFinishedEvent e) { var liquidVolume = ParentObject.GetPart <LiquidVolume>(); string beverage = null; if (LiquidVolume.isValidLiquid(e.Recipe.Beverage)) { beverage = e.Recipe.Beverage; } else if (PopulationManager.HasPopulation(e.Recipe.Beverage)) { beverage = PopulationManager.RollOneFrom(e.Recipe.Beverage).Blueprint; } if (beverage != null && LiquidVolume.isValidLiquid(beverage)) { liquidVolume.MixWith(new LiquidVolume(beverage, 1)); var message = e.Recipe.Mistake ? MESSAGE_BREWING_FAILURE : e.Recipe.Tricky ? MESSAGE_BREWING_SUCCESS_TRICKY : MESSAGE_BREWING_SUCCESS; AddPlayerMessage(VariableReplace( message.Replace( "=liquid=", liquidVolume.GetLiquidName() ), Subject: ParentObject )); if (e.Recipe.Mistake) { GetAnnoyed(e.Activator); } } else { AddPlayerMessage(VariableReplace( MESSAGE_BREWING_HUH, Subject: ParentObject )); } return(true); }
public void setType() { string populationName = "Explosives " + Mark; int num = 0; while (true) { string MineType = PopulationManager.RollOneFrom(populationName).Blueprint; GameObject gameObject = GameObjectFactory.Factory.CreateSampleObject(MineType); bool flag = gameObject.HasPart("Tinkering_Layable"); if (flag) { this.Explosive = gameObject; break; } gameObject.Destroy(); } this.Arm(); }