X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcheats.qc;h=22b793d3966a35cd631f2c1a0c2e73213984e42f;hb=b03338e49b3b16ec20c59a9809abe16bebcd29ce;hp=f04fc8472288e11ae3b9c6e3da1a0c47e4ed6e82;hpb=117b5f5c44a743f9189e378bc0fcc33c23068c27;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index f04fc8472..22b793d39 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -50,7 +50,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a return 0; if(gamestart_sv_cheats < 2 && !IS_PLAYER(self)) return 0; - + // sv_clones if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING) if(self.lip < sv_clones) @@ -59,20 +59,20 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a // haha if(self.maycheat) return 1; - + // sv_cheats if(gamestart_sv_cheats && autocvar_sv_cheats) return 1; // if we get here, player is not allowed to cheat. Log it. if(i) - bprint(sprintf("Player %s^7 tried to use cheat 'impulse %d'\n", self.netname, i)); + bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", self.netname, i); else if(argc) - bprint(sprintf("Player %s^7 tried to use cheat '%s'\n", self.netname, argv(0))); + bprintf("Player %s^7 tried to use cheat '%s'\n", self.netname, argv(0)); else if(fr) - bprint(sprintf("Player %s^7 tried to use cheat frame %d\n", self.netname, fr)); + bprintf("Player %s^7 tried to use cheat frame %d\n", self.netname, fr); else - bprint(sprintf("Player %s^7 tried to use an unknown cheat\n", self.netname)); + bprintf("Player %s^7 tried to use an unknown cheat\n", self.netname); return 0; } @@ -140,6 +140,7 @@ float CheatImpulse(float i) self.personal.ammo_rockets = self.ammo_rockets; self.personal.ammo_nails = self.ammo_nails; self.personal.ammo_cells = self.ammo_cells; + self.personal.ammo_plasma = self.ammo_plasma; self.personal.ammo_shells = self.ammo_shells; self.personal.ammo_fuel = self.ammo_fuel; self.personal.health = self.health; @@ -190,13 +191,14 @@ float CheatImpulse(float i) self.oldvelocity = self.velocity = self.personal.velocity; self.angles = self.personal.v_angle; self.fixangle = TRUE; - + MUTATOR_CALLHOOK(AbortSpeedrun); } self.ammo_rockets = self.personal.ammo_rockets; self.ammo_nails = self.personal.ammo_nails; self.ammo_cells = self.personal.ammo_cells; + self.ammo_plasma = self.personal.ammo_plasma; self.ammo_shells = self.personal.ammo_shells; self.ammo_fuel = self.personal.ammo_fuel; self.health = self.personal.health; @@ -264,7 +266,7 @@ float CheatImpulse(float i) e2 = spawn(); setorigin(e2, e.origin); - RadiusDamage(e2, self, 1000, 0, 128, world, 500, DEATH_CHEAT, e); + RadiusDamage(e2, self, 1000, 0, 128, world, world, 500, DEATH_CHEAT, e); remove(e2); print("404 Sportsmanship not found.\n"); @@ -718,7 +720,7 @@ float CheatCommand(float argc) END_CHEAT_FUNCTION(); } -float Drag(entity e, float grab, float ischeat); +float Drag(float force_allow_pick, float ischeat); void Drag_Begin(entity dragger, entity draggee, vector touchpoint); void Drag_Finish(entity dragger); float Drag_IsDraggable(entity draggee); @@ -748,40 +750,11 @@ float CheatFrame() { // use cheat dragging if cheats are enabled crosshair_trace_plusvisibletriggers(self); - Drag(trace_ent, TRUE, TRUE); + Drag(TRUE, TRUE); } else { - // drag is TRUE if the object can be picked up. While an object is being carried, the Drag() function - // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace. - // This also makes sure that an object can only pe picked up if in range, but does not get dropped if - // it goes out of range while slinging it around. - - float drag; - crosshair_trace_plusvisibletriggers(self); - drag = FALSE; - if(vlen(self.origin - trace_ent.origin) <= autocvar_g_grab_range) - { - switch(trace_ent.grab) - { - case 0: // can't grab - break; - case 1: // owner can grab - if(trace_ent.owner == self || trace_ent.realowner == self) - drag = TRUE; - break; - case 2: // owner and team mates can grab - if(SAME_TEAM(trace_ent.owner, self) || SAME_TEAM(trace_ent.realowner, self) || trace_ent.team == self.team) - drag = TRUE; - break; - case 3: // anyone can grab - drag = TRUE; - break; - default: - break; - } - } - Drag(trace_ent, drag, FALSE); // execute dragging + Drag(FALSE, FALSE); // execute dragging } break; } @@ -795,7 +768,7 @@ float CheatFrame() // ENTITY DRAGGING -float Drag(entity e, float pick, float ischeat) +float Drag(float force_allow_pick, float ischeat) { BEGIN_CHEAT_FUNCTION(); @@ -840,9 +813,42 @@ float Drag(entity e, float pick, float ischeat) else { if(Drag_CanDrag(self)) - if(self.BUTTON_DRAG && pick) + if(self.BUTTON_DRAG) { - if(e) + crosshair_trace_plusvisibletriggers(self); + entity e = trace_ent; + float pick = force_allow_pick; + if (e && !pick) + { + // pick is TRUE if the object can be picked up. While an object is being carried, the Drag() function + // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace. + // This also makes sure that an object can only pe picked up if in range, but does not get dropped if + // it goes out of range while slinging it around. + + if(vlen(self.origin - e.origin) <= autocvar_g_grab_range) + { + switch(e.grab) + { + case 0: // can't grab + break; + case 1: // owner can grab + if(e.owner == self || e.realowner == self) + pick = TRUE; + break; + case 2: // owner and team mates can grab + if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team) + pick = TRUE; + break; + case 3: // anyone can grab + pick = TRUE; + break; + default: + break; + } + } + } + // Find e and pick + if(e && pick) if(Drag_IsDraggable(e)) { if(ischeat)