コード例 #1
0
 def CalculateCustomDamage(self, victim, info, health, armour):
     assert isinstance(victim, GEPlayer.CGEMPPlayer)
     if victim == None:
         return health, armour
     killer = GEPlayer.ToMPPlayer(info.GetAttacker())
     v_flagindex = self.ft_flagindexbyplayer(victim)
     k_flagindex = self.ft_flagindexbyplayer(killer)
     # ep_shout("[SDCD] %d %d" % (v_flagindex, k_flagindex) )
     if v_flagindex >= 0:
         # Suicide or friendly fire exacerbates but does not trigger escape.
         total_damage = health + armour
         if killer == None or GEEntity.GetUID(victim) == GEEntity.GetUID(
                 killer) or GEMPGameRules.IsTeamplay(
                 ) and victim.GetTeamNumber() == killer.GetTeamNumber():
             self.flaglist[v_flagindex].escape(False, total_damage)
         else:
             self.flaglist[v_flagindex].escape(True, total_damage)
             self.ft_escapebar(self.flaglist[v_flagindex], victim)
     if k_flagindex >= 0:
         # Flag carrier steals a point on successful attack.
         if victim.GetRoundScore() > 0:
             ep_incrementscore(victim, -self.THEFT_DELTA)
             ep_incrementscore(killer, self.THEFT_DELTA)
             GEUtil.PlaySoundTo(killer, "Buttons.beep_ok")
             GEUtil.PlaySoundTo(victim, "Buttons.Token_Knock")
             ep_shout("Point stolen from %s via slap." %
                      victim.GetPlayerName())
             GEUtil.EmitGameplayEvent("ld_flagpoint",
                                      str(killer.GetUserID()),
                                      str(victim.GetUserID()), "flaghit",
                                      "1")
     return health, armour
コード例 #2
0
ファイル: Uplink.py プロジェクト: thelastnoc/GES-Uplink
    def updateUplinkTimer(
        self, timerMax
    ):  # Handles the capture timers, adding time or removing time based on which players are on the Uplink
        if GEMPGameRules.IsTeamplay():
            if self.owner != GEGlobal.TEAM_MI6 and self.numMI6:
                if not self.numJanus:
                    self.timerMI6 += 1 + self.numMI6
                    if self.timerMI6 >= timerMax:
                        self.timerMI6 = 0
                        self.timerJanus = 0
                        self.pointTimer = 0
                        return GEGlobal.TEAM_MI6
                    elif self.timerJanus:
                        self.timerJanus -= 5
                        if self.timerJanus < 0:
                            self.timerJanus = 0

            elif self.owner != GEGlobal.TEAM_JANUS and self.numJanus:
                if not self.numMI6:
                    self.timerJanus += 1 + self.numJanus
                    if self.timerJanus >= timerMax:
                        self.timerMI6 = 0
                        self.timerJanus = 0
                        self.pointTimer = 0
                        return GEGlobal.TEAM_JANUS
                    elif self.timerMI6:
                        self.timerMI6 -= 5
                        if self.timerMI6 < 0:
                            self.timerMI6 = 0

            else:
                self.timerMI6 -= 2
                if self.timerMI6 < 0:
                    self.timerMI6 = 0

                self.timerJanus -= 2
                if self.timerJanus < 0:
                    self.timerJanus = 0

            return False
        else:
            temp_playerUIDlist = []
            for player in self.playerList:
                temp_playerUIDlist += [GEEntity.GetUID(player)]

            for playerUID in list(self.playerTimers):
                if playerUID not in temp_playerUIDlist:
                    self.playerTimers[playerUID] -= 2
                    if self.playerTimers[playerUID] < 0:
                        del self.playerTimers[playerUID]

            if len(self.playerList) == 1:
                self.playerTimers[GEEntity.GetUID(self.playerList[0])] += 2
                if self.playerTimers[GEEntity.GetUID(
                        self.playerList[0])] >= timerMax:
                    return True
            return False
