Surfaces Reloaded deprecated

by Danacus

Reach up to the skies or dig deep below, expand your base vertically... If you're into that kind of thing. Original by Simcra, ported to 0.14-0.16 by Erdbeerbaer. Port to 0.17 started by DeltaNedas and continued by Danacus.

3 years ago
0.17 - 1.1
589

b Construction Drones bug

4 years ago

Just testing the mod out and found a bug where the Construction Drones (from the Construction Drones mod) don't change the sprite correctly but you can still walk over it.

4 years ago

Could you be a bit more specific please? I don't understand what you mean. What sprite? Walk over what? Steps to reproduce the issue?

4 years ago
(updated 4 years ago)

It doesn't change the sprite or tile from a solid cavern wall (I forgot the corret name) to the excavated tile with the same look as the ones around the entrance. As for reproducing the issue use the decon planer with the Construction Drones on you. The Construction Bots and the player don't appear to have this issue.

4 years ago

Klonan mentioned an issue with a certain event when scripts destroy entities I didn't listen for. This is probably what's happening with his construction drones mod. Although I did add the event listener, I didn't have a way to test it. But now you might have found a way, thanks for reporting! I will look into this issue soon.

4 years ago

Oh and btw, are you still on 0.17 perhaps? I only fixed it in 0.18.

4 years ago

no I'm on 0.18

4 years ago

Then I should look into why it doesn't work, because I feel like it should.

4 years ago
(updated 4 years ago)

Hello the bug is still here and the fix is quite a simple one.
The problem is that when Construction Drone do entity.destroy() on the cavern wall. this action does not fire the on_entity_died. Bu there is an event for it ! That is :script_raised_destroy
So you just ads a single line:

Example:
-- When an entity dies
script.on_event(defines.events.on_entity_died, function(event) events.on_entity_died(event) end)
script.on_event(defines.events.script_raised_destroy, function(event) events.on_entity_died(event) end)

just tested the change on my save and it's work.

4 years ago

I thought I had implemented all script_raised_destroy event handlers, but I must have missed one. Thanks for figuring this out! I'll update the mod soon.

4 years ago

I took an other look and I found that in fact you forgot all three script_raised event

2 new event to listen to:
I added the following lines after:
script.on_event(defines.events.on_robot_built_entity, function(event) events.on_robot_built_entity(event) end)

script.on_event(defines.events.script_raised_built, function(event) events.on_script_built_entity(event) end)
script.on_event(defines.events.script_raised_revive, function(event) events.on_script_built_entity(event) end)

here is the function "on_script_built_entity" that need to be placed in the event.lua file

-- This function is called whenever an entity is built by a mod
function events.on_script_built_entity(_event)
if pairdata.exists(_event.entity) then
table.insert(global.task_queue, struct.TaskSpecification(tasks.trigger_create_paired_entity, {_event.entity}))
end
end

with that the construction drone can now also place entities :)
the event "script_raised_revive" has not been tested

4 years ago
(updated 4 years ago)

I did implement script_raised_destroy, because Klonan asked me to. I guess I didn't realize there were other ones.

Edit: I said I did but I didn't, weird

4 years ago

I've submitted an update, thank you for your contribution.

And a little tip/suggestion, if you want to contribute more to mods or programming projects in general, it might be easier to use git.

New response