Quake Style - Quake 3
Tutorials Weapon Mods - Quake3 Translocater! Turns the grenade launcher into a Translocater beacon launcher! |
client->ps.ammo[WP_GRAPPLING_HOOK] = -1;
//SanDan: Add WP_GRENADE_LAUNCHER client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GRENADE_LAUNCHER ); //SanDan: give player one Transporter Beacon aka Grenade :) client->ps.ammo[WP_GRENADE_LAUNCHER] = 1;
/* SanDan: ================ G_FetchBeakin Brings beacon back to Grenade launcher. ================ */ void G_FetchBeakin( gentity_t *ent ) { ent->parent->client->ps.ammo[WP_GRENADE_LAUNCHER] = 1; //SanDan show a message to the client //saying that his beacon returned! trap_SendServerCommand( ent->parent->client->ps.clientNum, "cp \"CLANCK...!\n\""); ent->freeAfterEvent = qtrue; trap_LinkEntity( ent ); }
bolt->nextthink = level.time + 2500; bolt->think = G_ExplodeMissile; /* SanDan: give defense players in CTF a fighting chance! if they can stall attakers from geting there flag for enough time they will avoid instant flag captures! */ bolt->nextthink = level.time + 50000; bolt->think = G_FetchBeakin;
//SanDan Don't Explode on impact with others if ( ent->s.eFlags & ( EF_BOUNCE | EF_BOUNCE_HALF ) ) { G_BounceMissile( ent, trace ); G_AddEvent( ent, EV_GRENADE_BOUNCE, 0 ); return; }
//SanDan: don't add more ammo to our Translocater if (weapon == WP_GRENADE_LAUNCHER) return;
//SanDan: retrieve beacon if thrown if (!self->client->ps.ammo[WP_GRENADE_LAUNCHER]) { Cmd_RetreavBeakin_f(self); }
void G_FetchBeakin( gentity_t *ent );
/*SanDan: modified from Gerbil!'s pipebomb tut ================= Cmd_GetBeacon_f Returns Beacon to player ================= */ void Cmd_GetBeacon_f( gentity_t *ent) { gentity_t *grenades = NULL; while ((grenades = G_Find (grenades, FOFS(classname), "grenade")) != NULL) //search for grenade entities { if (grenades->r.ownerNum == ent->s.clientNum) //make sure its our grenade { grenades->think = G_FetchBeakin; grenades->nextthink = level.time + 2; } } /* even if we don't find any give player a grenade this is just incase any grenades have fallen off the map */ ent->client->ps.ammo[WP_GRENADE_LAUNCHER] = 1; }
/*SanDan: modifid from Gerbil!'s pipebombs tut ================= Cmd_teleport_f Teleports player to beacon ================= */ void Cmd_teleport_f( gentity_t *ent) { gentity_t *grenades = NULL; vec3_t origin,angles; while ((grenades = G_Find (grenades, FOFS(classname), "grenade")) != NULL) //search for grenade entities { if (grenades->r.ownerNum == ent->s.clientNum) //make sure its our grenade { //SanDan: Get Grenade Postion BG_EvaluateTrajectory( &grenades->s.pos, level.time, origin ); //SanDan: give teleporting kick! origin[2] += 9; //SanDan: teleport, and hold on to player viewangle TeleportPlayer( ent, origin, ent->client->ps.viewangles ); //SanDan: return beakin to player grenades->think = G_FetchBeakin; grenades->nextthink = level.time + 2; } } }
else if (Q_stricmp (cmd, "setviewpos") == 0) Cmd_SetViewpos_f( ent ); else if (Q_stricmp (cmd, "getbeacon") == 0) Cmd_GetBeacon_f(ent); else if (Q_stricmp (cmd, "teleport") == 0) Cmd_teleport_f(ent);