diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-02 11:25:47 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-02 11:25:47 +0200 |
commit | 9af0142a36f345c16db5ccabf75349c1b13f59e2 (patch) | |
tree | addec8bd2d0f3c6ef5cc21bf21b4d76d07334c78 | |
parent | 34fd47887e72ab0a3f065b649c2dc1c92244ef80 (diff) | |
download | minetest-9af0142a36f345c16db5ccabf75349c1b13f59e2.tar.gz minetest-9af0142a36f345c16db5ccabf75349c1b13f59e2.tar.bz2 minetest-9af0142a36f345c16db5ccabf75349c1b13f59e2.zip |
Add enable_pvp setting
-rw-r--r-- | minetest.conf.example | 2 | ||||
-rw-r--r-- | src/defaultsettings.cpp | 1 | ||||
-rw-r--r-- | src/serverremoteplayer.cpp | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/minetest.conf.example b/minetest.conf.example index cf27acfac..83519e145 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -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 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index be63fb870..1e48183fa 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -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"); diff --git a/src/serverremoteplayer.cpp b/src/serverremoteplayer.cpp index bff414e1a..900cc5432 100644 --- a/src/serverremoteplayer.cpp +++ b/src/serverremoteplayer.cpp @@ -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; |