Created
February 26, 2019 09:41
-
-
Save saevarb/fb2cfdeae0698770c1788772c8f11f6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BotManager } from "BotManager"; | |
import { sendCM, Ticker } from "util/utils"; | |
import { ComponentType, IComponent } from "components/Component"; | |
import { myBots } from "util/constants"; | |
export class SlaveComponent implements IComponent { | |
public componentType: ComponentType = "role"; | |
public ticker: Ticker = new Ticker(500); | |
public onLoad = () => { | |
game_log("Starting waiting for party.."); | |
on_party_invite = (from: string) => { | |
if (myBots.has(from)) { | |
accept_party_invite(from); | |
} | |
}; | |
}; | |
public update = () => { | |
if (character.party) { | |
return; | |
} | |
if (this.ticker.isDone) { | |
game_log("Asking for party invite"); | |
// TODO: get leader generally | |
sendCM("sbrg", { msg: "request_party_invite" }); | |
this.ticker.reset(); | |
} | |
}; | |
public onUnload = () => { | |
on_party_invite = undefined; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment