Your most recent "release" on Github has a bug. This is 0.0.2, which I downloaded to try to get a handle for your code to get started on the above.
When I try to place a downwards powerpole (will test with an upwards pole in a moment) I get the following error:
error when running the event handler:
__Surfaces__/script/lib/surfaces.lua:315:
bad argument #-1 to "connect_neighbor"
(table expected, got nil)
All prior edits
Edit: Yes, same error with an upwards powerpole.
Edit: I made a quick test. I replaced the line "entity.connect_neighbour(paired_entity)" with "entity.connect_neighbour{paired_entity}", but it still error-ed on the same thing: placing a powerpole that goes between surfaces. The new error:
error when running the event handler:
__Surfaces__/script/lib/surfaces.lua:316:
expected target_entity in connection definition
Edit 4: The second error is obvious now that I've looked at connect_neighbor. But... perhaps this is being caused by the finalize_paired_entity script being called before the paired_entity is created? No, that wouldn't make sense; but paired_entity is not being read as a table, for whatever reason.
Edit 5: First, I just realized I should have said pre-edits that I hadn't modified any code yet. I'm just trying to figure out how it works. Now that I've tested commenting out and replacing the brackets on that one line, I've set things back to normal and am just looking at the code.
OK, finalize_paired_entity is called in events.lua, during execute_first_task_in_waiting_queue(event). Time for me to look up For Loops in Lua, because I'm not sure whether you're supposed to be using v or k there; it might be looking up the last thing in the waiting_queue table instead of the first. But then the ladders wouldn't work either? I'll come back, either with another edit, or with a new post if you've posted by then, when I have something else to report.
elseif v.task==task_createpair then
local paired_entity = create_paired_entity(v.data.entity, v.data.paired_surface)
if paired_entity==nil or paired_entity==false then
table.insert(global.task_queue, v)
else
table.insert(global.task_queue, {task=task_finishpair,data=v.data})
end
elseif v.task==task_finishpair then
finalize_paired_entity(v.data.entity, v.data.paired_entity)
end
Notice "data=v.data"? What is in v.data?
That's right, .entity and .paired_surface. finalize_paired_entity is looking for v.data.paired_entity, but you have v.data.paired_surface instead!
You have a local paired_entity, but you haven't added it to v.data yet.
I'm going to test adding the line v.data.paired_entity = paired_entity into there, see if that fixes it. I'll report back shortly.
Edit 7: It works. Just change the above segment in Events.lua to this:
elseif v.task==task_createpair then
local paired_entity = create_paired_entity(v.data.entity, v.data.paired_surface)
v.data.paired_entity = paired_entity
if paired_entity==nil or paired_entity==false then
table.insert(global.task_queue, v)
else
table.insert(global.task_queue, {task=task_finishpair,data=v.data})
end
elseif v.task==task_finishpair then
finalize_paired_entity(v.data.entity, v.data.paired_entity)
end
This will fix the error I've been getting.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Sun Jun 05, 2016 2:19 pm
by Simcra
flabort wrote:Your most recent "release" on Github has a bug. This is 0.0.2, which I downloaded to try to get a handle for your code to get started on the above.
...
Just finished restructuring and fixing minor bugs, have reuploaded 0.0.2 release. Tell me if the error still occurs.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Sun Jun 05, 2016 7:44 pm
by flabort
No, error does not happen in new version, though I don't see what you did to fix it
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Mon Jun 06, 2016 1:37 am
by Simcra
flabort wrote:No, error does not happen in new version, though I don't see what you did to fix it
Well I accidentaly cut a line of code out in one of the changes, so I put it back. I make silly mistakes like this all the time, it's really frustrating.
EDIT: note that I've restructured most of the code so that each function and variable is referenced in a way that specifies where it comes from. For example, config variables are now referenced as "config.variable", surfaces functions are now referenced as "surfaces.function", and so on.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Mon Jun 06, 2016 4:59 am
by Simcra
Also, if you have ideas that relate to the remote interfaces please let me know. I'm very interested in providing inter-mod communication, I just have no idea where to start or what would be useful, obviously I don't want to provide access to the raw pair-data and all remote interface calls should check validity of input data and structure. As for now, I will be working on the intersurface train stop for awhile so there is no need to fear any more sudden structure changes in the github repository. I hope this helps.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Mon Jun 06, 2016 3:49 pm
by StanFear
Simcra wrote:As for now, I will be working on the intersurface train stop for awhile so there is no need to fear any more sudden structure changes in the github repository. I hope this helps.
well, good luck with that ! if you have an idea on how to set it up, let me know, we could work on it together ! (And I would also implement it in Subsurfaces (if the idea match my criteria))
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Wed Jun 08, 2016 4:26 am
by Simcra
StanFear wrote:well, good luck with that ! if you have an idea on how to set it up, let me know, we could work on it together ! (And I would also implement it in Subsurfaces (if the idea match my criteria))
I'm more than happy to work with you! I have sent some info through on skype and will keep you in the loop as much as possible.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Thu Jun 09, 2016 1:44 am
by flabort
I am enjoying this mod very much. As for cliffs, I am making a separate mod using the API and code-hooks you've set up so far, it's far from complete or ready for testing, but I don't think there's much additional coding needed on your end to allow outside mods to use your code to make stuff that links up between levels.
That's assuming I understand what your pairdata_insert_array(<table>) command does properly, anyways.
(If I'm right, then if you enter data into this properly it links the things you entered up together, right?)
So the mod is dependent on Surfaces >= 0.0.2, which means I have access to all your scripts . I don't even need to use require(script-from-Surfaces), which means my control.lua can look like this:
Like I said, though, this code is incomplete, and completely untested. There are likely some missing commas in there, and I haven't scripted the auto-place script yet - this will be relatively easy now that I have experience with this.
Also, haven't made any graphics. The few I have I stole from you
A useful bit of code in your mod that I could use some cross-mod scripting for would be a blacklist for entities that your sky-world removal script removes when a new chunk spawns. If I could make it ignore the items in my mod and leave them intact... Better yet, a just make the blacklist for tiles, and it ignores/doesn't remove anything that spawns on a blacklisted tile, and doesn't remove the tile either.
Also, it would be bad if cliff-shadows were to spawn underground. I think if I understood your scripts right what I already have will remove any cliff-shadows from underground, correct?
Edit: I have corrected some things, provided placeholder pictures, and built the autoplace controls. It compiles, time to test if it crashes when trying to spawn the cliff-shadows. If it doesn't crash, I'm going to try scripting the thing where it places cliff-minable.
Edit 2 : http://pastie.org/10870099 <-entities http://pastie.org/10870100 <- tiles http://pastie.org/10870101 <- control.lua doesn't place cliff-minable on cliff-shadow yet
data.lua is just requiring entities and tiles.
info.json requires Surfaces as part of it.
Current problem: When spawning a new world, I get the error "Invalid MapGenRichness" with no further information, and the game crashes.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Fri Jun 10, 2016 9:12 am
by Simcra
flabort wrote:I don't think there's much additional coding needed on your end to allow outside mods to use your code to make stuff that links up between levels.
Yes, I've working on this among the other general structure with the surfaces mod, the current github version differs from my local version but I will push changes once I am happy with them and know that they work.
flabort wrote:That's assuming I understand what your pairdata_insert_array(<table>) command does properly, anyways.
Yes, the way you had written it was correct for the version currently on github. I have changed this to be a little more intuitive in my local version and will continue to show my face on IRC once in awhile to answer any questions you or anyone else may have.
flabort wrote:Except I also want to make a script in there that spawns a cliff-minable entity each time a cliff-shadow is made, putting it in the same spot.
Currently, this is not possible. I have not yet figured out a way to make this work, but it is planned. Although thinking about it now, I assume it would possible to do something similar to the way you register event handlers.
flabort wrote:Also, haven't made any graphics. The few I have I stole from you
Mentioning the graphics, they are truly terrible. Honestly, I wish I could find someone willing to make better ones.
flabort wrote:A useful bit of code in your mod that I could use some cross-mod scripting for would be a blacklist for entities that your sky-world removal script removes when a new chunk spawns.
Yes, though I may make it a little different as the sky-floor is on every collision mask (I think) meaning that they get removed even if they are not removed by the chunk generation function. A better way to do it would be like this: each cliff entity has a cliff tile and when you destroy the cliff-minable, it places another sky-floor where the cliff tile used to be. You would need to look at the prototype for sky-floor and make sure that your cliff tile had a lower layer so that it could be replaced. I can easily add the blacklist and will probably do by or before the 0.0.3 release.
flabort wrote:Current problem: When spawning a new world, I get the error "Invalid MapGenRichness" with no further information, and the game crashes.
{
type = "autoplace-control",
name = "cliff-shadow",
richness = "false", --this bit right here
order = "m-a"
}
Also, I am glad to hear you are enjoying my mod, I have worked hard to get it to where it is now.
Re: [MOD 0.12.33+] Surfaces 0.0.2
Posted: Fri Jun 10, 2016 4:06 pm
by Simcra
Just uploaded my local changes to the github repo. I've put a few things in there that might be helpful, also modified a few things which will probably break your mod, sorry
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Sat Jul 09, 2016 10:26 am
by Atria
This mod doesn't seem to work on my existing save. Do I need to generate new map to be able to travel to different surfaces? Or execute some command that creates different surfaces?
Also describing process of teleporting between surfaces would be nice. From scripts it whould seems the player only needs to be close to an entrance and he will be teleported automaticly. Am I correct?
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Sun Jul 10, 2016 12:45 am
by Hixie
It doesn't seem to work. We just started a fresh game with this mod enabled and nothing happens when we go near the ladders.
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Sun Jul 10, 2016 1:34 am
by Simcra
Hixie wrote:It doesn't seem to work. We just started a fresh game with this mod enabled and nothing happens when we go near the ladders.
The platform access shafts are a bit buggy at the moment, try mining the ladder and replacing it where it was, then go near the ladder again.
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Sun Jul 10, 2016 1:35 am
by Simcra
Atria wrote:This mod doesn't seem to work on my existing save. Do I need to generate new map to be able to travel to different surfaces? Or execute some command that creates different surfaces?
Also describing process of teleporting between surfaces would be nice. From scripts it whould seems the player only needs to be close to an entrance and he will be teleported automaticly. Am I correct?
Yes, the sky access shafts are a bit buggy at the moment, you may need to remove it and re-place it. Mod does not have migration files at the moment so if you were using a previous version of the mod you will need to create a new save game.
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Mon Jul 11, 2016 8:59 pm
by funnysunnybunny
Would it be possible to impose the sky layer on the ground layer so you could still see everything below you?
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Wed Jul 13, 2016 2:07 am
by Simcra
funnysunnybunny wrote:Would it be possible to impose the sky layer on the ground layer so you could still see everything below you?
I have no idea how to do this, but I would like to do this.
Re: [MOD 0.13.0+] Surfaces 0.0.5
Posted: Wed Jul 13, 2016 1:12 pm
by funnysunnybunny
Simcra wrote:
funnysunnybunny wrote:Would it be possible to impose the sky layer on the ground layer so you could still see everything below you?
I have no idea how to do this, but I would like to do this.
hopefully some modder or dev appears that magically knows a possible solution, I also have no idea how to draw that surface below
I hope Klonan stumbles over this thread and has a magical solution
for some reason Squeak Through starts throwing errors if I use both together
Re: [MOD 0.13.0+] Surfaces 0.0.6
Posted: Sat Jul 23, 2016 11:01 am
by Simcra
funnysunnybunny wrote:for some reason Squeak Through starts throwing errors if I use both together
Thanks for the heads up, I will look into it.
Re: [MOD 0.13.0+] Surfaces 0.0.6
Posted: Tue Jul 26, 2016 9:05 am
by nucleargen
Placing intersurface pole after 0.13.11 update causes next error:
Error while running the event handler: __Surfaces__/script/lib/api.lua:322: An area of zero size is not supported. Either don't define area to search the entire surface or use 'position'.
And since 0.13.10 placing intersurface liquid tank on nauvis causes full deletion of stone walls underground (hopefully only on generated chunks)
-----
Solved:
update entity_pair_data object in control.lua - added non 0 clearance radius to all entities declaration.
Re: [MOD 0.13.0+] Surfaces 0.0.6
Posted: Wed Jul 27, 2016 10:00 am
by nucleargen
created pull request to repo: factorio 0.13.10+ patch fix and minor warehousing addon improvement dealing with items transporting speed depending on chest entity tilesize https://github.com/nucleargen/Surfaces - my fork