Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
c0cd7aa3
Commit
c0cd7aa3
authored
8 years ago
by
SmallJoker
Committed by
kwolekr
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Anticheat: Use the physics_override modifiers aswell
parent
2de8c22a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/content_sao.cpp
+44
-44
44 additions, 44 deletions
src/content_sao.cpp
with
44 additions
and
44 deletions
src/content_sao.cpp
+
44
−
44
View file @
c0cd7aa3
...
@@ -1326,52 +1326,52 @@ std::string PlayerSAO::getPropertyPacket()
...
@@ -1326,52 +1326,52 @@ std::string PlayerSAO::getPropertyPacket()
bool
PlayerSAO
::
checkMovementCheat
()
bool
PlayerSAO
::
checkMovementCheat
()
{
{
bool
cheated
=
false
;
if
(
isAttached
()
||
m_is_singleplayer
||
if
(
isAttached
()
||
m_is_singleplayer
||
g_settings
->
getBool
(
"disable_anticheat"
))
{
g_settings
->
getBool
(
"disable_anticheat"
))
{
m_last_good_position
=
m_player
->
getPosition
();
m_last_good_position
=
m_player
->
getPosition
();
return
false
;
}
}
else
{
bool
cheated
=
false
;
/*
/*
Check player movements
Check player movements
NOTE: Actually the server should handle player physics like the
NOTE: Actually the server should handle player physics like the
client does and compare player's position to what is calculated
client does and compare player's position to what is calculated
on our side. This is required when eg. players fly due to an
on our side. This is required when eg. players fly due to an
explosion. Altough a node-based alternative might be possible
explosion. Altough a node-based alternative might be possible
too, and much more lightweight.
too, and much more lightweight.
*/
*/
float
player_max_speed
=
0
;
float
player_max_speed
=
0
;
if
(
m_privs
.
count
(
"fast"
)
!=
0
){
// Fast speed
if
(
m_privs
.
count
(
"fast"
)
!=
0
)
{
player_max_speed
=
m_player
->
movement_speed_fast
;
// Fast speed
}
else
{
player_max_speed
=
m_player
->
movement_speed_fast
*
m_physics_override_speed
;
// Normal speed
}
else
{
player_max_speed
=
m_player
->
movement_speed_walk
;
// Normal speed
}
player_max_speed
=
m_player
->
movement_speed_walk
*
m_physics_override_speed
;
// Tolerance. With the lag pool we shouldn't need it.
}
//player_max_speed *= 2.5;
// Tolerance. The lag pool does this a bit.
//player_max_speed_up *= 2.5;
//player_max_speed *= 2.5;
v3f
diff
=
(
m_player
->
getPosition
()
-
m_last_good_position
);
v3f
diff
=
(
m_player
->
getPosition
()
-
m_last_good_position
);
float
d_vert
=
diff
.
Y
;
float
d_vert
=
diff
.
Y
;
diff
.
Y
=
0
;
diff
.
Y
=
0
;
float
d_horiz
=
diff
.
getLength
();
float
d_horiz
=
diff
.
getLength
();
float
required_time
=
d_horiz
/
player_max_speed
;
float
required_time
=
d_horiz
/
player_max_speed
;
if
(
d_vert
>
0
&&
d_vert
/
player_max_speed
>
required_time
)
required_time
=
d_vert
/
player_max_speed
;
if
(
d_vert
>
0
&&
d_vert
/
player_max_speed
>
required_time
)
if
(
m_move_pool
.
grab
(
required_time
)){
required_time
=
d_vert
/
player_max_speed
;
// Moving upwards
m_last_good_position
=
m_player
->
getPosition
();
}
else
{
if
(
m_move_pool
.
grab
(
required_time
))
{
actionstream
<<
"Player "
<<
m_player
->
getName
()
m_last_good_position
=
m_player
->
getPosition
();
<<
" moved too fast; resetting position"
}
else
{
<<
std
::
endl
;
actionstream
<<
"Player "
<<
m_player
->
getName
()
m_player
->
setPosition
(
m_last_good_position
);
<<
" moved too fast; resetting position"
cheated
=
true
;
<<
std
::
endl
;
}
m_player
->
setPosition
(
m_last_good_position
);
cheated
=
true
;
}
}
return
cheated
;
return
cheated
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment