Page 1 of 1
[Resolved] Loading different sprite if a mod is detected
Posted: Mon Aug 29, 2016 3:46 pm
by Thomasnotused
Hello! In an effort to improve compatibility with the
Liftoff mod, I'm trying to load a different spritesheet (without the shadows) when it is detected, but I'm unsure about how to do this, would I have to disable the vanilla entities and load a new set with the new sprite?
Re: Loading different sprite if a mod is detected
Posted: Mon Aug 29, 2016 5:38 pm
by Adil
There's no interface for mod detection during data loading. Mostly it is done by making one mod to optionaly depend on other and then check if some mod-specific item is added to data.raw.
Given that data.lua is actually a script to generate data and not static definition, you hen can have conditionals and various complex operations to determine each field in prototype, including its graphics.
Considering the Aircraft and Liftoff, the thing is that the latter already depends on the former. Basically, that's what was in data.lua of liftoff: a few instructions to change the sprites (well, there's other unrelated stuff there). As long as the sprite sheets are somewhere, and their location is known, it is possible to set any prototype graphics to those sheets. The reason that the issue was raised in the mod thread is that I didn't like the idea of bundling heavy but not very different sprites into the scripting mod, which weights a hundred times less without them.
Re: Loading different sprite if a mod is detected
Posted: Mon Aug 29, 2016 5:42 pm
by Thomasnotused
Adil wrote:There's no interface for mod detection during data loading. Mostly it is done by making one mod to optionaly depend on other and then check if some mod-specific item is added to data.raw.
Given that data.lua is actually a script to generate data and not static definition, you hen can have conditionals and various complex operations to determine each field in prototype, including its graphics.
Considering the Aircraft and Liftoff, the thing is that the latter already depends on the former. Basically, that's what was in data.lua of liftoff: a few instructions to change the sprites (well, there's other unrelated stuff there). As long as the sprite sheets are somewhere, and their location is known, it is possible to set any prototype graphics to those sheets. The reason that the issue was raised in the mod thread is that I didn't like the idea of bundling heavy but not very different sprites into the scripting mod, which weights a hundred times less without them.
Ah, thanks for clearing that up!