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

Method mod

source/game/scripting/StarWorldLuaBindings.cpp:1907–1924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1905 }
1906
1907 LuaValue WorldEnvironmentCallbacks::mod(World* world, LuaEngine& engine, Vec2F const& position, String const& layerName) {
1908 TileLayer layer;
1909 if (layerName == "foreground") {
1910 layer = TileLayer::Foreground;
1911 } else if (layerName == "background") {
1912 layer = TileLayer::Background;
1913 } else {
1914 throw StarException(strf("Unsupported mod layer {}", layerName));
1915 }
1916
1917 auto modId = world->mod(Vec2I::floor(position), layer);
1918 if (isRealMod(modId)) {
1919 auto materialDatabase = Root::singleton().materialDatabase();
1920 return engine.createString(materialDatabase->modName(modId));
1921 }
1922
1923 return LuaNil;
1924 }
1925
1926 float WorldEnvironmentCallbacks::materialHueShift(World* world, Vec2F const& position, String const& layerName) {
1927 TileLayer layer;

Callers 4

enterStageMethod · 0.45
inspectMethod · 0.45
blockSwapMethod · 0.45
fireMethod · 0.45

Calls 6

StarExceptionClass · 0.85
strfFunction · 0.85
isRealModFunction · 0.85
singletonClass · 0.85
materialDatabaseMethod · 0.80
createStringMethod · 0.80

Tested by 1

inspectMethod · 0.36