aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_nodemeta.cpp
diff options
context:
space:
mode:
authorHugues Ross <hugues.ross@gmail.com>2021-07-14 11:14:45 -0400
committerGitHub <noreply@github.com>2021-07-14 17:14:45 +0200
commit68143ed8eca81857d3d28c2c4059411d72a78e8e (patch)
treef09a1ab1b9c4d020b2f192feb9419bbcf336cd96 /src/script/cpp_api/s_nodemeta.cpp
parent6cdb150c8bd71ee0487d1af117c808b1b5ca8577 (diff)
downloadminetest-68143ed8eca81857d3d28c2c4059411d72a78e8e.tar.gz
minetest-68143ed8eca81857d3d28c2c4059411d72a78e8e.tar.bz2
minetest-68143ed8eca81857d3d28c2c4059411d72a78e8e.zip
Fix documented default colors for set_sky
Diffstat (limited to 'src/script/cpp_api/s_nodemeta.cpp')
0 files changed, 0 insertions, 0 deletions
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
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "voxelalgorithms.h"
#include "nodedef.h"

namespace voxalgo
{

void setLight(VoxelManipulator &v, VoxelArea a, u8 light,
		INodeDefManager *ndef)
{
	for(s32 x=a.MinEdge.X; x<=a.MaxEdge.X; x++)
	for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++)
	for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++)
	{
		v3s16 p(x,y,z);
		MapNode &n = v.getNodeRefUnsafe(p);
		n.setLight(LIGHTBANK_DAY, light, ndef);
		n.setLight(LIGHTBANK_NIGHT, light, ndef);
	}
}

void clearLightAndCollectSources(VoxelManipulator &v, VoxelArea a,
		enum LightBank bank, INodeDefManager *ndef,
		std::set<v3s16> & light_sources,
		std::map<v3s16, u8> & unlight_from)
{
	// The full area we shall touch
	VoxelArea required_a = a;
	required_a.pad(v3s16(0,0,0));
	// Make sure we have access to it
	v.addArea(a);

	for(s32 x=a.MinEdge.X; x<=a.MaxEdge.X; x++)
	for(s32 z=a.MinEdge.Z; z<=a.MaxEdge.Z; z++)
	for(s32 y=a.MinEdge.Y; y<=a.MaxEdge.Y; y++)
	{
		v3s16 p(x,y,z);