Skip to content

Commit 9daa524

Browse files
committed
fix some admin abuse stuff and clippy errors
1 parent 26e2102 commit 9daa524

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

bp_ort/src/admin_abuse/health.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rrplug::bindings::{
33
cvar::convar::{FCVAR_CLIENTDLL, FCVAR_GAMEDLL, FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
44
};
55
use rrplug::prelude::*;
6+
use shared::utils::is_alive;
67

78
use crate::{
89
admin_abuse::{
@@ -67,6 +68,10 @@ fn health_server_command(command: CCommandResult) {
6768
}
6869

6970
fn set_health(player: &mut CPlayer, mut health: i32) {
71+
if !is_alive(player) {
72+
return;
73+
}
74+
7075
if health >= 524286 {
7176
health = 524286;
7277
}

bp_ort/src/admin_abuse/teleport.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(unused)]
22

3+
use rrplug::bindings::class_types::cplayer::CPlayer;
34
use rrplug::prelude::*;
45
use rrplug::{
56
bindings::{
@@ -8,7 +9,7 @@ use rrplug::{
89
},
910
mid::utils::from_char_ptr,
1011
};
11-
use shared::utils::lookup_ent;
12+
use shared::utils::{is_alive, lookup_ent, nudge_type};
1213

1314
use crate::admin_abuse::completion_append_player_names;
1415
use crate::bindings::CLIENT_FUNCTIONS;
@@ -44,6 +45,14 @@ pub fn register_teleport_command(engine_data: &EngineData, token: EngineToken) {
4445
FCVAR_CLIENTDLL as i32,
4546
token,
4647
);
48+
49+
_ = engine_data.register_concommand(
50+
"angles",
51+
print_player_angles,
52+
"",
53+
FCVAR_CLIENTDLL as i32,
54+
token,
55+
);
4756
}
4857

4958
#[rrplug::concommand]
@@ -57,6 +66,13 @@ fn print_player_position() -> Option<()> {
5766
None
5867
}
5968

69+
#[rrplug::concommand]
70+
fn print_player_angles() -> Option<()> {
71+
log::info!("angles: catornot should find the function in c_player lol");
72+
73+
None
74+
}
75+
6076
#[rrplug::concommand]
6177
fn teleport_server_command(command: CCommandResult) -> Option<()> {
6278
if command.get_arg(1).is_none() {
@@ -84,9 +100,12 @@ fn teleport_server_command(command: CCommandResult) -> Option<()> {
84100
))
85101
})
86102
.find_map(|(player, name)| {
103+
unsafe {
104+
(funcs.calc_origin)(player, &nudge_type::<*const CPlayer>(player), 0, 0);
105+
}
87106
name_target
88107
.starts_with(name.as_str())
89-
.then_some(unsafe { *player.get_origin(&mut v) })
108+
.then_some(player.m_vecAbsOrigin)
90109
})?;
91110

92111
// if unsafe { !(funcs.check_position)(&tp_location).is_null() } {
@@ -97,7 +116,7 @@ fn teleport_server_command(command: CCommandResult) -> Option<()> {
97116
execute_for_matches(
98117
command.get_arg(0),
99118
|player| {
100-
if lookup_ent(player.m_hMoveParent, funcs).is_none() {
119+
if lookup_ent(player.m_hMoveParent, funcs).is_none() && is_alive(player) {
101120
unsafe { (funcs.set_origin)(player, &tp_location) }
102121
}
103122
},

octbots/src/behavior.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use bevy_math::prelude::*;
21
use bonsai_bt::{
32
Action,
43
Behavior::{AlwaysSucceed, If, Select, WhenAny},

octbots/src/targeting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use shared::{
1616
use std::{
1717
collections::BTreeMap,
1818
f32::consts::{PI, TAU},
19-
hash::{DefaultHasher, Hash, Hasher},
19+
hash::{Hash, Hasher},
2020
};
2121

2222
use crate::behavior::BotAction;

0 commit comments

Comments
 (0)