static mobj_t *minus;
static boolean PIT_MinusCarry(mobj_t *thing)
{
	if (minus->tracer)
		return true;
	if (minus->type == thing->type)
		return true;
	if (!(thing->flags & (MF_PUSHABLE|MF_ENEMY)))
		return true;
	if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3)
		return true;
	if (abs(thing->z - minus->z) > minus->height)
		return true;
	P_SetTarget(&minus->tracer, thing);
	return true;
}
// Function: A_MinusDigging
//
// Description: Minus digging in the ground.
//
// var1 = If 1, play digging sound.
// var2 = unused
//
void A_MinusDigging(mobj_t *actor)
{
	INT32 locvar1 = var1;
	INT32 rad = 32;
	angle_t fa = (actor->angle >> ANGLETOFINESHIFT) & FINEMASK;
	fixed_t dis = actor->info->speed*4;
	fixed_t x = FINECOSINE(fa)*dis + actor->x + FRACUNIT*P_RandomRange(-rad, rad);
	fixed_t y = FINESINE(fa)*dis + actor->y + FRACUNIT*P_RandomRange(-rad, rad);
	fixed_t mz = (actor->eflags & MFE_VERTICALFLIP) ? actor->ceilingz : actor->floorz;
	mobj_t *par;
#ifdef HAVE_BLUA
	if (LUA_CallAction("A_MinusDigging", actor))
		return;
#endif
	if (!actor->target)
	{
		P_SetMobjState(actor, actor->info->spawnstate);
		return;
	}
	par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT);
	if (actor->eflags & MFE_VERTICALFLIP)
		par->eflags |= MFE_VERTICALFLIP;
	P_TryMove(par, x, y, false);
	// If close enough, prepare to attack
	if (P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) < actor->radius*2)
	{
		P_SetMobjState(actor, actor->info->meleestate);
		P_TryMove(actor, actor->target->x, actor->target->y, false);
		S_StartSound(actor, actor->info->attacksound);
		// Spawn growing dirt pile.
		par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT);
		P_SetMobjState(par, actor->info->raisestate);
		P_SetScale(par, actor->scale*2);
		if (actor->eflags & MFE_VERTICALFLIP)
			par->eflags |= MFE_VERTICALFLIP;
		return;
	}
	// Play digging sound
	if (locvar1 == 1)
		A_PlayActiveSound(actor);
	// Move
	var1 = 3;
	A_Chase(actor);
	// Carry over shit, maybe
	if (P_MobjWasRemoved(actor->tracer) || !actor->tracer->health)
		P_SetTarget(&actor->tracer, NULL);
	if (!actor->tracer)
	{
		fixed_t radius = 3*actor->radius;
		fixed_t yh = (unsigned)(actor->y + radius - bmaporgy) >> MAPBLOCKSHIFT;
		fixed_t yl = (unsigned)(actor->y - radius - bmaporgy) >> MAPBLOCKSHIFT;
		fixed_t xh = (unsigned)(actor->x + radius - bmaporgx) >> MAPBLOCKSHIFT;
		fixed_t xl = (unsigned)(actor->x - radius - bmaporgx) >> MAPBLOCKSHIFT;
		fixed_t bx, by;
		BMBOUNDFIX(xl, xh, yl, yh);
		minus = actor;
		for (bx = xl; bx <= xh; bx++)
			for (by = yl; by <= yh; by++)
				P_BlockThingsIterator(bx, by, PIT_MinusCarry);
	}
	else
	{
		if (P_TryMove(actor->tracer, actor->x, actor->y, false))
			actor->tracer->z = mz;
		else
			P_SetTarget(&actor->tracer, NULL);
	}
}