public static bool consider(string model_path, TES5.Record stat_rec) { convert(); read_placement_config(); bool taken = false; model_path = Text.model_path_string(model_path); if (model_path.Contains("chair") || model_path.Contains("stool") || model_path.Contains("bench") || model_path.Contains("bed") || model_path.Contains("hammock")) { taken = true; if (!dict.ContainsKey(model_path)) { Log.error("No FURN marker defined for potential furniture model: " + model_path); } Tuple <TES5.Record, TES5.REFR.Placement> marker_data = dict[model_path]; TES5.REFR.Placement pos = marker_data.Item2; TES5.Record addon_base = marker_data.Item1; Convert.REFERENCE.Addon_Rules.add_rule(stat_rec, addon_base.id, /*pos.x*/ 0, pos.y, pos.z, pos.xR, pos.yR, pos.zR); } return(taken); }
private static void read_placement_config() { if (dict != null) { return; } dict = new Dictionary <string, Tuple <TES5.Record, TES5.REFR.Placement> >(); if (!File.Exists(Config.Paths.furniture_marker_config)) { Log.confirm("Furniture Placement Config File was not found. \n Please generate it through FurnitureWorkshop."); return; } TextReader config = File.OpenText(Config.Paths.furniture_marker_config); while (config.Peek() != -1) { string line = config.ReadLine().Trim(); if (line.StartsWith("#")) { continue; } string[] parsed = line.Split(','); string model = parsed[0]; string editor_id = parsed[1]; float x = float.Parse(parsed[2]); float y = float.Parse(parsed[3]); float z = float.Parse(parsed[4]); float xR = float.Parse(parsed[5]); float yR = float.Parse(parsed[6]); float zR = float.Parse(parsed[7]); TES5.Record associated_marker = furn.find_record(editor_id); TES5.REFR.Placement pos = new TES5.REFR.Placement(x, y, z, xR, yR, zR); if (associated_marker == null) { Log.error(editor_id + " was not found in FURN group. Ensure that conversion has run"); } Tuple <TES5.Record, TES5.REFR.Placement> value = new Tuple <TES5.Record, TES5.REFR.Placement>(associated_marker, pos); dict.Add(model, value); } }