X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fsandbox.qc;h=94ba20f10d8320b07f4b1d18e0232cb6dd04bf4d;hp=31a1a4e8546d7256018798902e5da0d174bbdec8;hb=49af10f3413b96e52055359d42288dbf5ec6972b;hpb=dbdc35464a18f62bf550a20eddac9ec16b0eacee diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 31a1a4e85..94ba20f10 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -26,7 +26,7 @@ void sandbox_ObjectFunction_Touch() intensity -= autocvar_g_sandbox_object_material_velocity_min; // start from minimum velocity, not actual velocity intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1); - sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".ogg"), VOL_BASE * intensity, ATTN_NORM); + sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM); pointparticles(particleeffectnum(strcat("impact_", self.material)), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10 } @@ -72,7 +72,7 @@ entity sandbox_ObjectEdit_Get(float permissions) return world; // entity is not an object if(!permissions) return trace_ent; // don't check permissions, anyone can edit this object - if(!trace_ent.crypto_idfp) + if(trace_ent.crypto_idfp == "") return trace_ent; // the player who spawned this object did not have an UID, so anyone can edit it if not(trace_ent.realowner != self && autocvar_g_sandbox_editor_free < 2) return trace_ent; // object does not belong to the player, and players can only edit their own objects on this server @@ -205,7 +205,7 @@ string port_string[MAX_STORAGE_ATTACHMENTS]; // fteqcc crashes if this isn't def string sandbox_ObjectPort_Save(entity e, float database) { // save object properties, and return them as a string - float i; + float i = 0; string s; entity head; @@ -268,6 +268,7 @@ string sandbox_ObjectPort_Save(entity e, float database) } // now apply the array to a simple string, with the ; symbol separating objects + s = ""; for(i = 0; i <= MAX_STORAGE_ATTACHMENTS; ++i) { if(port_string[i]) @@ -282,7 +283,7 @@ entity sandbox_ObjectPort_Load(string s, float database) { // load object properties, and spawn a new object with them float n, i; - entity e, parent; + entity e = world, parent = world; // separate objects between the ; symbols n = tokenizebyseparator(s, "; "); @@ -293,7 +294,7 @@ entity sandbox_ObjectPort_Load(string s, float database) for(i = 0; i < n; ++i) { float argv_num; - string tagname; + string tagname = string_null; argv_num = 0; tokenize_console(port_string[i]); e = sandbox_ObjectSpawn(database); @@ -388,7 +389,7 @@ void sandbox_Database_Load() for(;;) { file_read = fgets(file_get); - if(!file_read) + if(file_read == "") break; if(substring(file_read, 0, 2) == "//") continue; @@ -402,7 +403,7 @@ void sandbox_Database_Load() { // since objects are being loaded for the first time, precache material sounds for each for (i = 1; i <= 5; i++) // 5 sounds in total - precache_sound(strcat("object/impact_", e.material, "_", ftos(i), ".ogg")); + precache_sound(strcat("object/impact_", e.material, "_", ftos(i), ".wav")); } } if(autocvar_g_sandbox_info > 0) @@ -537,7 +538,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) return TRUE; } self.object_flood = time + autocvar_g_sandbox_editor_flood; - if(!argv(3)) // no object in clipboard + if(argv(3) == "") // no object in clipboard { print_to(self, "^1SANDBOX - WARNING: ^7No object in clipboard. You must copy an object before you can paste it"); return TRUE; @@ -609,7 +610,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) // ---------------- COMMAND: OBJECT, EDIT ---------------- case "object_edit": - if(!argv(2)) + if(argv(2) == "") { print_to(self, "^1SANDBOX - WARNING: ^7Too few parameters. You must specify a property to edit"); return TRUE; @@ -674,7 +675,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) if(argv(3)) { for (i = 1; i <= 5; i++) // precache material sounds, 5 in total - precache_sound(strcat("object/impact_", argv(3), "_", ftos(i), ".ogg")); + precache_sound(strcat("object/impact_", argv(3), "_", ftos(i), ".wav")); e.material = strzone(argv(3)); } else @@ -744,13 +745,16 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, strcat("^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname, "^7\", created \"^3", e.message, "^7\", last edited \"^3", e.message2, "^7\"")); return TRUE; case "mesh": + s = ""; FOR_EACH_TAG(e) s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", "); print_to(self, strcat("^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model, "^7\" at animation frame ^3", ftos(e.frame), " ^7containing the following tags: ", s)); return TRUE; case "attachments": // this should show the same info as 'mesh' but for attachments + s = ""; entity head; + i = 0; for(head = world; (head = find(head, classname, "object")); ) { if(head.owner == e) @@ -813,6 +817,16 @@ MUTATOR_DEFINITION(sandbox) sandbox_Database_Load(); } + MUTATOR_ONROLLBACK_OR_REMOVE + { + // nothing to roll back + } + + MUTATOR_ONREMOVE + { + // nothing to remove + } + return FALSE; }