Skip to content

Commit

Permalink
Add enable_pvp setting
Browse files Browse the repository at this point in the history
  • Loading branch information
celeron55 committed Dec 2, 2011
1 parent 34fd478 commit 9af0142
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions minetest.conf.example
Expand Up @@ -133,6 +133,8 @@
#default_privs = build, shout
# Whether players are transferred to client without any range limit
#unlimited_player_transfer_distance = true
# Whether to enable players killing each other
#enable_pvp = true

# Profiler data print interval. #0 = disable.
#profiler_print_interval = 0
Expand Down
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Expand Up @@ -94,6 +94,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("default_password", "");
settings->setDefault("default_privs", "build, shout");
settings->setDefault("unlimited_player_transfer_distance", "true");
settings->setDefault("enable_pvp", "true");

settings->setDefault("profiler_print_interval", "0");
settings->setDefault("enable_mapgen_debug_info", "false");
Expand Down
6 changes: 6 additions & 0 deletions src/serverremoteplayer.cpp
Expand Up @@ -139,6 +139,12 @@ void ServerRemotePlayer::punch(ServerActiveObject *puncher,
if(!puncher)
return;

// No effect if PvP disabled
if(g_settings->getBool("enable_pvp") == false){
if(puncher->getType() == ACTIVEOBJECT_TYPE_PLAYER)
return;
}

// "Material" properties of a player
MaterialProperties mp;
mp.diggability = DIGGABLE_NORMAL;
Expand Down

0 comments on commit 9af0142

Please sign in to comment.