]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an undraggable function and make use of it in the exclusions
authorMario <mario@smbclan.net>
Mon, 24 Sep 2018 08:07:29 +0000 (18:07 +1000)
committerMario <mario@smbclan.net>
Mon, 24 Sep 2018 08:07:29 +0000 (18:07 +1000)
qcsrc/common/mapobjects/func/bobbing.qc
qcsrc/common/mapobjects/func/button.qc
qcsrc/common/mapobjects/func/plat.qc
qcsrc/server/cheats.qc
qcsrc/server/cheats.qh
qcsrc/server/client.qc
qcsrc/server/weapons/weaponsystem.qc

index b647e15a826e48164f03db46c5f62114a8e6afc6..60920fafb8c5c95599af7b2090570bfc30ae84d6 100644 (file)
@@ -48,6 +48,8 @@ spawnfunc(func_bobbing)
 
        this.active = ACTIVE_ACTIVE;
 
+       this.draggable = drag_undraggable;
+
        // damage when blocked
        setblocked(this, generic_plat_blocked);
        if(this.dmg && (this.message == ""))
index 44e31284336aae99eb35f580dff390b5db98797b..a8537f172534225adce4855a8713e34fdaecbcfb 100644 (file)
@@ -158,6 +158,7 @@ spawnfunc(func_button)
         precache_sound(this.noise);
 
        this.active = ACTIVE_ACTIVE;
+       this.draggable = drag_undraggable;
 
        this.pos1 = this.origin;
        this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
index b052336217990a32a646d852679bc3c0d1d83c20..53dbed02fa42a50580b69efe7ef80143ba0b0f5e 100644 (file)
@@ -103,6 +103,7 @@ spawnfunc(func_plat)
        this.angles = '0 0 0';
 
        this.classname = "plat";
+       this.draggable = drag_undraggable;
        if (!InitMovingBrushTrigger(this))
                return;
        this.effects |= EF_LOWPRECISION;
index 5bf11df86ef5a732d3f59401423ab8ed0705a554..5ca5270d614dda0b5212a827c5fa5922162e8f51 100644 (file)
@@ -915,29 +915,22 @@ void Drag_Finish(entity dragger)
        }
 }
 
+bool drag_undraggable(entity draggee, entity dragger)
+{
+       // stuff probably shouldn't need this, we should figure out why they do!
+       // exceptions of course are observers and weapon entities, where things mess up
+       return false;
+}
+
 float Drag_IsDraggable(entity draggee, entity dragger)
 {
        // TODO add more checks for bad stuff here
        if(draggee == NULL)
                return false;
-       if(draggee.classname == "func_bobbing")
-               return false;
        if(draggee.classname == "door") // FIXME find out why these must be excluded, or work around the problem (trying to drag these causes like 4 fps)
-               return false;
-       if(draggee.classname == "plat")
-               return false;
-       if(draggee.classname == "func_button")
-               return false;
+               return false; // probably due to BSP collision
 //     if(draggee.model == "")
 //             return false;
-       if(IS_SPEC(draggee))
-               return false;
-       if(IS_OBSERVER(draggee))
-               return false;
-       if(draggee.classname == "exteriorweaponentity")
-               return false;
-       if(draggee.classname == "weaponentity")
-               return false;
 
        return ((draggee.draggable) ? draggee.draggable(draggee, dragger) : true);
 }
index 22cded8cb986682a23a0a0d8307adf9452e62b3f..962e017a19d6dad9e4919c86d53b20bb92efb84c 100644 (file)
@@ -14,6 +14,8 @@ float CheatFrame(entity this);
 
 const float CHRAME_DRAG = 8;
 
+bool drag_undraggable(entity draggee, entity dragger);
+
 .bool(entity this, entity dragger) draggable;
 void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
 void DragBox_Think(entity this);
index 8f7c52f3263c96e8e150d3c4d7022e0b36743b99..18d3d4ea3b724d8adb9b345e50dc3add4c96a496 100644 (file)
@@ -347,6 +347,7 @@ void PutObserverInServer(entity this)
        this.crouch = false;
        STAT(REVIVE_PROGRESS, this) = 0;
        this.revival_time = 0;
+       this.draggable = drag_undraggable;
 
        this.items = 0;
        STAT(WEAPONS, this) = '0 0 0';
@@ -677,6 +678,8 @@ void PutPlayerInServer(entity this)
        this.event_damage = PlayerDamage;
        this.event_heal = PlayerHeal;
 
+       this.draggable = func_null;
+
        if(!this.bot_attack)
                IL_PUSH(g_bot_targets, this);
        this.bot_attack = true;
index 2017e65a760792fd3d8f0db24603729a139e4cc5..d9155c2237b5b8f2e8d5582c6dc88e7834e906ce 100644 (file)
@@ -178,6 +178,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
        setthink(view, CL_Weaponentity_Think);
        view.nextthink = time;
        view.viewmodelforclient = actor;
+       view.draggable = drag_undraggable;
        setcefc(view, CL_Weaponentity_CustomizeEntityForClient);
 
        wepent_link(view);
@@ -187,6 +188,7 @@ void CL_SpawnWeaponentity(entity actor, .entity weaponentity)
                entity exterior = actor.exteriorweaponentity = new(exteriorweaponentity);
                exterior.solid = SOLID_NOT;
                exterior.owner = actor;
+               exterior.draggable = drag_undraggable;
                exterior.weaponentity_fld = weaponentity;
                setorigin(exterior, '0 0 0');
                setthink(exterior, CL_ExteriorWeaponentity_Think);