def OnCVarChanged(self, name, oldvalue, newvalue): if name == "auf_adrenaline": val = int(newvalue) if val == 0 and self.Adrenaline: self.Adrenaline = False GEUtil.HudMessage(None, "Adrenaline was disabled!", -1, -1, Color(255, 255, 255, 255), 4.0) if not self.WaitingForPlayers and not self.warmupTimer.IsInWarmup( ): if not self.HasEnded: self.HasEnded = True GERules.EndRound() elif val != 0 and not self.Adrenaline: self.Adrenaline = True GEUtil.HudMessage(None, "Adrenaline was enabled!", -1, -1, Color(255, 255, 255, 255), 4.0) if not self.WaitingForPlayers and not self.warmupTimer.IsInWarmup( ): if not self.HasEnded: self.HasEnded = True GERules.EndRound() elif name == "auf_warmuptime": if self.warmupTimer.IsInWarmup(): val = int(newvalue) self.warmupTimer.StartWarmup(val) if val <= 0: if not self.HasEnded: self.HasEnded = True GERules.EndRound(False) elif name == "auf_leveldown": val = int(newvalue) if val >= 1: self.leveldown = True
def lld_declare_baron_data( self ): self.BARON_MACHETE = 'weapon_knife' self.BARON_COSTUME_DEFAULT = "bond" self.BARON_COSTUME_BARON = "samedi" self.BARON_HANDICAP_RATE = 0.5 self.BARON_LEVEL_MAX = 35 self.BARON_PROGRESS_FULL = Color( 180, 225, 255, 170 ) self.BARON_PROGRESS_NORMAL = Color( 240, 200, 120, 170 ) self.BARON_PROGRESS_EXHAUSTED = Color( 240, 120, 120, 170 ) self.BARON_SPAWN_AMMO = 86 self.BARON_SPAWN_ARMOR = int( GEGlobal.GE_MAX_ARMOR * 5 / 8 ) self.BARON_SPAWN_RECOVER = int( GEGlobal.GE_MAX_HEALTH / 4 ) self.BARON_SPAWN_HEALTH = self.BARON_SPAWN_RECOVER self.BARON_WEAPON_LIMIT = 8 self.BARON_VOODOO_BLOODLUST_LEAD = 0 self.BARON_VOODOO_BLOODLUST_LIMB = 1 self.BARON_VOODOO_BLOODLUST_BODY = 2 self.BARON_VOODOO_COST = 7 self.BARON_VOODOO_DEFAULT = self.BARON_VOODOO_COST * 2 + 1 self.BARON_VOODOO_MAX = self.BARON_VOODOO_DEFAULT + self.BARON_VOODOO_COST self.BARON_VOODOO_RECHARGE = 40 self.baron_uid = 0 self.baron_previous_uid = 0 self.baron_level = 0 self.baron_voodoo = 0 self.baron_frags = 0 self.baron_voodoo_recharge = 0 self.baron_health_cache = -1 self.baron_costume_cache = self.BARON_COSTUME_DEFAULT self.baron_costume_cache_skin = 0
def lld_declare_scenario_data( self ): self.AURA_AUG = Color( 244, 192, 11, 64 ) self.RADAR_AUG_ICON = "ge_radar_gg" self.RADAR_BARON_ICON = "sprites/hud/radar/baron" self.RADAR_SCARAMANGA = Color( 232, 180, 2, 255 ) self.TOKEN_AUG_ENTITY = 'weapon_golden_gun' self.RESULT_NONE = 0 self.RESULT_BONDWIN = 1 self.RESULT_BARONWIN = 2 self.CAPTION_EXHAUSTED = "#GES_GP_LALD_NOVOODOO" self.CAPTION_VOODOO = "#GES_GP_LALD_VOODOO" self.CAPTION_REFRACTORY = "#GES_GP_LALD_WAITVOODOO" self.DENOUEMENT_SHORT = 17 self.DENOUEMENT_LONG = self.DENOUEMENT_SHORT * 2 self.GAMESTATE_INACTIVE = 5 self.GAMESTATE_SUSPENDED = 15 self.GAMESTATE_OPEN = 25 self.GAMESTATE_SHUT = 35 self.GAMESTATE_ENDOFROUND = 45 self.PROGRESS_YLOC = .02 self.PROGRESS_YLOC_OBS = .14 self.gamestate = self.GAMESTATE_INACTIVE self.override_disembaron = 0 self.denouement = -1 self.bounty = 0 self.result = self.RESULT_NONE self.hack_voodoodelay = 0 self.aug_holder = None
def OnCaptureAreaSpawned(self, capture): GERules.GetRadar().AddRadarContact(capture, Glb.RADAR_TYPE_OBJECTIVE, True, "sprites/hud/radar/capture_point", Color(255, 255, 255, 255)) if capture.GetGroupName() == "cap2": GERules.GetRadar().SetupObjective(capture, color=Color(0, 255, 0, 120))
def CanMatchEnd(self): if self.EndMatch: GEUtil.HudMessage(None, "Match End Allowed", -1, 0.6, Color(255, 255, 255, 255), 1.0, 1) else: GEUtil.HudMessage(None, "Match End Blocked at %.1f" % GEUtil.GetTime(), -1, 0.6, Color(255, 255, 255, 255), 1.0, 1) return self.EndMatch
def CanRoundEnd(self): if self.EndRound: GEUtil.HudMessage(None, "Round End Allowed", -1, -1, Color(255, 255, 255, 255), 1.0, 0) else: GEUtil.HudMessage(None, "Round End Blocked at %.1f" % GEUtil.GetTime(), -1, -1, Color(255, 255, 255, 255), 1.0, 0) return self.EndRound
def OnTokenDropped(self, token, player): if token.GetClassname() == self.TOKEN2: GEUtil.HudMessage(None, "Custom Token Dropped!", -1, 0.75, Color(255, 255, 255, 255), 1.0, 2) if token.GetClassname() == self.TOKEN1: GERules.GetRadar().AddRadarContact(token, Glb.RADAR_TYPE_TOKEN, True, "", Color(255, 255, 255, 100)) else: GERules.GetRadar().AddRadarContact(token, Glb.RADAR_TYPE_TOKEN, True, "", Color(255, 0, 0, 100))
def OnTokenSpawned(self, token): assert isinstance(token, GEWeapon.CGEWeapon) if token.GetClassname() == self.TOKEN1: GERules.GetRadar().AddRadarContact(token, Glb.RADAR_TYPE_TOKEN, True, "", Color(255, 255, 255, 100)) else: GERules.GetRadar().AddRadarContact(token, Glb.RADAR_TYPE_TOKEN, True, "", Color(255, 0, 0, 100)) GERules.GetRadar().SetupObjective(token, team_filter=Glb.TEAM_NONE, color=Color(255, 0, 0, 120))
def lld_embaron( self, baron ): if baron: # Remove the current baron self.lld_disembaron() # Store our new baron's id self.baron_uid = baron.GetUID() # Setup the baron's costume self.baron_costume_cache = baron.GetPlayerModel() if baron.GetPlayerModel() != self.BARON_COSTUME_BARON else self.BARON_COSTUME_DEFAULT self.baron_costume_cache_skin = baron.GetSkin() baron.SetPlayerModel( self.BARON_COSTUME_BARON, 0 ) # Setup the voodoo bar and radar icons self.lld_baron_update_voodoobar() baron.SetScoreBoardColor( GEGlobal.SB_COLOR_WHITE ) GEMPGameRules.GetRadar().DropRadarContact( baron ) GEMPGameRules.GetRadar().AddRadarContact( baron, GEGlobal.RADAR_TYPE_PLAYER, True, self.RADAR_BARON_ICON ) # Only the GG Holder can see the baron's objective icon GEMPGameRules.GetRadar().SetupObjective( baron, team_filter=GEGlobal.TEAM_NONE, token_filter=self.TOKEN_AUG_ENTITY, color=Color( 255, 255, 255, 100 ), min_dist=300 ) # Give us a ticket for playing self.pltracker[baron][TR_TICKETS] += 1 # Spawn us randomly self.lld_baron_spawn( baron ) # Baron specific help if not self.pltracker.GetValue( baron, "baronhelp" ): self.ShowScenarioHelp( baron, self.HELPID_BARON ) self.pltracker.SetValue( baron, "baronhelp", True )
def OnTokenAttack(self, token, player, start, direction): if token.GetClassname() == self.TOKEN1: return end = GEUtil.VectorMA(start, direction, 500.0) hit = GEUtil.Trace(start, end, TraceOpt.PLAYER, player) if hit is not None: GEUtil.HudMessage(None, "Hit Player!", -1, 0.6, Color(255, 255, 255, 255), 1.0, 1) GERules.GetTokenMgr().TransferToken(token, hit) hit.WeaponSwitch(self.TOKEN2) return hit = GEUtil.Trace(start, end, TraceOpt.CAPAREA, player) if hit is not None: GEUtil.HudMessage(None, "Hit Cap Area!", -1, 0.6, Color(255, 255, 255, 255), 1.0, 1)
def InitProBar(self): # opts = Glb.HUDPB_SHOWVALUE #| Glb.HUDPB_SHOWBAR # h = 15 # w = 200 # x = -1 # y = 0.05 opts = Glb.HUDPB_SHOWVALUE | Glb.HUDPB_VERTICAL | Glb.HUDPB_SHOWBAR h = 80 w = 12 x = 0.9 y = -1 GEUtil.InitHudProgressBar(None, 0, "Tokens:", opts, self.MAX_TOKENS, x, y, w, h, Color(255, 0, 0, 180))
def OnThink(self): # If less than 2 players enter "wait mode" if GERules.GetNumActivePlayers() < 2: if not self.game_inWaitTime: GERules.EndRound() self.game_inWaitTime = True return # If we get here and we are in "wait mode" than we have enough players to play! if self.game_inWaitTime: self.game_inWaitTime = False GEUtil.HudMessage(None, "#GES_GP_GETREADY", -1, -1, Color(255, 255, 255, 255), 2.5) GERules.EndRound(False)
def OnLoadGamePlay(self): tokenmgr = GERules.GetTokenMgr() tokenmgr.SetupToken(self.TOKEN1, location=Glb.SPAWN_TOKEN, limit=self.token_count, glow_color=Color(0, 255, 0, 120), respawn_delay=10) tokenmgr.SetupToken( self.TOKEN2, location=Glb.SPAWN_TOKEN, limit=1, glow_color=Color(0, 0, 255, 120), respawn_delay=10, world_model="models/weapons/goldengun/w_goldengun.mdl", view_model="models/weapons/goldengun/v_goldengun.mdl", print_name="Golden Gun") tokenmgr.SetupCaptureArea("cap1", limit=self.token_count, location=Glb.SPAWN_CAPAREA, rqd_token=self.TOKEN1, spread=1000, glow_color=Color(0, 255, 0, 120)) tokenmgr.SetupCaptureArea("cap2", limit=1, location=Glb.SPAWN_CAPAREA, spread=600, radius=120.) GEUtil.AddDownloadable("models\\weapons\\ammocrate.mdl") self.EndRound = False self.EndMatch = True
def __init__(self): super(AgentUnderFire, self).__init__() #///// Team Variables ///// # Levels self.MI6Level = 0 self.JanusLevel = 0 # Default Costumes self.MI6DefaultCostume = "006_mi6" self.JanusDefaultCostume = "boris" #///// VIP Variables ///// # Costumes self.BondCostume = "bond" self.OurumovCostume = "ourumov" # Costume Caches self.BondCostumeCache = "" self.OurumovCostumeCache = "" # Skin Caches self.BondSkinCache = 0 self.OurumovSkinCache = 0 # Costume Overrides self.BondCostumeOverride = 0 self.OurumovCostumeOverride = 0 # UIDs self.BondUID = 0 self.OurumovUID = 0 # Previous UIDs self.BondPreviousUID = 0 self.OurumovPreviousUID = 0 # Adrenaline Timers self.BondAdrenalineTimer = 100 self.OurumovAdrenalineTimer = 100 # Adrenaline Timer Copies self.BondAdrenalineTimerCopy = self.BondAdrenalineTimer self.OurumovAdrenalineTimerCopy = self.OurumovAdrenalineTimer # Objective Colors self.BondObjective = Color(94, 171, 231, 255) self.OurumovObjective = Color(206, 43, 43, 255) # HUD Colors self.HudShout = Color(240, 200, 120, 170) self.HudAdrenaline = Color(220, 220, 220, 240) #///// Miscellaneous Variables ///// # Warmup self.WaitingForPlayers = True self.notice_WaitingForPlayers = 0 self.warmupTimer = GEWarmUp(self) # End Round self.EndRoundTimer = 0 self.EndRoundTime = 34 self.EndRound = False self.RoundActive = False self.HasEnded = False # Player Tracker self.pltracker = GEPlayerTracker(self) # CVar Holder self.Adrenaline = True self.leveldown = True
def OnThink(self): # Check for insufficient player count if GERules.GetNumActiveTeamPlayers( GEGlobal.TEAM_MI6) < 2 or GERules.GetNumActiveTeamPlayers( GEGlobal.TEAM_JANUS) < 2: if not self.WaitingForPlayers: self.notice_WaitingForPlayers = 0 if not self.HasEnded: self.HasEnded = True GERules.EndRound() elif GEUtil.GetTime() > self.notice_WaitingForPlayers: GEUtil.HudMessage(None, "#GES_GP_WAITING", -1, -1, Color(255, 255, 255, 255), 2.5, 1) self.notice_WaitingForPlayers = GEUtil.GetTime() + 12.5 self.warmupTimer.Reset() self.WaitingForPlayers = True return elif self.WaitingForPlayers: self.WaitingForPlayers = False if not self.warmupTimer.HadWarmup(): self.warmupTimer.StartWarmup( int(GEUtil.GetCVarValue("auf_warmuptime")), True) if self.warmupTimer.IsInWarmup(): GEUtil.EmitGameplayEvent("auf_startwarmup") else: if not self.HasEnded: self.HasEnded = True GERules.EndRound(False) return if self.RoundActive: # Bond Adrenaline if self.BondUID != 0: player = GEPlayer.ToMPPlayer(self.BondUID) if player is not None and self.pltracker.GetValue( player, self.TR_ADRENALINE): self.BondAdrenalineTimer -= 1 GEUtil.UpdateHudProgressBar(player, 0, self.BondAdrenalineTimer) if self.BondAdrenalineTimer == 0: player.SetSpeedMultiplier(1.0) self.pltracker.SetValue(player, self.TR_ADRENALINE, False) # Ourumov Adrenaline if self.OurumovUID != 0: player = GEPlayer.ToMPPlayer(self.OurumovUID) if player is not None and self.pltracker.GetValue( player, self.TR_ADRENALINE): self.OurumovAdrenalineTimer -= 1 GEUtil.UpdateHudProgressBar(player, 1, self.OurumovAdrenalineTimer) if self.OurumovAdrenalineTimer == 0: player.SetSpeedMultiplier(1.0) self.pltracker.SetValue(player, self.TR_ADRENALINE, False) # Check to see if the round is over! if GERules.IsTeamplay() and not self.EndRound: iMI6Players = [] iJanusPlayers = [] for player in GetPlayers(): if self.IsInPlay(player): if player.GetTeamNumber() == GEGlobal.TEAM_MI6: iMI6Players.append(player) elif player.GetTeamNumber() == GEGlobal.TEAM_JANUS: iJanusPlayers.append(player) numMI6Players = len(iMI6Players) numJanusPlayers = len(iJanusPlayers) # The VIPs cannot be chosen if numMI6Players == 0 and numJanusPlayers == 0: GEUtil.HudMessage(None, "Stalemate", -1, -1, self.HudShout, 2.0) self.EndRound = True self.EndRoundTimer = self.EndRoundTime # MI6's VIP cannot be chosen elif numMI6Players == 0 and numJanusPlayers > 0: GEUtil.HudMessage(None, "MI6 concedes.", -1, -1, self.HudShout, 2.0) janus = GERules.GetTeam(GEGlobal.TEAM_JANUS) janus.AddRoundScore(5) GERules.SetTeamWinner(janus) self.EndRound = True self.EndRoundTimer = self.EndRoundTime # Janus' VIP cannot be chosen elif numMI6Players > 0 and numJanusPlayers == 0: GEUtil.HudMessage(None, "Janus concedes.", -1, -1, self.HudShout, 2.0) mi6 = GERules.GetTeam(GEGlobal.TEAM_MI6) mi6.AddRoundScore(5) GERules.SetTeamWinner(mi6) self.EndRound = True self.EndRoundTimer = self.EndRoundTime # End Round Timer if self.EndRoundTimer > 0: self.EndRoundTimer -= 1 if self.EndRoundTimer == 0: if not self.HasEnded: self.HasEnded = True GERules.EndRound()
# # You should have received a copy of the GNU General Public License # along with GoldenEye: Source's Python Library. # If not, see <http://www.gnu.org/licenses/>. ############################################################################# from . import GEScenario from Utils import choice, clamp, plural, GetPlayers from Utils.GEPlayerTracker import GEPlayerTracker from Utils.GETimer import TimerTracker, EndRoundCallback from GEUtil import Color import GEEntity, GEPlayer, GEUtil, GEWeapon, GEMPGameRules, GEGlobal import random USING_API = GEGlobal.API_VERSION_1_1_1 EP_SHOUT_COLOR = Color( 240, 200, 120, 170 ) LLD_DEBUG = False def ep_loadout_slot( index ): weapon = GEMPGameRules.GetWeaponInSlot( index ) if weapon != None: return GEWeapon.WeaponClassname( weapon ).lower() return "weapon_paintbrush" def ep_weapon_by_info( info ): weaponsurrogate = info.GetWeapon() if weaponsurrogate != None: weapon = GEWeapon.ToGEWeapon( weaponsurrogate ) if weapon != None: return weapon.GetClassname().lower() return "weapon_paintbrush"
class MWGG(DeathMatch): gg_glow_color = Color(232, 180, 2, 64) gg_owner_color = Color(232, 180, 2, 255) gg_dropped_color = Color(232, 180, 2, 100) gg_held_color = Color(232, 180, 2, 230) def __init__(self): super(MWGG, self).__init__() self.gg_classname = "weapon_golden_gun" self.gg_owner = None def GetPrintName(self): return "#GES_GP_MWGG_NAME" def GetScenarioHelp(self, help_obj): help_obj.SetDescription("#GES_GP_MWGG_HELP") def GetGameDescription(self): return "MWGG" def GetTeamPlay(self): return GEGlobal.TEAMPLAY_NONE def OnLoadGamePlay(self): super(MWGG, self).OnLoadGamePlay() GEMPGameRules.GetTokenMgr().SetupToken(self.gg_classname, limit=1, respawn_delay=20.0, location=GEGlobal.SPAWN_WEAPON | GEGlobal.SPAWN_SPECIALONLY, glow_color=self.gg_glow_color) GEMPGameRules.GetTokenMgr().SetGlobalAmmo(self.gg_classname, 2) GEMPGameRules.GetRadar().SetForceRadar(True) def OnPlayerSpawn(self, player): player.SetMaxArmor(int(GEGlobal.GE_MAX_ARMOR)) player.SetScoreBoardColor(GEGlobal.SB_COLOR_NORMAL) if player.IsInitialSpawn(): GEUtil.PopupMessage(player, "#GES_GPH_OBJECTIVE", "#GES_GPH_MWGG_GOAL", "mwgg_goal") def OnPlayerKilled(self, victim, killer, weapon): if not victim: return if not killer or victim == killer: # Death by world or suicide if victim == self.gg_owner: GEUtil.EmitGameplayEvent("mwgg_suicide", str(victim.GetUserID())) GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_MWGG_SUICIDE") victim.AddRoundScore(-1) else: # Regular kill if victim == self.gg_owner: GEUtil.EmitGameplayEvent("mwgg_killed", str(victim.GetUserID()), str(killer.GetUserID())) GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_MWGG_KILLED", killer.GetCleanPlayerName()) killer.AddRoundScore(1) def OnThink(self): if self.gg_owner: gg_player = GEEntity.GetEntByUID(self.gg_owner) if gg_player and gg_player.GetArmor() > 0: gg_player.SetMaxArmor(0) def OnTokenSpawned(self, token): GEMPGameRules.GetRadar().AddRadarContact(token, GEGlobal.RADAR_TYPE_TOKEN, True, "ge_radar_gg") GEMPGameRules.GetRadar().SetupObjective(token, GEGlobal.TEAM_NONE, "", "", self.gg_dropped_color) def OnTokenPicked(self, token, player): radar = GEMPGameRules.GetRadar() radar.DropRadarContact(token) radar.AddRadarContact(player, GEGlobal.RADAR_TYPE_PLAYER, True, "", self.gg_owner_color) radar.SetupObjective(player, GEGlobal.TEAM_NONE, "", "", self.gg_held_color) GEUtil.PlaySoundTo(player, "GEGamePlay.Token_Grab") GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_MWGG_PICKED", player.GetCleanPlayerName()) GEUtil.EmitGameplayEvent("mwgg_ggpickup", str(player.GetUserID())) GEUtil.HudMessage(player, "#GES_GP_MWGG_HAVEGG", -1, 0.75, self.gg_owner_color, 3.0) radar.SetPlayerRangeMod(player, 0.5) player.SetScoreBoardColor(GEGlobal.SB_COLOR_GOLD) self.gg_owner = player.GetUID() def OnTokenDropped(self, token, player): radar = GEMPGameRules.GetRadar() radar.DropRadarContact(player) radar.AddRadarContact(token, GEGlobal.RADAR_TYPE_TOKEN, True, "ge_radar_gg") radar.SetupObjective(token, GEGlobal.TEAM_NONE, "", "", self.gg_dropped_color) GEUtil.ClientPrint(None, GEGlobal.HUD_PRINTTALK, "#GES_GP_MWGG_DROPPED", player.GetCleanPlayerName()) player.SetScoreBoardColor(GEGlobal.SB_COLOR_NORMAL) self.gg_owner = None def OnTokenRemoved(self, token): GEMPGameRules.GetRadar().DropRadarContact(token) GEMPGameRules.GetRadar().DropRadarContact(token.GetOwner()) self.gg_owner = None
def OnPlayerSay(self, player, cmd): assert isinstance(player, GEPlayer.CGEMPPlayer) cmd = cmd.lower() origin = player.GetAbsOrigin() origin[2] += 20.0 if cmd == "ring": GEUtil.CreateTempEnt(TE.RING, origin=origin) elif cmd == "beam": origin = player.GetEyePosition() end = GEUtil.VectorMA(origin, player.GetAimDirection(), 300.0) GEUtil.CreateTempEnt(TE.BEAM, origin=origin, end=end) elif cmd == "follow": GEUtil.CreateTempEnt(TE.BEAM_FOLLOW, origin=origin, entity=player, duration=3.0) elif cmd == "dust": GEUtil.CreateTempEnt(TE.DUST, origin=origin, size=50.0, speed=0.2) elif cmd == "smoke": GEUtil.CreateTempEnt(TE.SMOKE, origin=origin, size=50.0, framerate=2) elif cmd == "spark": origin = GEUtil.VectorMA(origin, player.GetAimDirection(), 150.0) GEUtil.CreateTempEnt(TE.SPARK, origin=origin) elif cmd == "trace": origin = player.GetEyePosition() end = GEUtil.VectorMA(origin, player.GetAimDirection(), 300.0) hit = GEUtil.Trace(origin, end, TraceOpt.PLAYER, player) if hit == None: GEUtil.HudMessage(None, "No hit!", -1, -1) else: player = GEPlayer.ToMPPlayer(hit) GEUtil.HudMessage(None, "Hit: " + hit.GetClassname(), -1, -1, hold_time=10.0, color=Color(255, 255, 0, 255)) GEUtil.HudMessage(None, "Player: " + player.GetPlayerName(), y=0.6, x=-1) elif cmd == "obj": self.obj_blink = not self.obj_blink for pl in GetPlayers(): GERules.GetRadar().SetupObjective(pl, 0, "", pl.GetCleanPlayerName(), Color(120, 120, 0, 255), 0, self.obj_blink) elif cmd == "box": GEUtil.PopupMessage( None, "Default Title", "This is a really long message that should not be " "displayed for more than four lines I don't want to " "keep typing but I will god damnit! I really don't " "like typing so I am eventually going to stop doing " "it but not anytime soon baby cakes!") elif cmd == "sound": GEUtil.PlaySoundFrom(player.GetAbsOrigin(), "@custom/nano-blade-loop.wav", 0.27) elif cmd == Glb.SAY_COMMAND1: if not hasattr(self, "blah"): self.blah = 1 else: self.blah += 1 GEUtil.HudMessage(None, "Test: " + str(self.blah), -1, -1, GEUtil.Color(100, 184, 234), 3.0) elif cmd == "sniper": player.StripAllWeapons() player.GiveNamedWeapon("weapon_slappers", 0) player.GiveNamedWeapon("weapon_knife", 0) player.GiveNamedWeapon("weapon_sniper_rifle", 20) player.WeaponSwitch("weapon_sniper_rifle") else: return False return True
def OnPlayerSpawn(self, player): GERules.GetRadar().SetupObjective(player, 0, "", player.GetCleanPlayerName(), Color(120, 120, 0, 255), 0, True)
# You should have received a copy of the GNU General Public License # along with GoldenEye: Source's Python Library. # If not, see <http://www.gnu.org/licenses/>. ############################################################################# from . import GEScenario from .Utils import GetPlayers, _ from .Utils.GEPlayerTracker import GEPlayerTracker from GEUtil import Color import GEUtil, GEMPGameRules as GERules, GEGlobal as Glb, GEWeapon USING_API = Glb.API_VERSION_1_2_0 TR_ELIMINATED = "eliminated" # If we're eliminated and can not join the round. Starts true but is set to false upon successful spawn. Used to track who can spawn. TR_WASINPLAY = "wasinplay" # If we played in this round. Starts false but is set to true for all players in the round when it inits. Used for progress bars. CLR_MI6_BAR = Color( 100, 184, 234, 220 ) CLR_JANUS_BAR = Color( 206, 43, 43, 255 ) CLR_DM_BAR = Color( 170, 170, 170, 220 ) CLR_SHOWDOWN_BAR = Color( 180, 225, 255, 170 ) # For some odd reason, you only live twice... class YOLT( GEScenario ): def __init__( self ): GEScenario.__init__( self ) self.pltracker = GEPlayerTracker( self ) self.game_foes_orig = 0 self.game_MI6_foes_orig = 0 self.game_Janus_foes_orig = 0 self.game_foes = None
def OnPlayerSay(self, player, text): assert isinstance(text, str) assert isinstance(player, GEPlayer.CGEMPPlayer) text = text.lower() if text == Glb.SAY_COMMAND1: player.ForceRespawn() elif text == Glb.SAY_COMMAND2: self.do_token_test = not self.do_token_test if self.do_token_test: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mToken Testing Enabled") else: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mToken Testing Disabled") elif text == "!endround": self.EndRound = not self.EndRound if self.EndRound: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mRound ending enabled") else: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mRound ending disabled") elif text == "!endmatch": self.EndMatch = not self.EndMatch if self.EndMatch: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mMatch ending enabled") else: GEUtil.ClientPrint(None, Glb.HUD_PRINTTALK, "^mMatch ending disabled") elif text == "!doendround": GERules.EndRound(True) elif text == "!doendmatch": GERules.EndMatch() elif text == "!message": GEUtil.PopupMessage(None, "Test Message 1", "This is a test of the popup message system!") GEUtil.PopupMessage(None, "Test Message 2", "This is a test of the popup message system!", "mwgg_goal") GEUtil.PopupMessage(None, "Test Message 3", "#GES_GPH_ELIMINATED") elif text == "!droptoken": weap = player.GetActiveWeapon() if weap and GERules.GetTokenMgr().IsValidToken( weap.GetClassname()): GERules.GetTokenMgr().TransferToken(weap, None) elif text == "!te": GEUtil.CreateTempEnt(TE.RING, origin=player.GetAbsOrigin(), radius_start=110, radius_end=130, width=3, color=Color(255, 0, 0, 120), framerate=10, amplitude=0.2) elif text == "!dump": for plr in GetPlayers(): r = random.random() if r < 0.5: self.pltracker.SetValue(plr, "testing", True) else: self.pltracker.SetValue(plr, "testing", False) self.pltracker.DumpData() elif text == "!msgtest": pos = GEUtil.Vector(player.GetAbsOrigin()) pos[2] += 20 # This purposefully doesn't do anything player.SetAbsOrigin(pos) GEUtil.HudMessage(None, "%s\n^rRight^| Align" % player.GetSteamID(), -0.05, -1, Color(255, 255, 255, 255)) GEUtil.HudMessage(None, "%s\n^cBottom^| Align" % pos, 0.05, -0.05, Color(255, 255, 255, 255)) else: return False return True
def OnTokenPicked(self, token, player): GERules.GetRadar().DropRadarContact(token) if token.GetClassname() == self.TOKEN2: GEUtil.HudMessage(None, "Custom Token Picked!", -1, 0.7, Color(255, 255, 255, 255), 1.0, 3)