コード例 #1
0
ファイル: Uplink.py プロジェクト: ges-gameplays/GES-Uplink
	def updateRings( self ):	# Draws the colored rings around Uplinks
		if self.pingTimer > self.pingTimerMax:
			ping = True; self.pingTimer = 0
		else:
			ping = False; self.pingTimer += 1
		
		for item in list(self.areaDictionary):
			area = self.areaDictionary[item].location
			area = GEUtil.Vector( area[0], area[1], area[2] + 3.0 )
			RingColor = self.getColor( self.areaDictionary[item].owner )
				
			GEUtil.CreateTempEnt( 0, origin = area, radius_start = self.pointRadius, radius_end = self.pointRadius + 0.1, framerate = 30, duration = 0.6, width = 3.0, amplitude = 0, color = RingColor, speed = 0 )
	
			if ping:	# Draws the "ping" effect around Uplinks
				PingColor = self.getColorPing(self.areaDictionary[item].owner)
				GEUtil.CreateTempEnt( 0, origin = area, framerate = 30, duration = 2, speed = 10, width=0.66, amplitude=0.00, radius_start=0, radius_end=self.pointRadius,  color=PingColor )
コード例 #2
0
ファイル: Uplink.py プロジェクト: thelastnoc/GES-Uplink
    def uplinkCaptured(self, areaName, areaID, newOwner):
        if GEMPGameRules.IsTeamplay():
            oldOwner = self.areaDictionary[areaName].owner
            self.areaDictionary[areaName].owner = newOwner
            self.areaDictionary[areaName].inProgress = False
            GEMPGameRules.GetRadar().AddRadarContact(
                areaID, GEGlobal.RADAR_TYPE_OBJECTIVE, True,
                "sprites/hud/radar/capture_point", self.getColor(newOwner))
            self.createObjective(areaID, areaName, False)
            ringLocation = GEUtil.Vector(
                self.areaDictionary[areaName].location[0],
                self.areaDictionary[areaName].location[1],
                self.areaDictionary[areaName].location[2] + 3.0)
            GEUtil.CreateTempEnt(0,
                                 origin=ringLocation,
                                 framerate=30,
                                 duration=0.6,
                                 speed=1,
                                 width=20,
                                 amplitude=5,
                                 radius_start=0,
                                 radius_end=self.pointRadius,
                                 color=self.getColor(newOwner))
            if newOwner == GEGlobal.TEAM_JANUS:
                GEUtil.PlaySoundToTeam(newOwner, "GEGamePlay.Token_Grab", True)
                GEUtil.PlaySoundToTeam(GEGlobal.TEAM_MI6,
                                       "GEGamePlay.Token_Drop_Enemy", True)
                self.createCaptureZone(areaName, self.skinJanus,
                                       GEGlobal.TEAM_JANUS)
                GEUtil.EmitGameplayEvent("up_capture_team",
                                         "%i" % GEGlobal.TEAM_JANUS)
            elif newOwner == GEGlobal.TEAM_MI6:
                GEUtil.PlaySoundToTeam(newOwner, "GEGamePlay.Token_Grab", True)
                GEUtil.PlaySoundToTeam(GEGlobal.TEAM_JANUS,
                                       "GEGamePlay.Token_Drop_Enemy", True)
                self.createCaptureZone(areaName, self.skinMI6,
                                       GEGlobal.TEAM_MI6)
                GEUtil.EmitGameplayEvent("up_capture_team",
                                         "%i" % GEGlobal.TEAM_MI6)
            GEMPGameRules.GetTeam(newOwner).AddRoundScore(1)
            nameList = []
            for player in self.areaDictionary[areaName].playerList:
                self.clearBars(player)
                self.showMsg(player, self.completeMsg)
                player.AddRoundScore(self.uplinkReward)
                GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Chime",
                                         False)
                nameList += [player.GetCleanPlayerName()]
                if oldOwner == GEGlobal.TEAM_NONE:
                    GEUtil.EmitGameplayEvent("up_capture_neutral",
                                             "%i" % player.GetUserID())
                else:
                    GEUtil.EmitGameplayEvent("up_capture_steal",
                                             "%i" % player.GetUserID())
            self.printCapture(nameList, newOwner)

        else:
            ringLocation = GEUtil.Vector(
                self.areaDictionary[areaName].location[0],
                self.areaDictionary[areaName].location[1],
                self.areaDictionary[areaName].location[2] + 3.0)
            GEUtil.CreateTempEnt(0,
                                 origin=ringLocation,
                                 framerate=30,
                                 duration=0.6,
                                 speed=1,
                                 width=20,
                                 amplitude=5,
                                 radius_start=0,
                                 radius_end=self.pointRadius,
                                 color=self.colorNeutral)
            for player in self.areaDictionary[areaName].playerList:
                self.clearBars(player)
                player.SetScoreBoardColor(self.scoreboardDefault)
                player.AddRoundScore(self.uplinkRewardSoloPoints)
                GEUtil.PlaySoundToPlayer(player, "GEGamePlay.Token_Chime",
                                         False)
                GEUtil.EmitGameplayEvent("up_capture_solo",
                                         "%i" % player.GetUserID())
                self.printCapture([player.GetCleanPlayerName()], player)

                rewardHP = self.uplinkRewardSoloHP

                newHealth = float(player.GetHealth()) / float(
                    player.GetMaxHealth()) + rewardHP
                if newHealth > 1.0:
                    player.SetHealth(player.GetMaxHealth())
                    newArmor = newHealth - 1.0 + float(
                        player.GetArmor()) / float(player.GetMaxArmor())
                    if newArmor > 1.0:
                        newArmor = 1.0
                    player.SetArmor(int(newArmor * player.GetMaxArmor()))
                else:
                    player.SetHealth(int(newHealth * player.GetMaxHealth()))

            GEMPGameRules.GetTokenMgr().RemoveCaptureArea(areaName)

            self.updateAreaTotal()
            if len(self.areaDictionary.keys()) < self.areaTotal:
                self.createCaptureZone(areaName, self.skinNeutral,
                                       GEGlobal.TEAM_NONE)
コード例 #3
0
    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
コード例 #4
0
    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