Official Forum for the HOMETOWN Minetest game server.

Simple protector placement helper [CSM]

We know you want it, need it, so here it is for you.
Talk about whatever, but keeping it clean.
Here's a tiny CSM that basically tells you (in chat) when you can and can't place a protector. I don't think it can be called cheating, although you could easy modify it to make it cheating. ;) I thought somebody might be interested. I might or might not improve it.

Code: Select all

local last = false
local status = false

minetest.register_chatcommand("pfinder", {
	description = "Turn on or off protection warnings",
	params = "on | off",
	func = function(param)
		if param == "on" then
			status = true
		elseif param == "off" then
			status = false
		else
			minetest.display_chat_message("Invalid parameter!")
		end
	end
})

minetest.register_on_connect(function()
    localplayer = minetest.localplayer
	
	minetest.register_globalstep(function(dtime)
		if not status then return end
		local pos = localplayer:get_pos()
		local found = minetest.find_node_near(pos, 21, {"protector:protect1", "protector:protect2"})
		
		if found and not last then
			last = true
			local owner = minetest.get_meta(found):get_string("owner") or "unknown"
			local message = "[pFinder] Conflicts with " .. owner .. "'s protector at " .. minetest.pos_to_string(found)
			minetest.display_chat_message(minetest.colorize("#FF0000", message))
		elseif not found and last then
			last = false
			minetest.display_chat_message(minetest.colorize("#00FF00", "[pFinder] You can now place a protector"))
		end
	end)
end)
Nice!

HUDs were recently added to the CSM API I hear.......

/me looks at HUDs for newer protector mod
I did once think of making something similar myself.
ChimneySwift wrote:
Tue Feb 20, 2018 6:08 am
/me looks at HUDs for newer protector mod
tbh I don't like that and I hope it doesn't get added to the server. Occasionally something like that could be useful but most of the time I find it annoying. Stuff like that should be handled client-side at the choice of each user themselves.
call me noob... but isn't the version we use unable to run CSMs? how would i go about running that?!?
Bob8881 wrote:
Tue Feb 20, 2018 2:51 pm
call me noob... but isn't the version we use unable to run CSMs? how would i go about running that?!?
The ability to use CSMs depends on your client. If you're using Minetest 0.4.16 you can use CSMs.

To install the CSM, follow the instructions on the Minetest wiki. You'll need to copy the code from the first post into a new file called "init.lua".
ChimneySwift wrote:
Tue Feb 20, 2018 6:08 am
Nice!

HUDs were recently added to the CSM API I hear.......

/me looks at HUDs for newer protector mod
/me is waiting for stable 0.5 to drop bc he is never successful with compiling software...
random_geek wrote:
Tue Feb 20, 2018 5:24 pm
ChimneySwift wrote:
Tue Feb 20, 2018 6:08 am
Nice!

HUDs were recently added to the CSM API I hear.......

/me looks at HUDs for newer protector mod
/me is waiting for stable 0.5 to drop bc he is never successful with compiling software...
If you're using Ubuntu then you can get the latest version from the daily build repository (this is a pre-compiled version of exactly what you would get if you compiled it yourself from the latest source code). If you're using Windows then there aren't any development builds, only stable ones, and compiling it yourself is more complicated than on Linux-based systems.
random_geek wrote:/me is waiting for stable 0.5 to drop bc he is never successful with compiling software...
You sadly can only join 0.5 servers
https://forum.minetest.net/viewtopic.ph ... 24#p310799
LoneWolfHT wrote:
Wed Feb 21, 2018 10:16 pm
random_geek wrote:/me is waiting for stable 0.5 to drop bc he is never successful with compiling software...
You sadly can only join 0.5 servers
https://forum.minetest.net/viewtopic.ph ... 24#p310799
Oh yeah 8-)
LoneWolfHT wrote:
Wed Feb 21, 2018 10:16 pm
random_geek wrote:/me is waiting for stable 0.5 to drop bc he is never successful with compiling software...
You sadly can only join 0.5 servers
https://forum.minetest.net/viewtopic.ph ... 24#p310799
Wait for 0.4.17 then. It's supposed to be released at the same time as 0.5 with the relevant parts backported to the 0.4.x series.

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 23 on Wed Mar 14, 2018 2:43 am

Users browsing this forum: No registered users and 1 guest