X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fsandbox.qc;h=e84c6d696a91e691ccadabf6c68cd927febbc97f;hp=cf5d82f87ae4ecf141afd7d80dbbb31af2a07e43;hb=3adaa0873ad9eac20f32e6e3fc0455d4f9e044cd;hpb=bd71e076bdb4066094634ee70e7cdce9b2fc4002 diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index cf5d82f87..e84c6d696 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -20,13 +20,13 @@ void sandbox_ObjectFunction_Touch() intensity = vlen(self.velocity) + vlen(other.velocity); if(intensity) // avoid divisions by 0 intensity /= 2; // average the two velocities - if not(intensity >= autocvar_g_sandbox_object_material_velocity_min) + if (!(intensity >= autocvar_g_sandbox_object_material_velocity_min)) return; // impact not strong enough to do anything // now offset intensity and apply it to the effects 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)) , ".wav"), 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 } @@ -56,6 +56,8 @@ void sandbox_ObjectFunction_Think() } self.nextthink = time; + + CSQCMODEL_AUTOUPDATE(); } .float old_solid, old_movetype; @@ -72,9 +74,9 @@ 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) + if (!(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 return world; } @@ -137,7 +139,7 @@ entity sandbox_ObjectSpawn(float database) { // spawn a new object with default properties - entity e; + entity e, oldself; e = spawn(); e.classname = "object"; e.takedamage = DAMAGE_AIM; @@ -172,6 +174,11 @@ entity sandbox_ObjectSpawn(float database) setorigin(e, trace_endpos); e.angles_y = self.v_angle_y; } + + oldself = self; + self = e; + CSQCMODEL_AUTOINIT(); + self = oldself; object_count += 1; return e; @@ -389,7 +396,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; @@ -484,7 +491,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command"); return TRUE; } - if not(fexists(argv(2))) + if (!(fexists(argv(2)))) { print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct"); return TRUE; @@ -538,7 +545,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; @@ -610,7 +617,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;