コード例 #3
0
 def ft_associate(self, token, player):
     flagindex = self.ft_flagindexbytoken(token)
     if (flagindex >= 0):
         self.flaglist[flagindex].player_id = GEEntity.GetUID(player)
     else:
         ep_shout(
             "[ft_associate] Token %d does not have associated information."
             % (GEEntity.GetUID(token)))
     return flagindex
コード例 #4
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if victim == None:
            return
        # Disconnecting player_previous to prevent multiple penalties.
        flagindex = self.ft_flagindexbyplayer(victim)
        if flagindex >= 0:
            self.flaglist[flagindex].player_previous = 0
            GEUtil.EmitGameplayEvent("ld_flagdropped", str(victim.GetUserID()),
                                     str(killer.GetUserID()))

        vid = GEEntity.GetUID(victim)
        kid = GEEntity.GetUID(killer)
        ep_shout("[OPK] Victim %d, Killer %d, VFlag Index %d" %
                 (vid, kid, flagindex))
        bounty = min(self.flaglist[flagindex].earnings,
                     self.flaglist[flagindex].LEVEL_LIMIT)

        # Suicide
        if killer == None or killer.GetIndex(
        ) == 0 or vid == kid or GEMPGameRules.IsTeamplay(
        ) and victim.GetTeamNumber() == killer.GetTeamNumber():
            suicide_bounty = -choice(flagindex >= 0, bounty + bounty, 1)
            ep_incrementscore(victim, suicide_bounty)
            if flagindex >= 0:
                GEUtil.EmitGameplayEvent("ld_flagpoint",
                                         str(victim.GetUserID()), "-1",
                                         "suicide", str(suicide_bounty))
            return

        # slap and snatch TODO: Verify
        if weapon != None and weapon.GetClassname(
        ) == "weapon_slappers" and flagindex >= 0:
            delta = choice(flagindex >= 0, bounty, 0)
            if delta > 0:
                ep_incrementscore(victim, -delta)
                GEUtil.HudMessage(
                    victim, _(plural(delta, "#GES_GP_LD_LOSEPOINTS"), delta),
                    -1, -1, EP_SHOUT_COLOR, 2.0)
                ep_incrementscore(killer, delta)
                GEUtil.HudMessage(
                    killer, _(plural(delta, "#GES_GP_LD_STOLEPOINTS"), delta),
                    -1, -1, EP_SHOUT_COLOR, 2.0)
                GEUtil.EmitGameplayEvent("ld_flagpoint",
                                         str(victim.GetUserID()),
                                         str(killer.GetUserID()),
                                         "slapperkill", str(-delta))

        # credit if token will be removed from play. TODO: Verify
        if self.ft_flagdebt() < 0:
            if flagindex >= 0:
                ep_incrementscore(killer, self.flaglist[flagindex].level)
            else:
                ep_shout(
                    "[OPK] No flag index associated with slain carrier whose flag is removed."
                )
コード例 #5
0
ファイル: Uplink.py プロジェクト: ges-gameplays/GES-Uplink
		def addPlayerList(self, player):
			if GEMPGameRules.IsTeamplay():
				self.playerList += [player]
				if player.GetTeamNumber() == GEGlobal.TEAM_JANUS:
					self.numJanus += 1
				elif player.GetTeamNumber() == GEGlobal.TEAM_MI6:
					self.numMI6 += 1
			else:
				self.playerList += [player]
				if not GEEntity.GetUID( player ) in self.playerTimers:
					GEUtil.ClientPrint(GEEntity.GetUID( player ), GEGlobal.HUD_PRINTTALK, str(self.playerTimers))
					self.playerTimers[GEEntity.GetUID( player )] = 0
コード例 #6
0
 def ft_zot_token(self, token):
     j = self.ft_flagindexbytoken(token)
     if j >= 0:
         self.flaglist[j].zot()
     else:
         ep_shout("[Zot Token] Attempted to remove unregistered token %d" %
                  GEEntity.GetUID(token))
