PvP area toggle
- taikedz
- Member
- Posts: 698
- Joined: Sun May 15, 2016 11:11
- GitHub: taikedz
- IRC: DuCake
- In-game: DuCake
- Location: Scotland, UK
- Contact:
PvP area toggle
Hello
I looked a bit and cannot find - is there a mod that ensure that a given area is PvP enable, whilst leaving other areas non-PvP and vice-versa?
I know tenplus1's protection mod prevents PvP in protected areas, but that also protects said areas from other actions.
What I am wondering is, if you have the server in PvP-enabled mode, if a mod could prevent PvP globally except in demarcated areas?
I looked a bit and cannot find - is there a mod that ensure that a given area is PvP enable, whilst leaving other areas non-PvP and vice-versa?
I know tenplus1's protection mod prevents PvP in protected areas, but that also protects said areas from other actions.
What I am wondering is, if you have the server in PvP-enabled mode, if a mod could prevent PvP globally except in demarcated areas?
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: PvP area toggle
Nothing exists that I know of, but you may use minetest.register_on_punchplayer() and drop all damage unless the player is inside one of these designated areas. Using an AreaStore to delimit PvP acceptable areas and check if a player is inside of it would do.
This is a fun idea and I've played with it some already, so I might attempt to flesh something out.
This is a fun idea and I've played with it some already, so I might attempt to flesh something out.
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: PvP area toggle
Code: Select all
local pvp_areas_store = AreaStore()
local edge1 = {x = -25, y = -25, z = -25}
local edge2 = {x = 25, y = 25, z = 25}
local data = "Test Case 1"
local id = 6
pvp_areas_store:insert_area(edge1, edge2, data, id)
minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
for k, v in pairs(pvp_areas_store:get_areas_for_pos(player:getpos())) do
if k then
return false
end
end
return true
end)
- taikedz
- Member
- Posts: 698
- Joined: Sun May 15, 2016 11:11
- GitHub: taikedz
- IRC: DuCake
- In-game: DuCake
- Location: Scotland, UK
- Contact:
Re: PvP area toggle
Thanks - I'll look into that.
[I am also realizing this post is in the wrong forum section...... if any moderator feels it should be moved to "Modding Discussion" please do...]
[I am also realizing this post is in the wrong forum section...... if any moderator feels it should be moved to "Modding Discussion" please do...]
- taikedz
- Member
- Posts: 698
- Joined: Sun May 15, 2016 11:11
- GitHub: taikedz
- IRC: DuCake
- In-game: DuCake
- Location: Scotland, UK
- Contact:
Re: PvP area toggle
Fantastic, will have a play around with this!everamzah wrote:This works for a hard-coded location. I'll next try those neat looking to_file() and from_file() AreaStore methods, in order to save whatever areas you set using some chat command.Code: Select all
local pvp_areas_store = AreaStore() (snip)
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: PvP area toggle
Posted in the WIP Mods subforum. Will continue this later, hope it helps.
Edit: Very forgetful today -- viewtopic.php?f=9&t=15480
Edit: Very forgetful today -- viewtopic.php?f=9&t=15480
-
- Member
- Posts: 361
- Joined: Tue Jan 19, 2016 16:46
- GitHub: jdc843
- IRC: jdc843
- In-game: 843jdc
- Location: USA
Re: PvP area toggle
I would be interested in this myself for Cash's World server.
- everamzah
- Member
- Posts: 490
- Joined: Thu Jan 29, 2015 00:47
- GitHub: everamzah
- IRC: everamzah
- In-game: everamzah
Re: PvP area toggle
843jdc: viewtopic.php?f=9&t=15480 pvp_areas mod is ready to test, if you like. You'll need a minetest from today or later, or else it'll crash.
- taikedz
- Member
- Posts: 698
- Joined: Sun May 15, 2016 11:11
- GitHub: taikedz
- IRC: DuCake
- In-game: DuCake
- Location: Scotland, UK
- Contact:
Re: PvP area toggle
For those who want to run this on older builds (pre 2016-09-09), use this one:
https://github.com/taikedz/pvp_areas/
It's done as-is now though - advice is to update your minetest build and use everamzah's version when possible.
(EDIT: I nuked this just now and only now realize why I was keeping it around. Oops. But you should have probably upgraded since.)
https://github.com/taikedz/pvp_areas/
It's done as-is now though - advice is to update your minetest build and use everamzah's version when possible.
(EDIT: I nuked this just now and only now realize why I was keeping it around. Oops. But you should have probably upgraded since.)
Who is online
Users browsing this forum: No registered users and 44 guests