mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Aim hack attempt, part 1.
This commit is contained in:
parent
73244893cc
commit
bd91815ff4
@ -21,7 +21,8 @@ use common::{
|
|||||||
tool::{AbilityMap, MaterialStatManifest, ToolKind},
|
tool::{AbilityMap, MaterialStatManifest, ToolKind},
|
||||||
ItemDesc,
|
ItemDesc,
|
||||||
},
|
},
|
||||||
ChatMsg, ChatType, InputKind, InventoryUpdateEvent, Pos, Stats, UtteranceKind, Vel,
|
CharacterState, ChatMsg, ChatType, InputKind, InventoryUpdateEvent, Pos, Stats,
|
||||||
|
UtteranceKind, Vel,
|
||||||
},
|
},
|
||||||
consts::MAX_MOUNT_RANGE,
|
consts::MAX_MOUNT_RANGE,
|
||||||
link::Is,
|
link::Is,
|
||||||
@ -376,17 +377,42 @@ impl PlayState for SessionState {
|
|||||||
let cam_pos = cam_pos + focus_off;
|
let cam_pos = cam_pos + focus_off;
|
||||||
|
|
||||||
let (is_aiming, aim_dir_offset) = {
|
let (is_aiming, aim_dir_offset) = {
|
||||||
let is_aiming = client
|
let (is_aiming, projectile_speed) = client
|
||||||
.state()
|
.state()
|
||||||
.read_storage::<comp::CharacterState>()
|
.read_storage::<comp::CharacterState>()
|
||||||
.get(player_entity)
|
.get(player_entity)
|
||||||
.map(|cs| cs.is_aimed())
|
.map(|cs| {
|
||||||
.unwrap_or(false);
|
(cs.is_aimed(), match cs {
|
||||||
|
CharacterState::BasicRanged(data) => data.static_data.projectile_speed,
|
||||||
|
CharacterState::ChargedRanged(data) => {
|
||||||
|
data.static_data.initial_projectile_speed
|
||||||
|
+ data.charge_frac() * data.static_data.scaled_projectile_speed
|
||||||
|
},
|
||||||
|
CharacterState::RepeaterRanged(data) => {
|
||||||
|
data.static_data.projectile_speed
|
||||||
|
},
|
||||||
|
_ => 0.0,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.unwrap_or((false, 0.0));
|
||||||
|
|
||||||
(
|
(
|
||||||
is_aiming,
|
is_aiming,
|
||||||
if is_aiming && self.scene.camera().get_mode() == CameraMode::ThirdPerson {
|
if is_aiming && self.scene.camera().get_mode() == CameraMode::ThirdPerson {
|
||||||
Vec3::unit_z() * 0.025
|
let vel = (
|
||||||
|
&client.state().ecs().read_storage::<comp::Vel>(),
|
||||||
|
&client.state().ecs().read_storage::<comp::PhysicsState>(),
|
||||||
|
)
|
||||||
|
.join()
|
||||||
|
.get(player_entity, &client.state().ecs().entities())
|
||||||
|
.map(|(vel, physics)| physics.ground_vel - vel.0)
|
||||||
|
.unwrap_or(Vec3::zero());
|
||||||
|
let vel = if projectile_speed > 0.0 {
|
||||||
|
vel / projectile_speed
|
||||||
|
} else {
|
||||||
|
Vec3::zero()
|
||||||
|
};
|
||||||
|
Vec3::unit_z() * 0.025 + vel
|
||||||
} else {
|
} else {
|
||||||
Vec3::zero()
|
Vec3::zero()
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user