summaryrefslogtreecommitdiff
path: root/src/server/activeobjectmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/activeobjectmgr.h')
-rw-r--r--src/server/activeobjectmgr.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server/activeobjectmgr.h b/src/server/activeobjectmgr.h
index bc2085499..d43f5643c 100644
--- a/src/server/activeobjectmgr.h
+++ b/src/server/activeobjectmgr.h
@@ -38,6 +38,9 @@ public:
void getObjectsInsideRadius(const v3f &pos, float radius,
std::vector<ServerActiveObject *> &result,
std::function<bool(ServerActiveObject *obj)> include_obj_cb);
+ void getObjectsInArea(const aabb3f &box,
+ std::vector<ServerActiveObject *> &result,
+ std::function<bool(ServerActiveObject *obj)> include_obj_cb);
void getAddedActiveObjectsAroundPos(const v3f &player_pos, f32 radius,
f32 player_radius, std::set<u16> &current_objects,
a id='n118' href='#n118'>118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
--clipboard = {trainlen = number, [n] = {type = string, flipped = bool, }

-- Yaw is in radians. There are 2pi rad in a circle. North is the 0 point and the angle increases anticlockwise.
-- 4.712389 = 1.5pi; sin(1.5pi) = -1
-- 7.853981 = 2.5pi; sin(2.5pi) = 1

minetest.register_tool("advtrains:copytool", {
	description = attrans("Train copy/paste tool\n\nLeft-click: copy train\nRight-click: paste train"),
	inventory_image = "advtrains_copytool.png",
	wield_image = "advtrains_copytool.png",
	stack_max = 1,
	-- Paste: Take the clipboard and the player yaw, and attempt to place a new train in the world.
	-- The front of the train is used as the start of the new train and it proceeds backwards from
	-- the direction of travel.
	on_place = function(itemstack, placer, pointed_thing)
			if ((not pointed_thing.type == "node") or (not placer.get_player_name)) then
				return
			end
			local pname = placer:get_player_name()

			local node=minetest.get_node_or_nil(pointed_thing.under)
			if not node then atprint("[advtrains]Ignore at placer position") return itemstack end
			local nodename=node.name
			if(not advtrains.is_track_and_drives_on(nodename, {default=true})) then
				atprint("no track here, not placing.")
				return itemstack
			end
			if not minetest.check_player_privs(placer, {train_operator = true }) then
				minetest.chat_send_player(pname, "You don't have the train_operator privilege.")
				return itemstack
			end
			if not minetest.check_player_privs(placer, {train_admin = true }) and minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
				return itemstack
			end
			local tconns=advtrains.get_track_connections(node.name, node.param2)
			local yaw = placer:get_look_horizontal()
			local plconnid = advtrains.yawToClosestConn(yaw, tconns)

			local prevpos = advtrains.get_adjacent_rail(pointed_thing.under, tconns, plconnid, {default=true})
			if not prevpos then