diff --git a/source/online/backend/schema/Room.hx b/source/online/backend/schema/Room.hx index 333d23b7..36497b00 100644 --- a/source/online/backend/schema/Room.hx +++ b/source/online/backend/schema/Room.hx @@ -68,6 +68,9 @@ class Room extends Schema { @:type("boolean") public var hideGF:Bool = false; + @:type("boolean") + public var disableSkins: Bool = false; + @:type("number") public var winCondition: Dynamic = 0; } diff --git a/source/online/states/RoomState.hx b/source/online/states/RoomState.hx index 63bbf6b2..2f6d9132 100644 --- a/source/online/states/RoomState.hx +++ b/source/online/states/RoomState.hx @@ -198,6 +198,7 @@ class RoomState extends MusicBeatState { var waitingForPlayer2Skin = false; var lastSwapped = false; + var lastSkinDisable = false; override function create() { super.create(); @@ -501,22 +502,25 @@ class RoomState extends MusicBeatState { p1 = null; p1Layer.clear(); - if (FileSystem.exists(Paths.mods(GameClient.room.state.player1.skinMod))) { - if (GameClient.room.state.player1.skinMod != null) - Mods.currentModDirectory = GameClient.room.state.player1.skinMod; - - if (GameClient.room.state.player1.skinName != null) - p1 = new Character(0, 0, GameClient.room.state.player1.skinName + (GameClient.room.state.swagSides ? "-player" : ''), GameClient.room.state.swagSides); - } - else if (enableDownload && GameClient.room.state.player1.skinURL != null) { - waitingForPlayer1Skin = true; - OnlineMods.downloadMod(GameClient.room.state.player1.skinURL, manualDownload, (_) -> { - if (destroyed) - return; - - loadCharacter(isP1, false); - waitingForPlayer1Skin = false; - }); + if(!GameClient.room.state.disableSkins) + { + if (FileSystem.exists(Paths.mods(GameClient.room.state.player1.skinMod))) { + if (GameClient.room.state.player1.skinMod != null) + Mods.currentModDirectory = GameClient.room.state.player1.skinMod; + + if (GameClient.room.state.player1.skinName != null) + p1 = new Character(0, 0, GameClient.room.state.player1.skinName + (GameClient.room.state.swagSides ? "-player" : ''), GameClient.room.state.swagSides); + } + else if (enableDownload && GameClient.room.state.player1.skinURL != null) { + waitingForPlayer1Skin = true; + OnlineMods.downloadMod(GameClient.room.state.player1.skinURL, manualDownload, (_) -> { + if (destroyed) + return; + + loadCharacter(isP1, false); + waitingForPlayer1Skin = false; + }); + } } if (p1 == null) @@ -533,23 +537,26 @@ class RoomState extends MusicBeatState { p2 = null; p2Layer.clear(); - if (FileSystem.exists(Paths.mods(GameClient.room.state.player2.skinMod))) { - if (GameClient.room.state.player2.skinMod != null) - Mods.currentModDirectory = GameClient.room.state.player2.skinMod; - - if (GameClient.room.state.player2.skinName != null) - p2 = new Character(0, 0, GameClient.room.state.player2.skinName + (GameClient.room.state.swagSides ? '' : "-player"), !GameClient.room.state.swagSides); - } - else if (enableDownload && GameClient.room.state.player2.skinURL != null) { - waitingForPlayer2Skin = true; - OnlineMods.downloadMod(GameClient.room.state.player2.skinURL, manualDownload, (_) -> { - if (destroyed) - return; - - loadCharacter(isP1, false); - waitingForPlayer2Skin = false; - }); - } + if(!GameClient.room.state.disableSkins) + { + if (FileSystem.exists(Paths.mods(GameClient.room.state.player2.skinMod))) { + if (GameClient.room.state.player2.skinMod != null) + Mods.currentModDirectory = GameClient.room.state.player2.skinMod; + + if (GameClient.room.state.player2.skinName != null) + p2 = new Character(0, 0, GameClient.room.state.player2.skinName + (GameClient.room.state.swagSides ? '' : "-player"), !GameClient.room.state.swagSides); + } + else if (enableDownload && GameClient.room.state.player2.skinURL != null) { + waitingForPlayer2Skin = true; + OnlineMods.downloadMod(GameClient.room.state.player2.skinURL, manualDownload, (_) -> { + if (destroyed) + return; + + loadCharacter(isP1, false); + waitingForPlayer2Skin = false; + }); + } + } if (p2 == null) p2 = new Character(/*770*/ 0, 0, "default" + (GameClient.room.state.swagSides ? '' : "-player"), !GameClient.room.state.swagSides); @@ -630,12 +637,13 @@ class RoomState extends MusicBeatState { lastFocused = chatBox.focused && chatBox.typeText.text.length > 0; - if (lastSwapped != GameClient.room.state.swagSides) { + if (lastSwapped != GameClient.room.state.swagSides || lastSkinDisable != GameClient.room.state.disableSkins) { loadCharacter(true); loadCharacter(false); } lastSwapped = GameClient.room.state.swagSides; + lastSkinDisable = GameClient.room.state.disableSkins; // if (FlxG.keys.justPressed.SPACE) { // Alert.alert("Camera Location:", '${cum.scroll.x},${cum.scroll.y} x ${cum.zoom}'); diff --git a/source/online/substates/RoomSettingsSubstate.hx b/source/online/substates/RoomSettingsSubstate.hx index 1ea4f45f..953b9dad 100644 --- a/source/online/substates/RoomSettingsSubstate.hx +++ b/source/online/substates/RoomSettingsSubstate.hx @@ -14,6 +14,8 @@ class RoomSettingsSubstate extends MusicBeatSubstate { var blurFilter:BlurFilter; var coolCam:FlxCamera; + var toggledSkins:Bool = false; + //options var skinSelect:Option; var gameOptions:Option; @@ -109,6 +111,19 @@ class RoomSettingsSubstate extends MusicBeatSubstate { }, 0, 80 * i, GameClient.room.state.hideGF)); hideGF.ID = i++; + var disableSkins:Option; + items.add(disableSkins = new Option("Disable Skins", "This will force chart characters.", () -> { + if (GameClient.hasPerms()) { + GameClient.send("toggleSkins"); + toggledSkins = true; + } + }, (elapsed) -> { + disableSkins.alpha = GameClient.hasPerms() ? 1 : 0.8; + + disableSkins.checked = GameClient.room.state.disableSkins; + }, 0, 80 * i, GameClient.room.state.disableSkins)); + disableSkins.ID = i++; + var prevCond:Int = -1; var winCondition:Option; items.add(winCondition = new Option("Win Condition", "...", () -> { @@ -153,9 +168,13 @@ class RoomSettingsSubstate extends MusicBeatSubstate { stageSelect.ID = i++; items.add(skinSelect = new Option("Select Skin", "Select your skin here!", () -> { - GameClient.clearOnMessage(); - LoadingState.loadAndSwitchState(new SkinsState()); - }, null, 0, 80 * i, false, true)); + if(!GameClient.room.state.disableSkins) { + GameClient.clearOnMessage(); + LoadingState.loadAndSwitchState(new SkinsState()); + } + }, (elapsed) -> { + skinSelect.alpha = !GameClient.room.state.disableSkins ? 1 : 0.8; + }, 0, 80 * i, false, true)); skinSelect.ID = i++; items.add(gameOptions = new Option("Game Options", "Open your game options here!", () -> { diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 9c9a2a19..904f0ccc 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -755,13 +755,15 @@ class PlayState extends MusicBeatState Mods.currentModDirectory = ""; if (GameClient.isConnected()) { - var roomDad = !GameClient.room.state.swagSides ? GameClient.room.state.player1 : GameClient.room.state.player2; - if (FileSystem.exists(Paths.mods(roomDad.skinMod))) { - if (roomDad.skinMod != null) - Mods.currentModDirectory = roomDad.skinMod; - - if (roomDad.skinName != null) - dad = new Character(0, 0, roomDad.skinName + skinsSuffix, !playsAsBF(), true); + if (!GameClient.room.state.disableSkins) { + var roomDad = !GameClient.room.state.swagSides ? GameClient.room.state.player1 : GameClient.room.state.player2; + if (FileSystem.exists(Paths.mods(roomDad.skinMod))) { + if (roomDad.skinMod != null) + Mods.currentModDirectory = roomDad.skinMod; + + if (roomDad.skinName != null) + dad = new Character(0, 0, roomDad.skinName + skinsSuffix, !playsAsBF(), true); + } } } else if (!playsAsBF() && ClientPrefs.data.modSkin != null) { @@ -788,13 +790,15 @@ class PlayState extends MusicBeatState Mods.currentModDirectory = ""; if (GameClient.isConnected()) { - var roomBf = !GameClient.room.state.swagSides ? GameClient.room.state.player2 : GameClient.room.state.player1; - if (FileSystem.exists(Paths.mods(roomBf.skinMod))) { - if (roomBf.skinMod != null) - Mods.currentModDirectory = roomBf.skinMod; - - if (roomBf.skinName != null) - boyfriend = new Character(0, 0, roomBf.skinName + skinsSuffix + "-player", playsAsBF(), true); + if (!GameClient.room.state.disableSkins) { + var roomBf = !GameClient.room.state.swagSides ? GameClient.room.state.player2 : GameClient.room.state.player1; + if (FileSystem.exists(Paths.mods(roomBf.skinMod))) { + if (roomBf.skinMod != null) + Mods.currentModDirectory = roomBf.skinMod; + + if (roomBf.skinName != null) + boyfriend = new Character(0, 0, roomBf.skinName + skinsSuffix + "-player", playsAsBF(), true); + } } } else if (playsAsBF() && ClientPrefs.data.modSkin != null) {