MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / placeMod

Method placeMod

source/game/scripting/StarWorldLuaBindings.cpp:2131–2157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2129 }
2130
2131 bool WorldEnvironmentCallbacks::placeMod(World* world, Vec2I const& arg1, String const& arg2, String const& arg3, Maybe<int> const& arg4, bool arg5) {
2132 auto tilePosition = arg1;
2133
2134 PlaceMod placeMod;
2135
2136 auto layerName = arg2;
2137 if (layerName == "foreground") {
2138 placeMod.layer = TileLayer::Foreground;
2139 } else if (layerName == "background") {
2140 placeMod.layer = TileLayer::Background;
2141 } else {
2142 throw StarException(strf("Unsupported tile layer {}", layerName));
2143 }
2144
2145 auto modName = arg3;
2146 auto materialDatabase = Root::singleton().materialDatabase();
2147 if (!materialDatabase->modNames().contains(modName))
2148 throw StarException(strf("Unknown mod name {}", modName));
2149 placeMod.mod = materialDatabase->modId(modName);
2150
2151 if (arg4)
2152 placeMod.modHueShift = (MaterialHue)*arg4;
2153
2154 bool allowOverlap = arg5;
2155
2156 return world->modifyTile(tilePosition, placeMod, allowOverlap);
2157 }
2158}
2159
2160}

Callers

nothing calls this directly

Calls 8

StarExceptionClass · 0.85
strfFunction · 0.85
singletonClass · 0.85
materialDatabaseMethod · 0.80
modNamesMethod · 0.80
modIdMethod · 0.80
containsMethod · 0.45
modifyTileMethod · 0.45

Tested by

no test coverage detected