Blockland Forums > Modification Help
RTB Preferences for maps?
Reactor Worker:
Could RTB preferences be used to enable/disable content within a map assuming the settings were changed before the map was loaded? For instance, could you have an option to disable loading a certain interior or set of shapes? Perhaps a way to comment out or disable entire portions of a mission file?
If this is possible, would anyone be willing to create the necessary code and help me integrate it into my map?
Ephialtes:
You just need to change the particular interior to be conditionally loaded. For example in your .mis file:
--- Code: ---// Standard map objects
new Blah(Map)
{
Blah blah
};
// Register the pref
RTB_registerPref(...)
// Load optional things
if($Pref::MyMap::Whatever)
{
%interior = new InteriorInstance(blah)
{
somestuff
};
Map.add(%interior);
}
--- End code ---
Reactor Worker:
So, something like this?
--- Code: ---//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new ScriptObject(MissionInfo) {
saveName = "Worlds";
name = "Worlds";
};
new MissionArea(MissionArea) {
Area = "-360 -648 720 1296";
locked = "true";
flightCeiling = "300";
flightCeilingRange = "20";
};
new Sky(Sky) {
position = "336 136 0";
rotation = "1 0 0 0";
scale = "1 1 1";
materialList = "./astroskies/gal.dml";
cloudHeightPer[0] = "0.349971";
cloudHeightPer[1] = "0.3";
cloudHeightPer[2] = "0.199973";
cloudSpeed1 = "0.0005";
cloudSpeed2 = "0.001";
cloudSpeed3 = "0.0003";
visibleDistance = "600";
fogDistance = "2000";
fogColor = "0.000000 0.000000 0.000000 1.000000";
fogStorm1 = "0";
fogStorm2 = "0";
fogStorm3 = "0";
fogVolume1 = "0 0 0";
fogVolume2 = "0 0 0";
fogVolume3 = "0 0 0";
fogVolumeColor1 = "192.000000 128.000000 128.000000 -222768174765569860000000000000000000000.000000";
fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000";
fogVolumeColor3 = "128.000000 128.000000 128.000000 -170698929442160050000000000000000000000.000000";
windVelocity = "1 1 0";
windEffectPrecipitation = "1";
SkySolidColor = "0.000000 0.000000 0.100000 1.000000";
useSkyTextures = "1";
renderBottomTexture = "1";
noRenderBans = "1";
locked = "true";
};
new Sun() {
azimuth = "180";
elevation = "90";
color = "0.700000 0.650000 0.500000 1.000000";
ambient = "0.300000 0.250000 0.200000 1.000000";
direction = "0 0 0";
locked = "false";
position = "0 0 120";
scale = "1 1 1";
rotation = "1 0 0 0";
};
new SimGroup(PlayerDropPoints) {
new SpawnSphere() {
position = "0 0 20";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
canSetIFLs = "0";
radius = "50";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
RayHeight = "150";
};
};
new InteriorInstance() {
position = "500 400 0";
rotation = "0 0 1 180";
scale = "1 1 1";
interiorFile = "./Lava.dif";
useGLLighting = "0";
showTerrainInside = "0";
};
if($Pref::Worlds::Slate On)
new InteriorInstance() {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
interiorFile = "~/Map_Slate/slate.dif";
useGLLighting = "0";
showTerrainInside = "0";
};
};
//--- OBJECT WRITE END ---
--- End code ---
Is the Map.add(%interior) a different kind of function? Does that automatically create the option under RTB Preferences?
Ephialtes:
More like this:
--- Code: ---//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
new ScriptObject(MissionInfo) {
saveName = "Worlds";
name = "Worlds";
};
new MissionArea(MissionArea) {
Area = "-360 -648 720 1296";
locked = "true";
flightCeiling = "300";
flightCeilingRange = "20";
};
new Sky(Sky) {
position = "336 136 0";
rotation = "1 0 0 0";
scale = "1 1 1";
materialList = "./astroskies/gal.dml";
cloudHeightPer[0] = "0.349971";
cloudHeightPer[1] = "0.3";
cloudHeightPer[2] = "0.199973";
cloudSpeed1 = "0.0005";
cloudSpeed2 = "0.001";
cloudSpeed3 = "0.0003";
visibleDistance = "600";
fogDistance = "2000";
fogColor = "0.000000 0.000000 0.000000 1.000000";
fogStorm1 = "0";
fogStorm2 = "0";
fogStorm3 = "0";
fogVolume1 = "0 0 0";
fogVolume2 = "0 0 0";
fogVolume3 = "0 0 0";
fogVolumeColor1 = "192.000000 128.000000 128.000000 -222768174765569860000000000000000000000.000000";
fogVolumeColor2 = "128.000000 128.000000 128.000000 0.000000";
fogVolumeColor3 = "128.000000 128.000000 128.000000 -170698929442160050000000000000000000000.000000";
windVelocity = "1 1 0";
windEffectPrecipitation = "1";
SkySolidColor = "0.000000 0.000000 0.100000 1.000000";
useSkyTextures = "1";
renderBottomTexture = "1";
noRenderBans = "1";
locked = "true";
};
new Sun() {
azimuth = "180";
elevation = "90";
color = "0.700000 0.650000 0.500000 1.000000";
ambient = "0.300000 0.250000 0.200000 1.000000";
direction = "0 0 0";
locked = "false";
position = "0 0 120";
scale = "1 1 1";
rotation = "1 0 0 0";
};
new SimGroup(PlayerDropPoints) {
new SpawnSphere() {
position = "0 0 20";
rotation = "0 0 1 130.062";
scale = "0.940827 1.97505 1";
dataBlock = "SpawnSphereMarker";
canSetIFLs = "0";
radius = "50";
sphereWeight = "1";
indoorWeight = "1";
outdoorWeight = "1";
RayHeight = "150";
};
};
new InteriorInstance() {
position = "500 400 0";
rotation = "0 0 1 180";
scale = "1 1 1";
interiorFile = "./Lava.dif";
useGLLighting = "0";
showTerrainInside = "0";
};
};
//--- OBJECT WRITE END ---
if($Pref::Worlds::SlateOn)
{
%interior = new InteriorInstance() {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
interiorFile = "~/Map_Slate/slate.dif";
useGLLighting = "0";
showTerrainInside = "0";
};
MissionGroup.add(%interior);
}
--- End code ---
You'll still need to look at the RTB Documentation (http://returntoblockland.com/files/RTB_Documentation.pdf) to learn about how to register a pref for RTB. "Adding" the interior just adds it to the mission instead of having it floating around in oblivion.
Reactor Worker:
Maps don't usually have a "server.cs" file, so is that something I just add to the main folder of the add_on?
Is this what I put in it?
--- Code: ---RTB_registerPref(
"Slate On?",
"Worlds",
"$Worlds::SlateOn",
"bool", //boolean?
"Map_Worlds",
"0", //That means by default it is off?
1,
1, ); //host only?
--- End code ---
I omitted the callback name as I don't think I need that.