[blocks.lua] Redstone Lamp now works with states. [furnace.lua] Now emits light when on.
This commit is contained in:
parent
d68e17a521
commit
a24deef802
@ -308,7 +308,7 @@ mod:block {
|
||||
|
||||
mod:block {
|
||||
id = "redstone_lamp",
|
||||
name = "Redstone Lamp (with states)",
|
||||
name = "Redstone Lamp",
|
||||
tiles = "redstone_lamp_off.png",
|
||||
|
||||
states = {
|
||||
@ -316,8 +316,8 @@ mod:block {
|
||||
},
|
||||
|
||||
on_block_activated = function(pos, block, player, world, client, server, screen_width, screen_height, gui_scale)
|
||||
local current_state = math.abs(world:get_block_state(pos.x, pos.y, pos.z):id() - 1)
|
||||
world:set_block_state(pos.x, pos.y, pos.z, current_state)
|
||||
local next_state = math.abs(world:get_block_state(pos.x, pos.y, pos.z):id() - 1)
|
||||
world:set_block_state(pos.x, pos.y, pos.z, next_state)
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,10 @@ mod:block {
|
||||
is_rotatable = true,
|
||||
|
||||
states = {
|
||||
{ tiles = {"furnace_top.png", "furnace_top.png", "furnace_front_on.png", "furnace_side.png"} },
|
||||
{
|
||||
is_light_source = true,
|
||||
tiles = {"furnace_top.png", "furnace_top.png", "furnace_front_on.png", "furnace_side.png"},
|
||||
},
|
||||
},
|
||||
|
||||
on_block_placed = function(pos, world)
|
||||
@ -199,8 +202,7 @@ mod:block {
|
||||
data.inventory:set_stack(2, 0, fuel_stack:item():string_id(), fuel_stack:amount() - 1)
|
||||
ticks_remaining = fuel_stack:item():get_group_value("group:om_fuel")
|
||||
current_burn_time = fuel_stack:item():get_group_value("group:om_fuel")
|
||||
world:set_data(pos.x, pos.y, pos.z,
|
||||
block:param():set_param(BlockParamType.State, block_param, 1))
|
||||
world:set_block_state(pos.x, pos.y, pos.z, 1)
|
||||
elseif ticks_remaining > 0 then
|
||||
ticks_remaining = ticks_remaining - 1
|
||||
|
||||
@ -212,8 +214,7 @@ mod:block {
|
||||
end
|
||||
elseif ticks_remaining == 0 then
|
||||
current_burn_time = 0
|
||||
world:set_data(pos.x, pos.y, pos.z,
|
||||
block:param():set_param(BlockParamType.State, block_param, 0))
|
||||
world:set_block_state(pos.x, pos.y, pos.z, 0)
|
||||
end
|
||||
|
||||
if item_progress >= 200 and recipe then
|
||||
|
@ -35,9 +35,10 @@ ServerChunk::ServerChunk(s32 x, s32 y, s32 z, World &world) : Chunk(x, y, z, wor
|
||||
}
|
||||
|
||||
void ServerChunk::updateLights() {
|
||||
if (m_lightmap.updateLights() || m_hasChanged) {
|
||||
if (m_lightmap.updateLights() || m_hasChanged || m_hasLightChanged) {
|
||||
m_isSent = false;
|
||||
m_hasChanged = false;
|
||||
m_hasLightChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,9 @@ void ServerWorld::update() {
|
||||
for (auto &it : m_chunks) {
|
||||
it.second->tick(*this, *m_server);
|
||||
|
||||
if (it.second->areAllNeighboursLoaded())
|
||||
if (it.second->areAllNeighboursLoaded()) {
|
||||
it.second->updateLights();
|
||||
}
|
||||
|
||||
if (it.second->isInitialized() && !it.second->isSent()) {
|
||||
for (auto &client : m_server->server().info().clients())
|
||||
@ -131,7 +132,7 @@ void ServerWorld::sendChunkData(const ClientInfo &client, ServerChunk &chunk) {
|
||||
chunk.setSent(true);
|
||||
chunk.setChanged(false);
|
||||
|
||||
// std::cout << "Chunk at (" << chunk.x() << ", " << chunk.y() << ", " << chunk.z() << ") sent to client" << std::endl;
|
||||
// gkDebug() << "Chunk at" << chunk.x() << chunk.y() << chunk.z() << "sent to client";
|
||||
}
|
||||
|
||||
void ServerWorld::sendRequestedData(ClientInfo &client, int cx, int cy, int cz) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user