Many functions in System.ocg have proper documentation, but not next to
the code. When changing these functions, it is easy to forget updating
the docs. Nobody likes outdated documentation!
It created SetName("") entries because def->GetName() has a fallback to the internal name while obj->GetName() does not.
Just use .Name instead. Objects with custom naming (overloaded GetName()) need to overload name saving anyway.
It serializes objects using a selective SaveScenarioObjects script callback and then just executes the generated script. This automatically saves important properties, connects switches and doors, etc.
This change also solves the problem that duplicating an elevator plus case would create two elevator cases.
If execution fails (e.g. because of script errors or because a non-saveable object was duplicated), the method falls back to the legacy duplication method of creating objects with the same prototypes at the same position.
* CreateObject for goals/rules/environment, rotated, contained and earth objects
* Allow properties to overwrite default behavior of CreateObject vs CreateObjectAbove
* Random initialization of seaweed phase instead of saving it
* Do not save color of ColorByOwner objects that have their owner color
* Fix block spacing between objects of same type if objects of different type occur inbetween but are not saved
Renamed CreateObject() to CreateObjectAbove() and replaced all occurrences in script files.
Added CreateObject(), the function may need a rewrite though, see comment in code.
Updated documentation
The engine (extra)warns whenever you use Par() or ... inside of a
function that is not declared as taking a variable number of arguments.
Change the declaration of all System.ocg varargs functions so it is
immediately obvious.