X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcheats.qc;h=d5c145f26cc144a282de1038811046c7bb0ffa49;hp=3270a9077fbcb1c7b640303553026221836ec7f3;hb=a86fa5a48ac75276db3da34fd3721678517c62fa;hpb=9c40c25078426ed90e985c402c648fea3e3a8832 diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 3270a9077f..d5c145f26c 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -604,14 +604,6 @@ float CheatCommand(float argc) remove(e); DID_CHEAT(); break; - case "warp": - IS_CHEAT(0, argc, 0); - if(argc == 2) if(autocvar_g_campaign) - { - CampaignLevelWarp(stof(argv(1))); - DID_CHEAT(); - } - break; case "god": IS_CHEAT(0, argc, 0); BITXOR_ASSIGN(self.flags, FL_GODMODE); @@ -672,7 +664,7 @@ float CheatCommand(float argc) END_CHEAT_FUNCTION(); } -void crosshair_trace_plusvisibletriggers(entity pl); +float Drag(entity e, float grab); void Drag_Begin(entity dragger, entity draggee, vector touchpoint); void Drag_Finish(entity dragger); float Drag_IsDraggable(entity draggee); @@ -690,6 +682,46 @@ float CheatFrame() { BEGIN_CHEAT_FUNCTION(); + // Dragging can be used as either a cheat, or a tool for g_sandbox. If sv_cheats is active, + // the cheat dragging is used (unlimited pickup range and any entity can be carried), even if + // g_sandbox is enabled. Is sv_cheats is disabled but g_sandbox is not, then sandbox dragging + // is used (limited pickup range and only sandbox objects can be carried), grabbing itself + // no longer being accounted as cheating. If both sv_cheats and g_sandbox are disabled, players + // attempting to grab objects are reported as trying to cheat. + + switch(0) + { + default: + if(self.BUTTON_DRAG && !cvar("g_sandbox")) + { + // consider dragging a cheat only if sandbox mode is disabled + IS_CHEAT(0, 0, CHRAME_DRAG); + } + if(autocvar_sv_cheats) + { + // only use cheat dragging if cheats are enabled + crosshair_trace_plusvisibletriggers(self); + if(Drag(trace_ent, TRUE) && !cvar("g_sandbox")) + DID_CHEAT(); + } + break; + } + + END_CHEAT_FUNCTION(); +} + + + + + +// ENTITY DRAGGING + +float Drag(entity e, float grab) +{ + // returns TRUE when an entity has been picked up + // If grab is TRUE, the object can also be picked up if it's not being held already + // If grab is FALSE, only keep dragging the object if it's already being held + if(Drag_IsDragging(self)) { if(self.BUTTON_DRAG) @@ -724,49 +756,21 @@ float CheatFrame() else { if(Drag_CanDrag(self)) - if(self.BUTTON_DRAG) + if(self.BUTTON_DRAG && grab) { - crosshair_trace_plusvisibletriggers(self); - if(trace_ent) - if(Drag_IsDraggable(trace_ent)) - switch(0) - { - default: - IS_CHEAT(0, 0, CHRAME_DRAG); - if(trace_ent.draggedby) - Drag_Finish(trace_ent.draggedby); - if(trace_ent.tag_entity) - detach_sameorigin(trace_ent); - Drag_Begin(self, trace_ent, trace_endpos); - DID_CHEAT(); - break; - } + if(e) + if(Drag_IsDraggable(e)) + { + if(e.draggedby) + Drag_Finish(e.draggedby); + if(e.tag_entity) + detach_sameorigin(e); + Drag_Begin(self, e, trace_endpos); + return TRUE; + } } } - - END_CHEAT_FUNCTION(); -} - - - - - -// ENTITY DRAGGING - -void crosshair_trace_plusvisibletriggers(entity pl) -{ - entity first; - entity e; - first = findchainfloat(solid, SOLID_TRIGGER); - - for (e = first; e; e = e.chain) - if (e.model != "") - e.solid = SOLID_BSP; - - crosshair_trace(pl); - - for (e = first; e; e = e.chain) - e.solid = SOLID_TRIGGER; + return FALSE; } // on dragger: @@ -945,11 +949,6 @@ void Drag_MoveDrag(entity from, entity to) } } - - - - - void DragBox_Think() { if(self.aiment && self.enemy)