コード例 #1
0
ファイル: hs_specremove.py プロジェクト: Ceiu/hyperspace-asss
def mm_attach(a):
    try:
        a.hs_specremove_times = {}
        a.hs_specremove_cb = asss.reg_callback(asss.CB_SHIPFREQCHANGE, shipfreqchange)
        a.hs_specremove_timer = asss.set_timer(lambda: tick(a), 100)
    except:
        mm_detach(a)
コード例 #2
0
ファイル: hs_fg_wz.py プロジェクト: Ceiu/hyperspace-asss
def schedule_win_check(a):
  def check_win_tmr():
    check_win(a)
    del a.fg_wz_checkwintmr
  # note that this releases the old reference, if one existed, which
  # will cancel any previously-set timer, so there is guaranteed to be
  # no win checks before windelay ticks after calling this function.
  a.fg_wz_checkwintmr = asss.set_timer(check_win_tmr, a.fg_wz_sets.windelay)
コード例 #3
0
ファイル: hs_specremove.py プロジェクト: Ceiu/hyperspace-asss
def mm_attach(a):
    try:
        a.hs_specremove_times = {}
        a.hs_specremove_cb = asss.reg_callback(asss.CB_SHIPFREQCHANGE,
                                               shipfreqchange)
        a.hs_specremove_timer = asss.set_timer(lambda: tick(a), 100)
    except:
        mm_detach(a)
コード例 #4
0
def schedule_win_check(a):
    def check_win_tmr():
        check_win(a)
        del a.fg_wz_checkwintmr

    # note that this releases the old reference, if one existed, which
    # will cancel any previously-set timer, so there is guaranteed to be
    # no win checks before windelay ticks after calling this function.
    a.fg_wz_checkwintmr = asss.set_timer(check_win_tmr, a.fg_wz_sets.windelay)
コード例 #5
0
ファイル: hs_duel.py プロジェクト: Ceiu/hyperspace-asss
def c_ready(cmd, params, p, targ):
    """Module: <py> hs_duel
Targets: none
Args: none
An accepted duel will start when both players are ready."""
    ad = p.arena.hs_duel
    if (p == ad.p1 or p == ad.p2) and p not in ad.ready:
        ad.ready.append(p)
        chat.SendArenaMessage(p.arena, "%s is ready to begin" % p.name)
    else:
        return

    if len(ad.ready) == 2:
        chat.SendArenaMessage(p.arena, "Both players have accepted. Duel beginning in 10 seconds")
        ad.start_timer = asss.set_timer(ad.start, 1000)
コード例 #6
0
def c_ready(cmd, params, p, targ):
    """Module: <py> hs_duel
Targets: none
Args: none
An accepted duel will start when both players are ready."""
    ad = p.arena.hs_duel
    if (p == ad.p1 or p == ad.p2) and p not in ad.ready:
        ad.ready.append(p)
        chat.SendArenaMessage(p.arena, "%s is ready to begin" % p.name)
    else:
        return

    if len(ad.ready) == 2:
        chat.SendArenaMessage(
            p.arena,
            "Both players have accepted. Duel beginning in 10 seconds")
        ad.start_timer = asss.set_timer(ad.start, 1000)
コード例 #7
0
ファイル: fg_wz.py プロジェクト: Ceiu/hyperspace-asss
	def Init(me, a):
		# get settings
		a.fg_wz_sets = sets = WZSets(a)

		if sets.carryflags < asss.CARRY_ALL:
			lm.LogA(asss.L_ERROR, 'fg_wz', a, 'invalid Flag:CarryFlags for warzone-style game')
			del a.fg_wz_sets
			return

		# set up flag game
		flagcore.SetCarryMode(a, sets.carryflags)
		flagcore.ReserveFlags(a, sets.max)

		# set up more stuff
		a.fg_wz_neuts = []
		a.fg_wz_current = 0

		a.fg_wz_spawntmr = asss.set_timer(lambda: spawn_timer(a), 500)
コード例 #8
0
ファイル: hs_duel.py プロジェクト: Ceiu/hyperspace-asss
def player_kill(a, killer, killed, bty, flags, pts, green):
    ad = a.hs_duel
    if ad.active:
        kills1 = stats.GetStat(ad.p1, asss.STAT_KILLS, asss.INTERVAL_RESET)
        kills2 = stats.GetStat(ad.p2, asss.STAT_KILLS, asss.INTERVAL_RESET)

        if ad.dk_check:
            chat.SendArenaMessage(a, "Double kill, does not count")
            kills1 -= 1
            kills2 -= 1
            stats.SetStat(ad.p1, asss.STAT_KILLS, asss.INTERVAL_RESET, kills1)
            stats.SetStat(ad.p2, asss.STAT_KILLS, asss.INTERVAL_RESET, kills2)
            chat.SendArenaMessage(a, "%s : %d    %s : %d " % (ad.p1.name, kills1, ad.p2.name, kills2))
        else:
            chat.SendArenaMessage(a, "%s : %d    %s : %d " % (ad.p1.name, kills1, ad.p2.name, kills2))
            ad.dk_check = True
            ad.dk_timer = asss.set_timer(ad.clear_doublekill, 100)

    return (pts, green)
コード例 #9
0
    def Init(me, a):
        # get settings
        a.fg_wz_sets = sets = WZSets(a)

        if sets.carryflags < asss.CARRY_ALL:
            lm.LogA(asss.L_ERROR, 'fg_wz', a,
                    'invalid Flag:CarryFlags for warzone-style game')
            del a.fg_wz_sets
            return

        # set up flag game
        flagcore.SetCarryMode(a, sets.carryflags)
        flagcore.ReserveFlags(a, sets.max)

        # set up more stuff
        a.fg_wz_neuts = []
        a.fg_wz_current = 0

        a.fg_wz_spawntmr = asss.set_timer(lambda: spawn_timer(a), 500)
コード例 #10
0
def player_kill(a, killer, killed, bty, flags, pts, green):
    ad = a.hs_duel
    if ad.active:
        kills1 = stats.GetStat(ad.p1, asss.STAT_KILLS, asss.INTERVAL_RESET)
        kills2 = stats.GetStat(ad.p2, asss.STAT_KILLS, asss.INTERVAL_RESET)

        if ad.dk_check:
            chat.SendArenaMessage(a, "Double kill, does not count")
            kills1 -= 1
            kills2 -= 1
            stats.SetStat(ad.p1, asss.STAT_KILLS, asss.INTERVAL_RESET, kills1)
            stats.SetStat(ad.p2, asss.STAT_KILLS, asss.INTERVAL_RESET, kills2)
            chat.SendArenaMessage(
                a, "%s : %d    %s : %d " %
                (ad.p1.name, kills1, ad.p2.name, kills2))
        else:
            chat.SendArenaMessage(
                a, "%s : %d    %s : %d " %
                (ad.p1.name, kills1, ad.p2.name, kills2))
            ad.dk_check = True
            ad.dk_timer = asss.set_timer(ad.clear_doublekill, 100)

    return (pts, green)