Ejemplo n.º 1
0
///////////////////////////////////////////////////////////////////////
// Debug print, could add a "logging" feature to print to a file
///////////////////////////////////////////////////////////////////////
void debug_printf(char *fmt, ...)
{
	int     i;
	char	bigbuffer[0x10000];
	int		len;
	va_list	argptr;
	edict_t	*cl_ent;
	
	va_start (argptr,fmt);
	len = vsprintf (bigbuffer,fmt,argptr);
	va_end (argptr);

	if (dedicated->value)
		safe_cprintf(NULL, PRINT_MEDIUM, bigbuffer);

	for (i=0 ; i<maxclients->value ; i++)
	{
		cl_ent = g_edicts + 1 + i;
		if (!cl_ent->inuse || cl_ent->ai.is_bot)
			continue;

		safe_cprintf(cl_ent,  PRINT_MEDIUM, bigbuffer);
	}

}
Ejemplo n.º 2
0
Archivo: p_weapon.c Proyecto: ZwS/qudos
/*
================
Use_Weapon

Make the weapon ready if there is ammo
================
*/
void Use_Weapon (edict_t *ent, gitem_t *item)
{
	int			ammo_index;
	gitem_t		*ammo_item;

	// see if we're already using it
	if (item == ent->client->pers.weapon)
		return;

	if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
	{
		ammo_item = FindItem(item->ammo);
		ammo_index = ITEM_INDEX(ammo_item);

		if (!ent->client->pers.inventory[ammo_index])
		{
			safe_cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}

		if (ent->client->pers.inventory[ammo_index] < item->quantity)
		{
			safe_cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
	}

	// change to this weapon when down
	ent->client->newweapon = item;
}
Ejemplo n.º 3
0
/*
=================
SV_AddIP_f
=================
*/
void SVCmd_AddIP_f (void)
{
	int		i;
	
	if (gi.argc() < 3) {
		safe_cprintf(NULL, PRINT_HIGH, "Usage:  addip <ip-mask>\n");
		return;
	}

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].compare == 0xffffffff)
			break;		// free spot
	if (i == numipfilters)
	{
		if (numipfilters == MAX_IPFILTERS)
		{
			safe_cprintf (NULL, PRINT_HIGH, "IP filter list is full\n");
			return;
		}
		numipfilters++;
	}
	
	if (!StringToFilter (gi.argv(2), &ipfilters[i]))
		ipfilters[i].compare = 0xffffffff;
}
Ejemplo n.º 4
0
/*
=================
SV_WriteIP_f
=================
*/
void SVCmd_WriteIP_f (void)
{
	FILE	*f;
	char	name[MAX_OSPATH];
	byte	b[4];
	int		i;
	cvar_t	*game;

	game = gi.cvar("game", "", 0);

	if (!*game->string)
		sprintf (name, "%s/listip.cfg", GAMEVERSION);
	else
		sprintf (name, "%s/listip.cfg", game->string);

	safe_cprintf (NULL, PRINT_HIGH, "Writing %s.\n", name);

	f = fopen (name, "wb");
	if (!f)
	{
		safe_cprintf (NULL, PRINT_HIGH, "Couldn't open %s\n", name);
		return;
	}
	
	fprintf(f, "set filterban %d\n", (int)filterban->value);

	for (i=0 ; i<numipfilters ; i++)
	{
		*(unsigned *)b = ipfilters[i].compare;
		fprintf (f, "sv addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
	}
	
	fclose (f);
}
Ejemplo n.º 5
0
/*
=================
SV_RemoveIP_f
=================
*/
void SVCmd_RemoveIP_f (void)
{
	ipfilter_t	f;
	int			i, j;

	if (gi.argc() < 3) {
		safe_cprintf(NULL, PRINT_HIGH, "Usage:  sv removeip <ip-mask>\n");
		return;
	}

	if (!StringToFilter (gi.argv(2), &f))
		return;

	for (i=0 ; i<numipfilters ; i++)
		if (ipfilters[i].mask == f.mask
		&& ipfilters[i].compare == f.compare)
		{
			for (j=i+1 ; j<numipfilters ; j++)
				ipfilters[j-1] = ipfilters[j];
			numipfilters--;
			safe_cprintf (NULL, PRINT_HIGH, "Removed.\n");
			return;
		}
	safe_cprintf (NULL, PRINT_HIGH, "Didn't find %s.\n", gi.argv(2));
}
Ejemplo n.º 6
0
void my_bprintf (int printlevel, char *fmt, ...)
{
	int i;
	char	bigbuffer[0x10000];
	int		len;
	va_list		argptr;
	edict_t	*cl_ent;

	va_start (argptr,fmt);
//	len = vsprintf (bigbuffer,fmt,argptr);
	len = Q_vsnprintf (bigbuffer, sizeof(bigbuffer), fmt, argptr);
	va_end (argptr);

	if (dedicated->value)
		safe_cprintf(NULL, printlevel, bigbuffer);

	for (i=0 ; i<maxclients->value ; i++)
	{
		cl_ent = g_edicts + 1 + i;
		if (!cl_ent->inuse)
			continue;

		safe_cprintf(cl_ent, printlevel, bigbuffer);
	}
}
Ejemplo n.º 7
0
void BombArea (edict_t *ent, float skill_mult, float cost_mult)
{
	vec3_t	angles, offset;
	vec3_t	forward, right, start, end;
	trace_t	tr;
	edict_t *bomb;
	int		cost=COST_FOR_BOMB*cost_mult;

#ifdef OLD_NOLAG_STYLE
	// 3.5 don't allow bomb area to prevent lag
	if (nolag->value)
	{
		safe_cprintf(ent, PRINT_HIGH, "Bomb area is temporarily disabled to prevent lag.\n");
		return;
	}
#endif

	AngleVectors (ent->client->v_angle, forward, right, NULL);
	VectorSet(offset, 0, 7, ent->viewheight-8);
	P_ProjectSource(ent->client, ent->s.origin, offset, forward, right, start);
	VectorMA(start, 8192, forward, end);
	tr = gi.trace(start, NULL, NULL, end, ent, MASK_SOLID);

	// make sure this is a floor
	vectoangles(tr.plane.normal, angles);
	ValidateAngles(angles);
	if (angles[PITCH] == FLOOR_PITCH)
	{
		VectorCopy(tr.endpos, start);
		VectorCopy(tr.endpos, end);
		end[2] += BOMBAREA_FLOOR_HEIGHT;
		tr = gi.trace(start, NULL, NULL, end, ent, MASK_SOLID);
	}
	else if (angles[PITCH] != CEILING_PITCH)
	{
		safe_cprintf(ent, PRINT_HIGH, "You must look at a ceiling or floor to cast this spell.\n");
		return;
	}

	bomb = G_Spawn();
	bomb->solid = SOLID_NOT;
	bomb->svflags |= SVF_NOCLIENT;
	VectorClear(bomb->velocity);
	VectorClear(bomb->mins);
	VectorClear(bomb->maxs);
	bomb->owner = ent;
	bomb->delay = level.time + BOMBAREA_DURATION + BOMBAREA_STARTUP_DELAY;
	bomb->nextthink = level.time + BOMBAREA_STARTUP_DELAY;
	bomb->dmg = 50 + 10*ent->myskills.abilities[BOMB_SPELL].current_level*skill_mult;
	bomb->think = bombarea_think;
	VectorCopy(tr.endpos, bomb->s.origin);
	VectorCopy(tr.endpos, bomb->s.old_origin);
	VectorCopy(angles, bomb->s.angles);
	gi.linkentity(bomb);

    gi.sound(bomb, CHAN_WEAPON, gi.soundindex("abilities/meteorlaunch_short.wav"), 1, ATTN_NORM, 0);
	ent->client->pers.inventory[power_cube_index] -= cost;

	ent->client->ability_delay = level.time + (DELAY_BOMB * cost_mult);
}
Ejemplo n.º 8
0
Archivo: g_utils.c Proyecto: qbism/tmg
qboolean CheckFlood (edict_t *who)
{
	int	i;
	gclient_t *cl;

		cl = who->client;
		//DB
        if (level.time < cl->flood_locktill)
		{
			safe_cprintf(who, PRINT_HIGH, "You can't talk for %d more seconds\n",
				(int)(cl->flood_locktill - level.time));
            return false;
        }
        i = cl->flood_whenhead - flood_msgs->value + 1;
		if (i < 0)
            i = (sizeof(cl->flood_when)/sizeof(cl->flood_when[0])) + i;
		if (cl->flood_when[i] && level.time - cl->flood_when[i] < flood_persecond->value)
		{
			cl->flood_locktill = level.time + flood_waitdelay->value;
			safe_cprintf(who, PRINT_CHAT, "Flood protection:  You can't talk for %d seconds.\n",(int)flood_waitdelay->value);
            return false;
        }
		cl->flood_whenhead = (cl->flood_whenhead + 1) % (sizeof(cl->flood_when)/sizeof(cl->flood_when[0]));
		cl->flood_when[cl->flood_whenhead] = level.time;
		return true;
}
Ejemplo n.º 9
0
void Cmd_HolyFreeze(edict_t *ent)
{
	qboolean sameaura=false;

	if (debuginfo->value)
		gi.dprintf("DEBUG: %s just called Cmd_HolyFreeze()\n", ent->client->pers.netname);

	if(ent->myskills.abilities[HOLY_FREEZE].disable)
		return;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[HOLY_FREEZE].current_level, 0))
		return;
	// if we already had an aura on, remove it
	if (que_typeexists(ent->auras, AURA_HOLYFREEZE))
	{
		safe_cprintf(ent, PRINT_HIGH, "Holy freeze removed.\n");
		AuraRemove(ent, AURA_HOLYFREEZE);
		return;
	}
	
	ent->client->ability_delay = level.time + DEFAULT_AURA_DELAY;
	// do we have enough power cubes?
	if (ent->client->pers.inventory[power_cube_index] < DEFAULT_AURA_INIT_COST)
	{
		safe_cprintf(ent, PRINT_HIGH, "You need more %d power cubes to use this ability.\n", 
			DEFAULT_AURA_INIT_COST-ent->client->pers.inventory[power_cube_index]);
		return;
	}
	ent->client->pers.inventory[power_cube_index] -= DEFAULT_AURA_INIT_COST;
	gi.sound(ent, CHAN_ITEM, gi.soundindex("auras/holywind.wav"), 1, ATTN_NORM, 0);
	safe_cprintf(ent, PRINT_HIGH, "Now using holy freeze aura.\n");
	aura_holyfreeze(ent);
}
Ejemplo n.º 10
0
void depot_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	if (attacker->client)
		safe_cprintf(self->creator, PRINT_HIGH, "Your supply station was destroyed by %s.\n", attacker->client->pers.netname);
	else
		safe_cprintf(self->creator, PRINT_HIGH, "Your supply station was destroyed.\n");
	depot_remove(self, NULL, true);
}
Ejemplo n.º 11
0
/*
=================
SV_ListIP_f
=================
*/
void SVCmd_ListIP_f (void)
{
	int		i;
	byte	b[4];

	safe_cprintf (NULL, PRINT_HIGH, "Filter list:\n");
	for (i=0 ; i<numipfilters ; i++)
	{
		*(unsigned *)b = ipfilters[i].compare;
		safe_cprintf (NULL, PRINT_HIGH, "%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
	}
}
Ejemplo n.º 12
0
void ShowAllyMenu (edict_t *ent)
{
	int i;
	int j = 0;
	edict_t *temp;

	//Don't bother displaying the menu if alliances are disabled
	if (!allies->value)
	{
		safe_cprintf(ent, PRINT_HIGH, "Alliances are disabled.\n");
		return;
	}

	// alliance only work in pvp mode
	if (!ValidAllyMode())
	{
		safe_cprintf(ent, PRINT_HIGH, "Alliances are disabled.\n");
		return;
	}

	 if (!ShowMenu(ent))
        return;
	clearmenu(ent);

	addlinetomenu(ent, "Currently allied with:", MENU_GREEN_CENTERED);
	addlinetomenu(ent, " ", 0);

	for_each_player(temp, i)
	{
		if (IsAlly(ent, temp))
		{
			//Add player to the list
			addlinetomenu(ent, va(" %s", temp->myskills.player_name), 0);
			++j;
		}
	}

	//Menu footer
	addlinetomenu(ent, " ", 0);
	addlinetomenu(ent, "Add Ally", 1);
	addlinetomenu(ent, "Remove Ally", 2);
	addlinetomenu(ent, "Exit", 666);

	//Set handler
	setmenuhandler(ent, ShowAllyMenu_handler);

	//Set current line
	ent->client->menustorage.currentline = 6 + j;

	//Display the menu
	showmenu(ent);
}
Ejemplo n.º 13
0
void ShowAllyInviteMenu_handler (edict_t *ent, int option)
{
	edict_t *e = ent->client->allytarget;

	if (!e || !e->inuse)
		return;

	// make sure they can still ally
	if (!CanAlly(ent, e, ALLY_RANGE))
		return;

	if (option == 1)
	{
		// notify inviter and his previous allies, if any
		gi.centerprintf(e, "Now allied with %s\n", ent->client->pers.netname);
		NotifyAllies(e, CENTERPRINT, va("Now allied with %s\n", ent->client->pers.netname));

		// notify invitee's allies
		NotifyAllies(ent, CENTERPRINT, va("Now allied with %s\n", e->client->pers.netname));

		// join allies
		AddAlly(ent, e);

		// notify invitee
		safe_cprintf(ent, PRINT_HIGH, "Ally added.\n");

		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);
	}
	else if (option == 2)
	{
		// reset wait menu variables
		AbortAllyWait(ent);
		AbortAllyWait(e);

		// close the invitation menu
		closemenu(ent);

		if (InMenu(e, 0, ShowAllyWaitMenu_handler))
			closemenu(e);

		safe_cprintf(e, PRINT_HIGH, "%s declined your offer to ally.\n", ent->client->pers.netname);
	}
}
Ejemplo n.º 14
0
void Cmd_BuildLaser (edict_t *ent)
{
	int talentLevel, cost=LASER_COST;
	float skill_mult=1.0, cost_mult=1.0, delay_mult=1.0;//Talent: Rapid Assembly & Precision Tuning

	if(ent->myskills.abilities[BUILD_LASER].disable)
		return;

	if (Q_strcasecmp (gi.args(), "remove") == 0)
	{
		RemoveLasers(ent);
		safe_cprintf(ent, PRINT_HIGH, "All lasers removed.\n");
		return;
	}

	// cost is doubled if you are a flyer or cacodemon below skill level 5
	if ((ent->mtype == MORPH_FLYER && ent->myskills.abilities[FLYER].current_level < 5) 
		|| (ent->mtype == MORPH_CACODEMON && ent->myskills.abilities[CACODEMON].current_level < 5))
		cost *= 2;

	//Talent: Rapid Assembly
	talentLevel = getTalentLevel(ent, TALENT_RAPID_ASSEMBLY);
	if (talentLevel > 0)
		delay_mult -= 0.1 * talentLevel;
	//Talent: Precision Tuning
	else if ((talentLevel = getTalentLevel(ent, TALENT_PRECISION_TUNING)) > 0)
	{
		cost_mult += PRECISION_TUNING_COST_FACTOR * talentLevel;
		delay_mult += PRECISION_TUNING_DELAY_FACTOR * talentLevel;
		skill_mult += PRECISION_TUNING_SKILL_FACTOR * talentLevel;
	}
	cost *= cost_mult;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[BUILD_LASER].current_level, cost))
		return;

	if (ent->num_lasers >= MAX_LASERS)
	{
		safe_cprintf(ent, PRINT_HIGH, "Can't build any more lasers.\n");
		return;
	}

	if (ctf->value && (CTF_DistanceFromBase(ent, NULL, CTF_GetEnemyTeam(ent->teamnum)) < CTF_BASE_DEFEND_RANGE))
	{
		safe_cprintf(ent, PRINT_HIGH, "Can't build in enemy base!\n");
		return;
	}

	SpawnLaser(ent, cost, skill_mult, delay_mult);
}
Ejemplo n.º 15
0
void DeleteMenu_handler(edict_t *ent, int option)
{
	if (option - 777 > 0)
	{
		int i;

		//Delete item
		memset(&ent->myskills.items[option - 778], 0, sizeof(item_t));

		//Re-apply equipment
		V_ResetAllStats(ent);
		for (i = 0; i < 3; ++i)
			V_ApplyRune(ent, &ent->myskills.items[i]);

		safe_cprintf(ent, PRINT_HIGH, "Item deleted.\n");
	}
	else if (option - 666 > 0)
	{
		//Back to main
		ShowInventoryMenu(ent, option - 666, false);
		return;
	}
	else
	{
		//Closing menu
		closemenu(ent);
		return;
	}
}
Ejemplo n.º 16
0
void BombPerson (edict_t *target, edict_t *owner, float skill_mult) 
{
	edict_t *bomb;

    gi.sound(target, CHAN_ITEM, gi.soundindex("abilities/meteorlaunch.wav"), 1, ATTN_NORM, 0);
	if ((target->client) && !(target->svflags & SVF_MONSTER))
		safe_cprintf(target, PRINT_HIGH, "SOMEONE SET UP US THE BOMB !!\n");
	//target->cursed |= CURSE_BOMBS;

	bomb=G_Spawn();
	bomb->solid = SOLID_NOT;
	bomb->svflags |= SVF_NOCLIENT;
	VectorClear(bomb->velocity);
	VectorClear(bomb->mins);
	VectorClear(bomb->maxs);
	bomb->owner = owner;
	bomb->enemy = target;
	bomb->delay = level.time + BOMBPERSON_DURATION;
	bomb->dmg = 50 + 10*owner->myskills.abilities[BOMB_SPELL].current_level*skill_mult;
	bomb->mtype = CURSE_BOMBS;
	bomb->nextthink = level.time + 1.0;
	bomb->think = bombperson_think;
	VectorCopy(target->s.origin, bomb->s.origin);
	gi.linkentity(bomb);
	if (!que_addent(target->curses, bomb, BOMBPERSON_DURATION))
		G_FreeEdict(bomb);
}
Ejemplo n.º 17
0
/*
========================
objective_area
========================
*/
void objective_area_think (edict_t *self) {

	edict_t *ent  = NULL;
	int count = 0;
	int newteam = 0;
	int delay;

	self->nextthink = level.time + FRAMETIME;

	if (self->delay) // if there's a counter running
	{
	}

	while ((ent = findradius(ent, self->s.origin, self->obj_area)) != NULL)
	{
		if (!ent->inuse)
			continue;
		if (!IsValidPlayer(ent))
			continue;

		newteam = ent->client->resp.team_on->index;

		if (newteam != self->obj_owner)
			count++;

		//gi.dprintf(DEVELOPER_MSG_GAME, "Found %d players\n", count);		
	}

	if (count >= self->obj_count) {

		team_list[self->obj_owner]->score -= self->obj_loss;

		self->obj_owner = team_list[newteam]->index;
		team_list[self->obj_owner]->score += self->obj_gain;

		if (team_list[self->obj_owner]->time_to_win) // If there already is a counter somwhere else
		{
			if (team_list[self->obj_owner]->time_to_win > (self->obj_time + level.time) )
			// If the counter is longer, shorten it up to this one
				team_list[self->obj_owner]->time_to_win = (self->obj_time + level.time);
		} else // there is no counter
			team_list[self->obj_owner]->time_to_win = (self->obj_time + level.time);

		delay = (int)(team_list[self->obj_owner]->time_to_win - level.time);

		if ((delay/60) >= 1)
			safe_bprintf(PRINT_HIGH, "Team %s has %i minutes before they win the battle.\n", team_list[self->obj_owner]->teamname, (delay/60));
		else
			safe_bprintf(PRINT_HIGH, "Team %s has %i seconds before they win the battle.\n", team_list[self->obj_owner]->teamname, delay);

		gi.sound(self, CHAN_NO_PHS_ADD, gi.soundindex(va("%s/objectives/area_cap.wav", team_list[self->obj_owner]->teamid)), 1, 0, 0);

		if (dedicated->value)
			safe_cprintf(NULL, PRINT_HIGH, "Objective %s taken by team %s!\n",  self->obj_name,  team_list[self->obj_owner]->teamname);

		centerprintall("Objective %s taken\n by team %s!\n", 
			self->obj_name, 
			team_list[self->obj_owner]->teamname);
	}
}
Ejemplo n.º 18
0
void magmine_think(edict_t *self) {
    // check for valid position
    if (gi.pointcontents(self->s.origin) & CONTENTS_SOLID) {
        gi.dprintf("WARNING: A mag mine was removed from map due to invalid position.\n");
        safe_cprintf(self->creator, PRINT_HIGH, "Your mag mine was removed.\n");
        self->creator->magmine = NULL;
        G_FreeEdict(self);
        return;
    }

    if (!self->enemy) {
        if (magmine_findtarget(self)) {
            magmine_attack(self);
            magmine_throwsparks(self);
        }
    } else if (G_ValidTarget(self, self->enemy, true)
               && (entdist(self, self->enemy) <= self->dmg_radius)) {
        magmine_attack(self);
        magmine_throwsparks(self);
    } else {
        self->enemy = NULL;
    }

    //magmine_seteffects(self);
    M_SetEffects(self);//4.5
    self->nextthink = level.time + FRAMETIME;
}
Ejemplo n.º 19
0
void NotifyAllies (edict_t *ent, int msgtype, char *s)
{
	int		i;
	edict_t *cl_ent;

	// no team assigned!
	if (!ent->teamnum)
		return;

	for (i=0 ; i<game.maxclients ; i++)
	{
		cl_ent = g_edicts+1+i;

		if (!cl_ent->inuse)
			continue;
		if (cl_ent->teamnum != ent->teamnum)
			continue;
		if (cl_ent == ent)
			continue;
		if (msgtype)
			gi.centerprintf(cl_ent, "%s", s);
		else
			safe_cprintf(cl_ent, PRINT_HIGH, "%s", s);
	}
}
Ejemplo n.º 20
0
void depot_give_inventory (edict_t *self, edict_t *other)
{
	int result = 0;

	if ((self->sentrydelay > level.time) || !G_EntIsAlive(self) || !G_EntIsAlive(other) || !other->client || OnSameTeam(self, other) < 2)
		return;

	result += depot_give_item(self, other, body_armor_index);
	result += depot_give_item(self, other, bullet_index);
	result += depot_give_item(self, other, cell_index);
	result += depot_give_item(self, other, shell_index);
	result += depot_give_item(self, other, grenade_index);
	result += depot_give_item(self, other, rocket_index);
	result += depot_give_item(self, other, slug_index);

	safe_cprintf(other, PRINT_HIGH, "Depot has %d armor, %d bullets, %d cells, %d shells, %d grenades, %d rockets, %d slugs\n", 
		self->packitems[body_armor_index], self->packitems[bullet_index], self->packitems[cell_index], 
		self->packitems[shell_index], self->packitems[grenade_index], self->packitems[rocket_index], 
		self->packitems[slug_index]);

	// delay before depot can be used again
	self->sentrydelay = level.time + 2.0;

	if (result > 0)
		gi.sound(self, CHAN_ITEM, gi.soundindex("misc/w_pkup.wav"), 1, ATTN_STATIC, 0);
}
Ejemplo n.º 21
0
void Cmd_SpawnMagmine_f (edict_t *ent)
{
	int talentLevel,cost=MAGMINE_COST;
	float skill_mult=1.0, cost_mult=1.0, delay_mult=1.0;//Talent: Rapid Assembly & Precision Tuning
	char *opt = gi.argv(1);

	if (ent->myskills.abilities[MAGMINE].disable)
		return;

	//Talent: Rapid Assembly
	talentLevel = getTalentLevel(ent, TALENT_RAPID_ASSEMBLY);
	if (talentLevel > 0)
		delay_mult -= 0.1 * talentLevel;
	//Talent: Precision Tuning
	else if ((talentLevel = getTalentLevel(ent, TALENT_PRECISION_TUNING)) > 0)
	{
		cost_mult += PRECISION_TUNING_COST_FACTOR * talentLevel;
		delay_mult += PRECISION_TUNING_DELAY_FACTOR * talentLevel;
		skill_mult += PRECISION_TUNING_SKILL_FACTOR * talentLevel;
	}
	cost *= cost_mult;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[MAGMINE].current_level, cost))
		return;

	if (!strcmp(opt, "self"))
	{
		if (getTalentLevel(ent, TALENT_MAGMINESELF))
		{
			ent->automag = !ent->automag;
			safe_cprintf(ent, PRINT_HIGH, "Auto Magmine %s\n", ent->automag? "enabled" : "disabled");
		}else
			safe_cprintf(ent, PRINT_HIGH, "You haven't upgraded this talent.\n");

		return;
	}

	if (ent->magmine && ent->magmine->inuse)
	{
		safe_cprintf(ent, PRINT_HIGH, "Removed mag mine.\n");
		BecomeExplosion1(ent->magmine);
		ent->magmine = NULL;
		return;
	}

	magmine_spawn(ent, cost, skill_mult, delay_mult);
}
Ejemplo n.º 22
0
void Cmd_ComputeNodes_f (edict_t *ent)
{
	if (!ent->myskills.administrator)
		return;

	CreateGrid(true);
	safe_cprintf(ent, PRINT_HIGH, "Computing nodes...\n");
}
Ejemplo n.º 23
0
void Cmd_LoadNodes_f (edict_t *ent)
{
	if (!ent->myskills.administrator)
		return;

	LoadGrid();

	safe_cprintf(ent, PRINT_HIGH, "Loading nodes...\n", numnodes);
}
Ejemplo n.º 24
0
void Cmd_CreateSupplyStation_f (edict_t *ent)
{
	edict_t *depot;
	vec3_t	start;

	int talentLevel, cost=STATION_COST;
	float skill_mult=1.0, cost_mult=1.0, delay_mult=1.0;//Talent: Rapid Assembly & Precision Tuning

	if (debuginfo->value)
		gi.dprintf("%s just called Cmd_CreateSupplyStation_f\n", ent->client->pers.netname);

	if (ent->supplystation)
	{
		depot_remove(ent->supplystation, ent, true);
		return;
	}

	if(ent->myskills.abilities[SUPPLY_STATION].disable)
		return;

	//Talent: Rapid Assembly
    talentLevel = vrx_get_talent_level(ent, TALENT_RAPID_ASSEMBLY);
	if (talentLevel > 0)
		delay_mult -= 0.1 * talentLevel;
	//Talent: Precision Tuning
    else if ((talentLevel = vrx_get_talent_level(ent, TALENT_PRECISION_TUNING)) > 0)
	{
		cost_mult += PRECISION_TUNING_COST_FACTOR * talentLevel;
		delay_mult += PRECISION_TUNING_DELAY_FACTOR * talentLevel;
		skill_mult += PRECISION_TUNING_SKILL_FACTOR * talentLevel;
	}
	cost *= cost_mult;

	if (!G_CanUseAbilities(ent, ent->myskills.abilities[SUPPLY_STATION].current_level, cost))
		return;
	//BuildSupplyStation(ent, cost, skill_mult, delay_mult);

	depot = BuildDepot(ent, skill_mult, delay_mult);
	if (!G_GetSpawnLocation(ent, 100, depot->mins, depot->maxs, start))
	{
		safe_cprintf(ent, PRINT_HIGH, "Not enough room to spawn supply station.\n");
		ent->supplystation = NULL;
		G_FreeEdict(depot);
		return;
	}

	VectorCopy(start, depot->s.origin);
	VectorCopy(ent->s.angles, depot->s.angles);
	depot->s.angles[PITCH] = 0;
	depot->s.angles[ROLL] = 0;
	gi.linkentity(depot);

	ent->client->ability_delay = level.time + DEPOT_DELAY * delay_mult;
	ent->client->pers.inventory[power_cube_index] -= cost;
	ent->holdtime = level.time + DEPOT_BUILD_TIME * delay_mult;
	gi.sound(depot, CHAN_ITEM, gi.soundindex("weapons/repair.wav"), 1, ATTN_NORM, 0);
}
Ejemplo n.º 25
0
void supplystation_explode (edict_t *self, char *message)
{
	if (self->creator && self->creator->inuse)
	{
		safe_cprintf(self->creator, PRINT_HIGH, message);
		self->creator->supplystation = NULL;
		T_RadiusDamage(self, self->creator, 150, self, 150, MOD_SUPPLYSTATION);
	}
	BecomeExplosion1(self);
}
Ejemplo n.º 26
0
void wall_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	if (self->deadflag == DEAD_DEAD)
		return;
	if (G_EntExists(self->activator))
		safe_cprintf(self->activator, PRINT_HIGH, "Your wall was destroyed.\n");
	self->deadflag = DEAD_DEAD;
	self->think = G_FreeEdict;
	self->nextthink = level.time + FRAMETIME;
}
Ejemplo n.º 27
0
void Cmd_DeleteAllNodes_f (edict_t *ent)
{
	if (!ent->myskills.administrator)
		return;

	memset(&pathnode, 0, numnodes*sizeof(vec3_t));
	numnodes = 0;

	safe_cprintf(ent, PRINT_HIGH, "All nodes deleted.\n");
}
Ejemplo n.º 28
0
void minisentry_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	//FIXME: it is unsafe to remove an entity immediately!
	//gi.dprintf("minisentry_die()\n");

	if (self->creator && self->creator->inuse)
		safe_cprintf(self->creator, PRINT_HIGH, "Your mini-sentry was destroyed.\n");

	minisentry_remove(self);
}
Ejemplo n.º 29
0
void totem_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
	//If a totem is destroyed, the caster should not be able to make another one for a few seconds.
	if(self->activator && self->activator->client)
	{
		//self->activator->client->ability_delay = level.time + 2.5;
		safe_cprintf(self->activator, PRINT_HIGH, "*** Your totem was destroyed ***\n");
	}

	RemoveTotem(self);
}
Ejemplo n.º 30
0
void BuildSupplyStation (edict_t *ent, int cost, float skill_mult, float delay_mult)
{
	vec3_t	angles, forward, end;
	edict_t *station;
	trace_t	tr;

	station = G_Spawn();
	station->creator = ent;
	station->think = supplystation_think;
	station->nextthink = level.time + STATION_BUILD_TIME * delay_mult;
	station->s.modelindex = gi.modelindex ("models/objects/dmspot/tris.md2");
	station->s.effects |= EF_PLASMA;
	station->s.renderfx |= RF_IR_VISIBLE;
	station->solid = SOLID_BBOX;
	station->movetype = MOVETYPE_TOSS;
	station->clipmask = MASK_MONSTERSOLID;
	station->mass = 500;
	station->mtype = SUPPLY_STATION;
	station->classname = "supplystation";
	station->takedamage = DAMAGE_YES;
	station->health = 1000;
	station->monsterinfo.level = ent->myskills.abilities[SUPPLY_STATION].current_level * skill_mult;
	station->touch = V_Touch;
	station->die = supplystation_die;
	VectorSet(station->mins, -32, -32, -24);
	VectorSet(station->maxs, 32, 32, -16);
	station->s.skinnum = 1;
	// starting position for station
	AngleVectors (ent->client->v_angle, forward, NULL, NULL);
	VectorMA(ent->s.origin, 128, forward, end);
	tr = gi.trace(ent->s.origin, NULL, NULL, end, ent, MASK_SOLID);
	VectorCopy(tr.endpos, end);
	vectoangles(tr.plane.normal, angles);
	ValidateAngles(angles);
	// player is aiming at the ground
	if ((tr.fraction != 1.0) && (tr.endpos[2] < ent->s.origin[2]) && (angles[PITCH] == 270))
		end[2] += abs(station->mins[2])+1;
	// make sure station doesn't spawn in a solid
	tr = gi.trace(end, station->mins, station->maxs, end, NULL, MASK_SHOT);
	if (tr.contents & MASK_SHOT)
	{
		safe_cprintf (ent, PRINT_HIGH, "Can't build supply station there.\n");
		G_FreeEdict(station);
		return;
	}
	VectorCopy(tr.endpos, station->s.origin);
	gi.linkentity(station);

	ent->supplystation = station;
	ent->client->ability_delay = level.time + STATION_DELAY * delay_mult;
	ent->client->pers.inventory[power_cube_index] -= cost;
	ent->holdtime = level.time + STATION_BUILD_TIME * delay_mult;
	gi.sound(station, CHAN_ITEM, gi.soundindex("weapons/repair.wav"), 1, ATTN_NORM, 0);
}