コード例 #7
0
ファイル: common.py プロジェクト: thelastnoc/ges-python
    def Start(self, npc, data):
        from Ai import PYBaseNPC, AiSystems

        assert isinstance(npc, PYBaseNPC)

        if data <= 0:
            data = 512

        # grab weapons nearby (this searches for dropped weapons which don't show up in itemTracker by default)
        weaponsNearby = GEEntity.GetEntitiesInBox(
            "weapon_*", npc.GetAbsOrigin(), GEUtil.Vector(-data, -data, -10),
            GEUtil.Vector(data, data, 120))

        # combine that list of weapons with the item tracker's list
        weapons = list(set(GetScenario().itemTracker.weapons + weaponsNearby))

        if len(weapons) > 0:
            bestChoice = None

            # find closest weapon
            for weapon in weapons:
                if npc.GetSystem(AiSystems.WEAPONS).WantsWeapon(
                        weapon, bestChoice):
                    bestChoice = weapon

            if bestChoice != None:
                # target closest weapon
                npc.SetTarget(bestChoice)
                self.Complete(npc)
                return

        # We failed to find anything, fail the task
        npc.TaskFail(GEAiTasks.TaskFail.NO_TARGET)
コード例 #8
0
    def OnTokenPicked(self, token, player):
        ID = str(GEEntity.GetUID(token))
        self.caseDict[ID] = Case(player)
        self.displayHold(player)

        GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Grab", True)
        GEUtil.HudMessage(player, self.pickText, -1, 0.67, self.colorMsg, 2.5,
                          1)

        GEMPGameRules.GetRadar().DropRadarContact(token)
        GEMPGameRules.GetRadar().AddRadarContact(player,
                                                 GEGlobal.RADAR_TYPE_PLAYER,
                                                 True, "sprites/hud/radar/run",
                                                 self.getColor(player))
        GEMPGameRules.GetRadar().SetupObjective(player, GEGlobal.TEAM_NONE,
                                                "!" + self.TokenClass, "",
                                                self.getColor(player), 0,
                                                False)

        player.SetScoreBoardColor(self.scoreboardOwner)

        GEUtil.PostDeathMessage(
            self.getTextColor(player) + player.GetCleanPlayerName() +
            self.grabText)

        GEUtil.EmitGameplayEvent("hb_casepicked", "%i" % player.GetUserID())
コード例 #9
0
 def OnTokenSpawned( self, token ):
     self.ft_registerflag( GEEntity.GetUID( token ) )
     GEMPGameRules.GetRadar().AddRadarContact( token, GEGlobal.RADAR_TYPE_TOKEN, True, "", self.COLOR_COLD )
     GEMPGameRules.GetRadar().SetupObjective( token, GEGlobal.TEAM_NONE, "!%s" % self.TokenClass, "#GES_GP_LD_OBJ_TAKE", GEUtil.CColor( 220, 220, 220, 200 ) )
     token.SetSkin( randint(8, 28) )
     self.ft_teambalancebars()
     self.ft_showteamflags()
コード例 #10
0
ファイル: Uplink.py プロジェクト: thelastnoc/GES-Uplink
 def createObjective(self, area, name, capturing):
     if capturing:
         if GEMPGameRules.IsTeamplay():
             title = str(
                 int((self.areaDictionary[name].timerJanus +
                      self.areaDictionary[name].timerMI6) *
                     (100.0 / self.uplinkTimerMax))) + "%%"
         else:
             if name in self.areaDictionary:
                 tempList = []
                 for player in self.areaDictionary[name].playerList:
                     tempList += [
                         self.areaDictionary[name].playerTimers[
                             GEEntity.GetUID(player)]
                     ]
                 title = str(
                     int(max(tempList) * 100.0 /
                         self.uplinkTimerMax)) + "%%"
     else:
         title = ""
     color = self.getObjColor(self.areaDictionary[name].owner, capturing)
     GEMPGameRules.GetRadar().SetupObjective(area, GEGlobal.TEAM_NONE, "",
                                             title, color,
                                             int(0.6 * self.pointRadius),
                                             capturing)
