Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Do not use Objects in System.ocg
- - By Maikel Date 2015-02-15 18:04 Edited 2015-02-15 18:13
We have created a few instances where we use Objects in System.ocg which is bad for people wanting to create their own Object packs without using our objects. Examples:

ERROR: unknown identifier: CreateLight (in ExplosionEffect, planet\System.ocg\Explode.c:250:22)
ERROR: unknown identifier: GUI_MenuDeco (in MessageWindow, planet\System.ocg\Player.c:106:95)


We can solve the first error by either checking if CreateLight is available by checking for C4Id("Fx_Light")(C4Id is gone, but an alternative like Global.Fx_Light is imaginable) or by overloading the ExplosionEffect function in the Fx_Light object. I prefer the first one, any opinions alternatives?

Any preferred solutions for the second one?

Also we have a lot of libraries depending on even more objects, I can see a lot of pack using our libraries, so there we should try to be more precise by telling at the start of a library which other objects are needed for it to function.
Parent - - By Sven2 [de] Date 2015-02-15 19:08
If I remember overloading order right, objects should overload global System.ocg. So we can just declare these things and have them overloaded by Objects.ocd.

global func CreateLight(...) {}
static GUI_MenuDeco;


CreateLight should be pretty save. I'm not sure if static GUI_MenuDeco causes any issues compiling or in savegames.

Another option for menu deco is that usage could be outsourced into a global function that is overloaded. In fact, having global func GetMenuDeco() which is overloaded in the GUI_MenuDeco definition might be nice because it would allow scenario designers to overload it to introduce their own deco.
Parent - By Maikel Date 2015-02-15 21:48
The static option does not work, and CreateLight needs that as well since it has Fx_Light.LGT_Blast parameter.
Parent - By Zapper [de] Date 2015-02-15 19:51
And if the System.ocg scripts really need that dependency, that part could be outsourced to Objects.ocd/Effects.ocd/System.ocg, for example. Then it would only be loaded if Objects.ocd is loaded. We could also create an Objects.ocd/System.ocg folder for that reason
Up Topic Development / Developer's Corner / Do not use Objects in System.ocg

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill