public File save_map(dynamic t1 = null, dynamic t2 = null, string map_name = null, dynamic flags = null) { dynamic file_text = null; File saved_map = null; if (!(String13.CKeyPreserveCase(map_name) == map_name && Lang13.Bool(String13.CKeyPreserveCase(map_name)))) { Task13.Crash("Invalid text supplied to proc save_map, invalid characters or empty string."); } if (!(t1 is Tile) || !(t2 is Tile)) { Task13.Crash("Invalid arguments supplied to proc save_map, arguments were not turfs."); } file_text = this.__CallVerb("write map", t1, t2, flags); if (File13.Exists("" + map_name + ".dmm")) { File13.Delete("" + map_name + ".dmm"); } saved_map = new File("" + map_name + ".dmm"); saved_map.WriteMsg(file_text); return(saved_map); }
// Function from file: musician.dm public void playnote( int note = 0, string acc = null, int oct = 0 ) { dynamic soundfile = null; dynamic source = null; dynamic M = null; if ( acc == "b" && ( note == 3 || note == 6 ) ) { if ( note == 3 ) { oct--; } note--; acc = "n"; } else if ( acc == "#" && ( note == 2 || note == 5 ) ) { if ( note == 2 ) { oct++; } note++; acc = "n"; } else if ( acc == "#" && note == 7 ) { note = 1; acc = "b"; } else if ( acc == "#" ) { acc = "b"; note++; } if ( oct < 1 || ( note == 3 ? oct > 9 : oct > 8 ) ) { return; } soundfile = "sound/" + this.instrumentDir + "/" + String13.GetCharFromCode( note + 64 ) + acc + oct + "." + this.instrumentExt; soundfile = new File( soundfile ); if ( !File13.Exists( soundfile ) ) { return; } source = GlobalFuncs.get_turf( this.instrumentObj ); foreach (dynamic _a in Lang13.Enumerate( GlobalFuncs.get_hearers_in_view( 15, source ) )) { M = _a; if ( !Lang13.Bool( M.client ) || !Lang13.Bool( M.client.prefs.toggles & 128 ) ) { continue; } ((Ent_Static)M).playsound_local( source, soundfile, 100, null, null, 5 ); } return; }
// Function from file: personality.dm public bool savefile_load(Mob user = null, bool?silent = null) { silent = silent ?? true; string path = null; SaveFile F = null; bool? version = null; if (GlobalFuncs.IsGuestKey(user.key)) { return(false); } path = this.savefile_path(user); if (!File13.Exists(path)) { return(false); } F = new SaveFile(path); if (!(F != null)) { return(false); } version = null; version = F.ReadItem("version", version); if (version == null || version != true) { File13.Delete(path); if (!(silent == true)) { Interface13.Alert(user, "Your savefile was incompatible with this version and was deleted."); } return(false); } this.name = F.ReadItem("name", this.name); this.description = F.ReadItem("description", this.description); this.role = F.ReadItem("role", this.role); this.comments = F.ReadItem("comments", this.comments); return(true); }