Compare commits
No commits in common. "6284c49bb9436b0e63d52d18ef90746e14990fa5" and "f8422a9d53a8e13a672f9b7d6f8b6b83fa54ec31" have entirely different histories.
6284c49bb9
...
f8422a9d53
@ -61,10 +61,6 @@ impl ChatMessage {
|
|||||||
add_player(&mut label, &player);
|
add_player(&mut label, &player);
|
||||||
label.append_text(&kind.as_kill_text());
|
label.append_text(&kind.as_kill_text());
|
||||||
}
|
}
|
||||||
DamageSource::God => {
|
|
||||||
add_player(&mut label, &player);
|
|
||||||
label.append_text(" was removed from the world by godly forces");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
replay::{ReplayEvent, ReplayPlayback, ReplayRecorder},
|
replay::{ReplayEvent, ReplayPlayback, ReplayRecorder},
|
||||||
team_resource::TeamResource,
|
team_resource::TeamResource,
|
||||||
ui::cli::{CliColor, Command, CommandLinePanel},
|
ui::cli::{Command, CommandLinePanel},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const GAME_MANAGER_GLOBAL: &str = "GameManagerGlobal";
|
pub const GAME_MANAGER_GLOBAL: &str = "GameManagerGlobal";
|
||||||
@ -248,45 +248,6 @@ impl Command for RespawnBallCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ListPlayersCommand;
|
|
||||||
impl Command for ListPlayersCommand {
|
|
||||||
fn execute(&self, cli: &mut CommandLinePanel, _: &[&str]) {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
for player in &game.bind().players {
|
|
||||||
cli.publish_message(
|
|
||||||
format!(" - {} ({})", player.data.name, player.id()),
|
|
||||||
CliColor::Info,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn help(&self) -> &str {
|
|
||||||
"lists all players"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct KillCommand;
|
|
||||||
impl Command for KillCommand {
|
|
||||||
fn execute(&self, cli: &mut CommandLinePanel, args: &[&str]) {
|
|
||||||
if let Some(player_str) = args.first() {
|
|
||||||
if let Ok(player_id) = player_str.parse() {
|
|
||||||
if let Some(game) = &mut Game::singleton() {
|
|
||||||
game.bind_mut().kill_player(player_id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cli.publish_message("Invalid player id".to_string(), CliColor::Error);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cli.publish_message("Usage: kill [player_id]".to_string(), CliColor::Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn help(&self) -> &str {
|
|
||||||
"kills given player"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(GodotClass)]
|
#[derive(GodotClass)]
|
||||||
#[class(base=Node, init)]
|
#[class(base=Node, init)]
|
||||||
pub struct Game {
|
pub struct Game {
|
||||||
@ -522,10 +483,6 @@ impl Game {
|
|||||||
let mut cli = CommandLinePanel::singleton();
|
let mut cli = CommandLinePanel::singleton();
|
||||||
cli.bind_mut()
|
cli.bind_mut()
|
||||||
.register_command("respawn_ball".to_string(), Box::new(RespawnBallCommand));
|
.register_command("respawn_ball".to_string(), Box::new(RespawnBallCommand));
|
||||||
cli.bind_mut()
|
|
||||||
.register_command("players".to_string(), Box::new(ListPlayersCommand));
|
|
||||||
cli.bind_mut()
|
|
||||||
.register_command("kill".to_string(), Box::new(KillCommand));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -596,8 +553,6 @@ impl Game {
|
|||||||
let mut cli = CommandLinePanel::singleton();
|
let mut cli = CommandLinePanel::singleton();
|
||||||
cli.bind_mut()
|
cli.bind_mut()
|
||||||
.unregister_command("respawn_ball".to_string());
|
.unregister_command("respawn_ball".to_string());
|
||||||
cli.bind_mut().unregister_command("players".to_string());
|
|
||||||
cli.bind_mut().unregister_command("kill".to_string());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn change_option(&mut self, opt: GameOption, value: GameOptionValue) {
|
pub fn change_option(&mut self, opt: GameOption, value: GameOptionValue) {
|
||||||
@ -1332,17 +1287,6 @@ impl Game {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to kill the player from the serverside via a command
|
|
||||||
pub fn kill_player(&mut self, target_player_id: u16) {
|
|
||||||
if let Some(player) = self.find_player_mut(target_player_id)
|
|
||||||
&& let Some(character) = &mut player.character
|
|
||||||
{
|
|
||||||
character
|
|
||||||
.dyn_bind_mut()
|
|
||||||
.take_damage(DamageSource::God, 1000, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn recorder(&mut self) -> &mut Option<Gd<ReplayRecorder>> {
|
pub fn recorder(&mut self) -> &mut Option<Gd<ReplayRecorder>> {
|
||||||
&mut self.replay_recorder
|
&mut self.replay_recorder
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,10 +38,7 @@ impl IArea3D for Goal {
|
|||||||
|
|
||||||
impl Goal {
|
impl Goal {
|
||||||
fn on_enter(&self, node: Gd<Node3D>) {
|
fn on_enter(&self, node: Gd<Node3D>) {
|
||||||
if let Ok(mut ball) = node.try_cast::<Ball>()
|
if let Ok(_) = node.try_cast::<Ball>() {
|
||||||
&& !ball.bind().entered_goal
|
|
||||||
{
|
|
||||||
ball.bind_mut().entered_goal = true;
|
|
||||||
if let Some(mut game) = Game::singleton() {
|
if let Some(mut game) = Game::singleton() {
|
||||||
let teams = game
|
let teams = game
|
||||||
.bind()
|
.bind()
|
||||||
|
|||||||
@ -12,7 +12,6 @@ use crate::{
|
|||||||
#[class(base=RigidBody3D, init)]
|
#[class(base=RigidBody3D, init)]
|
||||||
pub struct Ball {
|
pub struct Ball {
|
||||||
pub dropper: Option<u16>,
|
pub dropper: Option<u16>,
|
||||||
pub entered_goal: bool,
|
|
||||||
|
|
||||||
alive_for: f64,
|
alive_for: f64,
|
||||||
|
|
||||||
|
|||||||
@ -316,7 +316,6 @@ impl<T: IPlayer + ICharacterBody3D + WithBaseField> PlayerCommon for T {
|
|||||||
pub enum DamageSource {
|
pub enum DamageSource {
|
||||||
Player(u16),
|
Player(u16),
|
||||||
Killbox(KillboxKind),
|
Killbox(KillboxKind),
|
||||||
God,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DamageSource {
|
impl DamageSource {
|
||||||
@ -324,7 +323,6 @@ impl DamageSource {
|
|||||||
match self {
|
match self {
|
||||||
DamageSource::Player(id) => (DamageSourceSignal::Player, *id, KillboxKind::default()),
|
DamageSource::Player(id) => (DamageSourceSignal::Player, *id, KillboxKind::default()),
|
||||||
DamageSource::Killbox(kind) => (DamageSourceSignal::Killbox, 0, *kind),
|
DamageSource::Killbox(kind) => (DamageSourceSignal::Killbox, 0, *kind),
|
||||||
DamageSource::God => (DamageSourceSignal::God, 0, KillboxKind::default()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +330,6 @@ impl DamageSource {
|
|||||||
match signal {
|
match signal {
|
||||||
DamageSourceSignal::Player => DamageSource::Player(player),
|
DamageSourceSignal::Player => DamageSource::Player(player),
|
||||||
DamageSourceSignal::Killbox => DamageSource::Killbox(kind),
|
DamageSourceSignal::Killbox => DamageSource::Killbox(kind),
|
||||||
DamageSourceSignal::God => DamageSource::God,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,5 +339,4 @@ impl DamageSource {
|
|||||||
pub enum DamageSourceSignal {
|
pub enum DamageSourceSignal {
|
||||||
Player,
|
Player,
|
||||||
Killbox,
|
Killbox,
|
||||||
God,
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user