コード例 #11
0
 def ft_flagindexbyplayerprevious(self, player):
     uid = GEEntity.GetUID(player)
     rtn_j = -1
     for j in range(self.FLAGLIST_LIMIT):
         if (self.flaglist[j].player_previous == uid):
             rtn_j = j
             break
     return rtn_j
コード例 #12
0
 def ft_flagindexbytoken(self, token):
     uid = GEEntity.GetUID(token)
     rtn_j = -1
     for j in range(self.FLAGLIST_LIMIT):
         if (self.flaglist[j].token_id == uid):
             rtn_j = j
             break
     return rtn_j
コード例 #13
0
 def Clear(self, player=None):
     '''Forcibly clear the player list, you will have to manually re-register players!'''
     if not player:
         self._players = {}
     else:
         uid = GEEntity.GetUID(player)
         if uid in self._players:
             self._players[uid] = {}
コード例 #14
0
    def _Drop(self, player):
        if player == None:
            return

        uid = GEEntity.GetUID(player)
        if uid not in self._players:
            return

        del self._players[uid]
コード例 #15
0
    def _Track(self, player):
        if player == None:
            return

        uid = GEEntity.GetUID(player)
        if uid in self._players:
            return

        self._players[uid] = {}
コード例 #16
0
def getPlayerFromUID(uid):
    if not uid:
        return None

    plr = GEEntity.GetEntByUID(uid)
    if plr is not None and isinstance(plr, GEPlayer.CGEMPPlayer):
        return plr
    else:
        return None
コード例 #17
0
	def OnTokenRemoved( self, token ):
		GEMPGameRules.GetRadar().DropRadarContact( token )
		ID = str( GEEntity.GetUID( token ) )
		if ID in self.caseDict:
			if self.caseDict[ ID ].owner:
				self.hideHold( self.caseDict[ ID ].owner )
				GEMPGameRules.GetRadar().DropRadarContact( self.caseDict[ ID ].owner )
				GEMPGameRules.GetRadar().ClearObjective( self.caseDict[ ID ].owner )
				self.caseDict[ ID ].owner.SetScoreBoardColor( self.scoreboardDefault )
			del self.caseDict[ ID ]
コード例 #18
0
    def __getitem__(self, player_or_uid):
        if not player_or_uid:
            return None

        try:
            uid = player_or_uid
            if type(uid) is not int:
                uid = GEEntity.GetUID(uid)
            return self._players[uid]
        except:
            raise KeyError("Invalid player passed to GEPlayerTracker!")
コード例 #19
0
ファイル: Uplink.py プロジェクト: thelastnoc/GES-Uplink
 def updateBar(self, playerList, areaName):
     for player in playerList:
         if GEMPGameRules.IsTeamplay():
             if player.GetTeamNumber() == GEGlobal.TEAM_MI6:
                 num = self.areaDictionary[areaName].timerMI6
             else:
                 num = self.areaDictionary[areaName].timerJanus
             GEUtil.UpdateHudProgressBar(player, self.barIndex, num)
         else:
             tempPlayerTimers = self.areaDictionary[areaName].playerTimers
             num = tempPlayerTimers[GEEntity.GetUID(player)]
             GEUtil.UpdateHudProgressBar(player, self.barIndex, num)
