paramat wrote:Set_lighting sets lighting in the voxelmanip exactly to the light you specify, does not calculate.
and
The nolight flag is a mapgen parameter that disables all lighting computations, which is very helpful for when you're doing a total mapgen replacement in lua.
more incredibly useful data, thanks! - explains why the lava area in grandfather's house is dark, while the rest of the house is lit up bright - until you throw a torch up and it sets something somewhere
In order to not get lighting glitches, you have to either set the nolight flag or call vmanip:set_lighting({day=0, night=0}) before calling vmanip:calc_lighting() in order to get correct lighting results.
vm:set_lighting({day=0, night=0}) is sadly meaningless to me - day=1 or night=1
from the latest lua.doc on github:
set_lighting(light): Set the lighting within the VoxelManip
^ light is a table, {day=<0...15>, night=<0...15>}
nah, still senseless - why is it day AND night? - oh way,is this saying that the particular node gets x lighting in the DAY and x lighting in the NIGHT? - so a street lamp that is off in the day and on at night would be day=0,night=15?
or i could just use the no_light flag and everything would all stay dark?
or is it not even node based but for the whole area of the vm?
anyway, so my:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode"})
end)
should be: (stolen from paragen.lua with much love)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode", flags="nolight", flagmask="nolight"})
end)
i'll try some things in a bit
um, nope i won't -
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
vm:set_data(data)
vm:set_lighting({day=5,night=10})
vm:calc_lighting()
gives a server error:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
18:50:37: ACTION[main]: Server for gameid="minetest" listening on port 52076.
creative inventory size: 176
spawning at:(0,55,0)
on_newplayer
18:50:38: ACTION[ServerThread]: singleplayer [127.0.0.1] joins game. List of players: singleplayer
Could not open file of texture: character.png
Loaded mesh: character.x
Font size: 8 15
generating (-32,-32,-32) (47,47,47)
18:50:42: ERROR[EmergeThread0]: ERROR: An unhandled exception occurred: LuaError: error: attempt to index a nil value
18:50:42: ERROR[EmergeThread0]: stack traceback:
In thread ad8bfb40:
/home/emachine/minetest/src/emerge.cpp:567: virtual void* EmergeThread::Thread(): Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD ad8bfb40:
#0 virtual void* EmergeThread::Thread()
(Leftover data: #1 virtual MapBlock* ServerMap::emergeBlock(v3s16, bool): p=(3,3,3), create_blank=0)
(Leftover data: #2 ServerMapSector* ServerMap::createSector(v2s16): p2d=(3,3))
DEBUG STACK FOR THREAD ae2a8b40:
#0 virtual void* MeshUpdateThread::Thread()
DEBUG STACK FOR THREAD b4f51b40:
#0 virtual void* ServerThread::Thread()
#1 void Server::Receive()
(Leftover data: #2 virtual void ServerEnvironment::step(float))
(Leftover data: #3 void RemoteClient::GetNextBlocks(Server*, float, std::vector<PrioritySortedBlockTransfer>&))
(Leftover data: #4 void ItemStack::serialize(std::ostream&) const)
DEBUG STACK FOR THREAD b69f6700:
#0 int main(int, char**)
(Leftover data: #1 void Client::step(float))
(Leftover data: #2 virtual void ClientEnvironment::step(float))
(Leftover data: #3 void Client::Receive())
(Leftover data: #4 void Client::ProcessData(irr::u8*, irr::u32, irr::u16))
(Leftover data: #5 void ItemStack::deSerialize(std::istream&, IItemDefManager*))
[1]+ Killed ./minetest
Aborted
the same code with "no_light" mgparam and no set_lighting looks great! - i dug a hole, it turns dark as it should - i'll just use this - clay is great for testing lighting! - creator code below - i wanted to compare the no-light to set_lighting with the same code but nope