Deleted Resource Help
Posted: Sat Oct 06, 2018 2:42 am
Hi,
I have a mod (Factorio World) that spawns basic resources when a player is teleported to a location:
(This is done in a script called from control.lua.)
However, I have learned that at least one mod deletes the resource "crude-oil", which causes my mod to fail.
(This is done in a script \prototypes\generation\ez-override.lua.)
I tried adding a simple check in my script:
but this doesn't have access to 'data'. I am not sure of the scope of the data object, so I don't know where to put code that will perform the needed check.
Perhaps I am missing something obvious.
Any suggestions?
thanks,
jon
I have a mod (Factorio World) that spawns basic resources when a player is teleported to a location:
Code: Select all
surface.create_entity({name="crude-oil", amount=START_OIL_AMOUNT, position={oil_patch_x, oil_patch_y}})
However, I have learned that at least one mod deletes the resource "crude-oil", which causes my mod to fail.
Code: Select all
data.raw.resource["crude-oil"] = nil
I tried adding a simple check in my script:
Code: Select all
if data.raw.resource["crude-oil"] then
Perhaps I am missing something obvious.
Any suggestions?
thanks,
jon