コード例 #20
0
    def lc_OnHackCompleted(self):
        GERules.GetTeam(self.team_hacker).IncrementRoundScore(1)
        GERules.GetRadar().DropRadarContact(GEEntity.GetEntByUID(self.game_lastTerminalUID))

        GEUtil.PlaySoundTo(self.team_hacker, "GEGameplay.Token_Capture_Friend", True)
        GEUtil.PlaySoundTo(self.team_preventor, "GEGamePlay.Token_Capture_Enemy", True)
        GEUtil.HudMessage(None, "The hacker has taken over a terminal!", -1, -1, self.COLOR_NOTICE, 2.0, 2)

        self.game_terminals[self.game_lastTerminalUID]["hacked"] = True
        self.game_lastTerminalUID = self.game_currTerminalUID = None

        self.lc_CheckHackerWin()
コード例 #21
0
ファイル: Bypass.py プロジェクト: darkdiplomat/GES-GameModes
    def CalculateCustomDamage(self, victim, info, health, armour):
        killer = GEPlayer.ToMPPlayer(info.GetAttacker())
        target = GEEntity.GetUniqueId(victim)
        killerid = GEEntity.GetUniqueId(GEPlayer.ToMPPlayer(
            info.GetAttacker()))
        red = victim.GetHealth()
        combo = health + armour

        if info.GetWeapon() is not None:
            attackerwep = (info.GetWeapon()).GetClassname()
        else:
            attackerwep = "explosive"

        if killerid != target and killer is not None:
            damage = self.FindWeaponDamage(combo, attackerwep)
            victim.SetHealth(int(red - damage))

        else:
            return

        armour = 0
        health = 0
        return health, armour
コード例 #22
0
    def CalculateCustomDamage(self, victim, info, health, armor):
        killer = GEPlayer.ToMPPlayer(info.GetAttacker())
        killerid = GEEntity.GetUniqueId(GEPlayer.ToMPPlayer(
            info.GetAttacker()))
        target = GEEntity.GetUniqueId(victim)
        damage = health + armor
        health = 0

        # Full world damage
        if killer is None:
            armor = damage
        elif killerid == target:  # Half self-damage so I can ~rocket jump~
            armor = damage / 2

        # Have to do this here instead of "CanPlayerHaveItem" since if we do it there we don't actually pick the armor up.
        # This method's main purpose is to color the armor bar red, as an indicator to the player they can't pick up any more armor.
        if self.pltracker.GetValue(victim, ARMORKILLS) < self.KillsPerArmor:
            victim.SetMaxArmor(0)

        # We ran out of armor!  Time to die.
        if victim.GetArmor() <= armor:
            health = 160

        return health, armor
コード例 #23
0
	def OnTokenDropped( self, token, player ):
		ID = str( GEEntity.GetUID( token ) )
		self.caseDict[ ID ] = Case( None )
		self.hideHold(player)

		GEMPGameRules.GetRadar().AddRadarContact( token, GEGlobal.RADAR_TYPE_TOKEN, True, "", self.colorCase )
		GEMPGameRules.GetRadar().SetupObjective( token, GEGlobal.TEAM_NONE, "!" + self.TokenClass, self.caseName, self.colorCase )

		GEMPGameRules.GetRadar().DropRadarContact( player )
		GEMPGameRules.GetRadar().ClearObjective( player )

		player.SetScoreBoardColor( self.scoreboardDefault )
		
		GEUtil.PostDeathMessage( self.getTextColor(player) + player.GetCleanPlayerName() + self.dropText )
		
		GEUtil.EmitGameplayEvent( "hb_casedropped", "%i" % player.GetUserID() )
