Exemplo n.º 1
0
void wormhole_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	if (!other || !other->inuse)
		return;

	// point to monster's pilot
	if (PM_MonsterHasPilot(other))
		other = other->activator;

	if ((other == self->creator) || IsAlly(self->creator, other))
	{
		float time;
		
		// can't enter wormhole with the flag
		if (HasFlag(other))
			return;
		
		// can't enter wormhole while being hurt
		if (other->lasthurt + DAMAGE_ESCAPE_DELAY > level.time)
			return;
		
		// can't enter wormhole while cursed (this includes healing, bless)
		if (que_typeexists(other->curses, -1))
			return;

		// can't stay in wormhole long if we're warring
		if (SPREE_WAR == true && SPREE_DUDE == other)
			time = 10.0;
		else
			time = BLACKHOLE_EXIT_TIME;

		// reset railgun sniper frames
		other->client->refire_frames = 0;

		VortexRemovePlayerSummonables(other);
		V_RestoreMorphed(other, 50); // un-morph

		other->flags |= FL_WORMHOLE;
		other->movetype = MOVETYPE_NOCLIP;
		other->svflags |= SVF_NOCLIENT;
		other->client->wormhole_time = level.time + BLACKHOLE_EXIT_TIME; // must exit wormhole by this time

		self->nextthink = level.time + FRAMETIME; // close immediately
	}
}
Exemplo n.º 2
0
qboolean dom_pickupflag (edict_t *ent, edict_t *other)
{
	int		i;
	edict_t *cl_ent;

	//if (!G_EntExists(other))
	//	return false;
	if (!other || !other->inuse || !other->client || G_IsSpectator(other))
		return false;

	//if ((other->myskills.class_num == CLASS_POLTERGEIST) || other->mtype)
	//	return false; // poltergeist and morphed players can't pick up flag

	// unmorph morphed players
	if (other->mtype)
	{
		other->mtype = 0;
		other->s.modelindex = 255;
		other->s.skinnum = ent-g_edicts-1;
		ShowGun(other);
	}
	
	// if this is a player-monster, remove the monster and restore the player
	if (PM_PlayerHasMonster(other))
		PM_RemoveMonster(other);

	// disable movement abilities
	if (other->client)
	{
		//jetpack
		other->client->thrusting = 0;
		//grapple hook
		other->client->hook_state = HOOK_READY;
	}
	// super speed
	other->superspeed = false;
	// antigrav
	other->antigrav = false;

	VortexRemovePlayerSummonables(other);

	// disable scanner
	if (other->client->pers.scanner_active & 1)
		other->client->pers.scanner_active = 0;

	// reset their velocity
	VectorClear(other->velocity);

	// alert everyone
	gi.bprintf(PRINT_HIGH, "%s got the flag!\n", other->client->pers.netname);
	gi.bprintf(PRINT_HIGH, "The %s team is now in control.\n", TeamName(other));

	// alert teammates
	for (i=0 ; i<game.maxclients ; i++) {
		cl_ent = g_edicts+1+i;
		if (G_EntExists(cl_ent) && (cl_ent->teamnum == other->teamnum) && (cl_ent != other))
			gi.centerprintf(cl_ent, "Protect the flag carrier!\n");
	}

	DEFENSE_TEAM = other->teamnum;

	// if a new team takes control of the flag, then reset the counter
	if (PREV_DEFENSE_TEAM != DEFENSE_TEAM)
		FLAG_FRAMES = 0;

	PREV_DEFENSE_TEAM = DEFENSE_TEAM;

	gi.sound(other, CHAN_ITEM, gi.soundindex("world/xianbeats.wav"), 1, ATTN_NORM, 0);
	other->client->pers.inventory[ITEM_INDEX(ent->item)] = 1;
	return true;
}