| 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; |