mod compatibility

Post Reply
User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

mod compatibility

Post by Dysoch »

currently, all mods can be made compatible.

in the data.lua file, that is something like: (this was for industrio, but considering its died, i deleted it anyway) (and yes, i know the "else return" is abundant. didnt know it at that time :P)

Code: Select all

if data.raw.resource["quartz"] then
require("prototypes.recipe.industrio")
require("prototypes.recipe.recycling-industrio")
else return
end
or in the control.lua (also industrio):

Code: Select all

if game.entityprototypes.quartz then --[[Industrio Compatibility]]--
	if ds.craftitemsindustrio[event.itemstack.name] then
		for counter, ingredients in pairs(ds.craftitemsindustrio[event.itemstack.name]) do 
			glob.counter[counter]=glob.counter[counter]+(event.itemstack.count*ingredients)
		end
	end
end
well i find this ineffecient. why? simply if a mod changes the name of item in question or deletes it (in this case quartz) the compatibility ceases to exist.
i suggest this for data.lua:

Code: Select all

if data.raw.mod["Industrio"] then
require("prototypes.recipe.industrio")
require("prototypes.recipe.recycling-industrio")
else return
end
and control.lua:

Code: Select all

if mod.Industrio then --[[Industrio Compatibility]]--
	if ds.craftitemsindustrio[event.itemstack.name] then
		for counter, ingredients in pairs(ds.craftitemsindustrio[event.itemstack.name]) do 
			glob.counter[counter]=glob.counter[counter]+(event.itemstack.count*ingredients)
		end
	end
end
if you make it, it will allow me make a powerful compatibility for all mods to mine. all mods will then be able to add to the dynamic system, or the database of it.
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Post Reply

Return to “Implemented mod requests”