コード例 #24
0
ファイル: common.py プロジェクト: Entropy-Soldier/ges-python
    def Start(self, npc, data):
        from Ai import PYBaseNPC, AiSystems
        from Ai.Utils import Memory

        assert isinstance(npc, PYBaseNPC)

        if data <= 0:
            data = 512

        currWeap = npc.GetActiveWeapon().GetClassname()
        memory = npc.GetSystem(AiSystems.MEMORY)

        # If we have a memory, try to find ammo for our current weapon
        if memory is not None:
            weap_memories = memory.FindMemoriesByType(Memory.TYPE_WEAPON)
            for w in weap_memories:
                assert isinstance(w, Memory.Memory)
                if w.classname == currWeap:
                    ammo_memories = memory.FindMemoriesNear(
                        w.location, Memory.TYPE_AMMO, data)
                    if len(ammo_memories) > 0:
                        npc.SetTargetPos(ammo_memories[0].location)
                        self.Complete(npc)
                        return

        # If we get here we either don't have a memory or didn't remember an ammo box
        my_pos = npc.GetAbsOrigin()
        ammo = GEEntity.GetEntitiesInBox("ge_ammocrate", my_pos,
                                         GEUtil.Vector(-data, -data, 0),
                                         GEUtil.Vector(data, data, 120))

        # Sort by closest ammo
        dist_cmp = lambda x, y: cmp(my_pos.DistTo(x.GetAbsOrigin()),
                                    my_pos.DistTo(y.GetAbsOrigin()))
        ammo.sort(dist_cmp)

        if len(ammo) > 0:
            npc.SetTarget(ammo[0])
            self.Complete(npc)
            return

        # We failed to find anything, fail the task
        npc.TaskFail(GEAiTasks.TaskFail.NO_TARGET)
コード例 #25
0
    def __init__( self ):
        # Properties of the memory
        self.type = TYPE_NONE
        self.classname = ""

        self.hEnt = GEEntity.EntityHandle( None )
        self.location = GEUtil.Vector()
        self.team = GEGlobal.TEAM_NONE
        self.flags = Memory.FL_NONE
        self.data = 0

        # Desirability Inputs
        self.priority = PRIORITY_NONE
        self.time_lastrecord = 0
        self.time_expires = 0

        # Dynamic variables
        self._confidence = 0
        self._distance = 0
コード例 #26
0
ファイル: common.py プロジェクト: Entropy-Soldier/ges-python
    def Start(self, npc, data):
        from Ai import PYBaseNPC, AiSystems
        from Ai.Utils import Memory

        assert isinstance(npc, PYBaseNPC)

        if data <= 0:
            data = 512

        memory = npc.GetSystem(AiSystems.MEMORY)
        my_pos = npc.GetAbsOrigin()

        # If we have a memory, try to find the best weapon we remember
        if memory is not None:
            weap_memories = memory.FindMemoriesByType(Memory.TYPE_WEAPON)
            for m in weap_memories:
                assert isinstance(m, Memory.Memory)
                if self.WantsWeapon(npc, memory=m):
                    # 	print "Going for weapon %s from memory!" % m.classname
                    npc.SetTargetPos(m.location)
                    self.Complete(npc)
                    return

        # If we get here we either don't have a memory or didn't remember any valid weapons
        weaps = GEEntity.GetEntitiesInBox("weapon_*", my_pos,
                                          GEUtil.Vector(-data, -data, -10),
                                          GEUtil.Vector(data, data, 120))

        # Sort by closest ammo
        weight_cmp = lambda x, y: cmp(
            GEWeapon.ToGEWeapon(x).GetWeight(),
            GEWeapon.ToGEWeapon(y).GetWeight())
        weaps.sort(weight_cmp)

        for weap in weaps:
            if self.WantsWeapon(npc, weapon=weap):
                # 	print "Going for weapon %s that I found!" % weap.GetClassname()
                npc.SetTarget(weap)
                self.Complete(npc)
                return

        # We failed to find anything, fail the task
        npc.TaskFail(GEAiTasks.TaskFail.NO_TARGET)
