Post by Jeff on Feb 23, 2013 23:42:32 GMT
Note: credits to Matan for the MainMenuGui.gui source code.
This code basically allows the marble to be re-skinned so that it can change colors. This will not change the marble shape as it does not use dts files, rather it uses image files. In order to add new skins, navigate to:
marble/data/shapes/balls/
and add new files with:
<your file base>.marble.png
Installation:
Go to marble/client/init.cs
find function initClient() and look where other files are being loaded.
add this:
Go to marble/client/ui/
add in the attached file
Go to marble/server/scripts/game.cs
find function GameConnection::onClientEnterGame(%this)
add this right before the last closing brace (}):
To use:
I added a console command to use this. In the level select screen BEFORE you press play, open the console (press the ~ key) and type in the following:
If you want this attached to a button, make a button in a .gui file and change the command field to this:
That is it! If your marble gliches out and you can't see your new texture, this may help you solve it (this is found in the source code)
This code is under the MIT license:
Also, once a skin is selected, it will even be saved!
Enjoy!!
~Jeff
This code basically allows the marble to be re-skinned so that it can change colors. This will not change the marble shape as it does not use dts files, rather it uses image files. In order to add new skins, navigate to:
marble/data/shapes/balls/
and add new files with:
<your file base>.marble.png
Installation:
Go to marble/client/init.cs
find function initClient() and look where other files are being loaded.
add this:
// load our script
exec("./ui/MarbleSelectDlg.gui");
Go to marble/client/ui/
add in the attached file
Go to marble/server/scripts/game.cs
find function GameConnection::onClientEnterGame(%this)
add this right before the last closing brace (}):
// This is where the marble selection happens
if (isFile($Pref::MarbleSelection))
{
%marbleSkin = convertToFileBase($Pref::MarbleSelection);
%this.player.setSkinName(%marbleSkin);
}
To use:
I added a console command to use this. In the level select screen BEFORE you press play, open the console (press the ~ key) and type in the following:
openMarbleSelect();
If you want this attached to a button, make a button in a .gui file and change the command field to this:
command = "openMarbleSelect();";
That is it! If your marble gliches out and you can't see your new texture, this may help you solve it (this is found in the source code)
// If the skin does not show up, go into:
// marble/server/scripts/marble.cs
// find:
// Datablock MarbleData(DefaultMarble)
// find:
// emap = true;
// change to:
// emap = false;
// then, close marble blast and reload it.
This code is under the MIT license:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
Also, once a skin is selected, it will even be saved!
Enjoy!!
~Jeff