|
VoltMod
C++23 framework for CS2 server plugins
|
The game's yes/no vote panel (F1/F2), with the ballots counted here. More...
#include <Vote.hpp>
Public Member Functions | |
| Vote (Interfaces &interfaces, EntitySystem &entities, PlayerManager &players, GameEvents &events, Scheduler &scheduler) | |
| Vote (const Vote &)=delete | |
| Vote & | operator= (const Vote &)=delete |
| bool | Start (VoteRequest request) |
| void | End (VoteEndReason reason) |
| bool | InProgress () const |
| bool | TryCastBallot (int slot, std::string_view option) |
The game's yes/no vote panel (F1/F2), with the ballots counted here.
One vote at a time, open to every connected human; bots get no panel and no ballot. Callbacks run on the game thread.
| VoltMod::Vote::Vote | ( | Interfaces & | interfaces, |
| EntitySystem & | entities, | ||
| PlayerManager & | players, | ||
| GameEvents & | events, | ||
| Scheduler & | scheduler ) |
All five must outlive this service; the Runtime declares them above it.
Definition at line 36 of file Vote.cpp.
References VoltMod::PlayerManager::Disconnected.
Referenced by operator=(), and Vote().
|
delete |
References Vote().
| void VoltMod::Vote::End | ( | VoteEndReason | reason | ) |
| bool VoltMod::Vote::Start | ( | VoteRequest | request | ) |
Open request's vote. False when one is already running, it has no VoteRequest::Passed, or no human is connected.
Definition at line 62 of file Vote.cpp.
References VoltMod::AllTeams, VoltMod::VoteRequest::DurationMs, VoltMod::VoteTally::Eligible, VoltMod::IsValidSlot(), VoltMod::VoteRequest::Passed, and VoltMod::YesNoIssueIndex.
| bool VoltMod::Vote::TryCastBallot | ( | int | slot, |
| std::string_view | option ) |
Definition at line 99 of file Vote.cpp.
References VoltMod::IsValidSlot(), VoltMod::VoteTally::No, VoltMod::NoOption, VoltMod::VoteTally::Yes, and VoltMod::YesOption.