コード例 #27
0
ファイル: common.py プロジェクト: Entropy-Soldier/ges-python
    def Start(self, npc, data):
        from Ai import PYBaseNPC, AiSystems
        from Ai.Utils import Memory

        assert isinstance(npc, PYBaseNPC)

        if data <= 0:
            data = 720

        memory = npc.GetSystem(AiSystems.MEMORY)

        # If we have a memory, try to find the closest armor we remember
        if memory is not None:
            armor_memories = memory.FindMemoriesByType(Memory.TYPE_ARMOR)
            if len(armor_memories) > 0:
                npc.SetTargetPos(armor_memories[0].location)
                self.Complete(npc)
                return

        # If we get here we either don't have a memory or didn't remember an ammo box
        my_pos = npc.GetAbsOrigin()
        armor = GEEntity.GetEntitiesInBox("item_armorvest*", my_pos,
                                          GEUtil.Vector(-data, -data, -10),
                                          GEUtil.Vector(data, data, 120))

        # Sort by closest armor
        dist_cmp = lambda x, y: cmp(my_pos.DistTo(x.GetAbsOrigin()),
                                    my_pos.DistTo(y.GetAbsOrigin()))
        armor.sort(dist_cmp)

        if len(armor) > 0:
            npc.SetTarget(armor[0])
            self.Complete(npc)
            return

        # We failed to find anything, fail the task
        npc.TaskFail(GEAiTasks.TaskFail.NO_TARGET)
コード例 #28
0
ファイル: common.py プロジェクト: Entropy-Soldier/ges-python
    def WantsWeapon(self, npc, weapon=None, memory=None):
        from Ai.Utils import Memory

        assert isinstance(weapon, GEWeapon.CGEWeapon)
        assert isinstance(memory, Memory.Memory)

        weapon = GEWeapon.ToGEWeapon(weapon)
        my_pos = npc.GetAbsOrigin()
        curr_weap = npc.GetActiveWeapon()

        if not curr_weap:
            return True
        elif weapon:
            return not weapon.GetPlayerOwner() and \
                weapon.GetWeight() >= curr_weap.GetWeight() and \
                weapon.GetAbsOrigin().DistTo( my_pos ) < 2048. and \
                npc.GetAmmoCount( weapon.GetAmmoType() ) < weapon.GetMaxAmmoCount()
        elif memory and type(memory.data) is dict:
            try:
                dist = memory.location.DistTo(my_pos)
                # If we are close, see if there is actually a weapon there!
                if dist < 500.:
                    weaps = GEEntity.GetEntitiesInBox(
                        "weapon_*", memory.location,
                        GEUtil.Vector(-64, -64, -10),
                        GEUtil.Vector(64, 64, 32))
                    if len(weaps) == 0:
                        return False
                # Otherwise do a heuristic check
                return memory.data["weight"] >= curr_weap.GetWeight() and \
                    dist < 2048. and \
                    npc.GetAmmoCount( memory.data["ammo_type"] ) < npc.GetMaxAmmoCount( memory.data["ammo_type"] )
            except:
                return False
        else:
            return False
コード例 #29
0
    def RefreshMemory( self, mem, ent ):
        assert isinstance( mem, Memory )
        assert isinstance( ent, GEEntity.CBaseEntity )

        mem.Refresh()

        mem.hEnt = GEEntity.EntityHandle( ent )
        mem.location = ent.GetAbsOrigin()
        mem.team = ent.GetTeamNumber()

        # Set player specific flags
        player = GEPlayer.ToCombatCharacter( ent )
        if player:
            weapon = GEWeapon.ToGEWeapon( player.GetActiveWeapon() )
            if weapon and weapon.GetWeaponId() != GEGlobal.WEAPON_SLAPPERS:
                mem.AddFlag( Memory.FL_ARMED )
            else:
                mem.RemoveFlag( Memory.FL_ARMED )

        # Set objective flag based on radar
        if GERules.GetRadar().IsObjective( ent ):
            mem.AddFlag( Memory.FL_OBJECTIVE )
        else:
            mem.RemoveFlag( Memory.FL_OBJECTIVE )
コード例 #30
0
def ep_player_by_id(uid):
    return GEPlayer.ToMPPlayer(GEEntity.GetEntByUniqueId(uid))