mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
Api 9 release
This commit is contained in:
parent
9b4ee194a1
commit
ba27a96ede
4 changed files with 867 additions and 533 deletions
50
plugins/utilities/wave_emote.py
Normal file
50
plugins/utilities/wave_emote.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# ba_meta require api 9
|
||||
#! Fix bug when the previous message is "hello" it will not trigger the wave emote on new round or game
|
||||
import time
|
||||
|
||||
import babase
|
||||
import bascenev1 as bs
|
||||
|
||||
last_len_msg = 0 # Initialize the global variable outside the function
|
||||
|
||||
def wave_emote():
|
||||
global last_len_msg # To modify the global variable
|
||||
|
||||
# Check if the players are in game first
|
||||
try:
|
||||
act_players = bs.get_foreground_host_activity().players
|
||||
if not act_players:
|
||||
return
|
||||
except AttributeError:
|
||||
# Except the attribute error if the player is in a server
|
||||
return
|
||||
|
||||
# Incase chats are empty or in replay
|
||||
try:
|
||||
lastmsg = bs.get_chat_messages()[-1]
|
||||
except:
|
||||
return
|
||||
|
||||
# Perform a check to see if the player is playing|spectating
|
||||
for player in act_players:
|
||||
try:
|
||||
if player.actor.node:
|
||||
continue
|
||||
except:
|
||||
return
|
||||
|
||||
# Check if the message contains "hello"
|
||||
if len(bs.get_chat_messages()) != last_len_msg:
|
||||
if act_players and "hello" in lastmsg:
|
||||
for player in act_players:
|
||||
if player.getname() in lastmsg:
|
||||
# Trigger the wave emote
|
||||
player.actor.node.handlemessage("celebrate_r", 1000)
|
||||
|
||||
last_len_msg = len(bs.get_chat_messages())
|
||||
print(last_len_msg, "last_len_msg")
|
||||
|
||||
# ba_meta export plugin
|
||||
class brostos(babase.Plugin):
|
||||
timer = bs.AppTimer(0.5, wave_emote, repeat=True)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue