Skip to content

Commit

Permalink
abcdef
Browse files Browse the repository at this point in the history
  • Loading branch information
SpazElectro committed Sep 4, 2023
1 parent 810c4a7 commit 5b4c8ef
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 22 deletions.
26 changes: 7 additions & 19 deletions experiments/jj2livestream/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,14 @@ public static void Main(string[] args)
//wait for user to press ESC key
while (true)
{
// if (Console.ReadKey().Key == ConsoleKey.Escape)
// {
// //Disconnect and release resources
// jj2.Leave();
// jj2.Dispose();
// break;
// }

// get all pixels onto the screen and put into an array and send thro jj2.sendpluspacketstream
// byte[] pixels = ConvertToByteArray(CaptureScreen());
byte[] testBytes = new byte[5];
testBytes[0] = 1;
testBytes[1] = 2;
testBytes[2] = 3;
testBytes[3] = 4;
testBytes[4] = 5;

jj2.SendJJ2PlusNetworkStream(testBytes, 0);
if (Console.ReadKey().Key == ConsoleKey.Escape)
{
byte[] pixels = ConvertToByteArray(CaptureScreen());
Console.WriteLine("Pixels grabbed!");

jj2.SendJJ2PlusNetworkStream(pixels, 1);
}

System.Threading.Thread.Sleep(10000);
}
}

Expand Down
5 changes: 2 additions & 3 deletions mutators/livestream/STVlivestream.mut
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ void onLevelBegin() {
}

void onReceive(jjSTREAM &in packet, int clientID) {
uint8 type;
packet.pop(type);
jjConsole(""+type);
jjConsole("Packet received!");

}
65 changes: 65 additions & 0 deletions mutators/oldslope/STVoldslope.mut
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#pragma name "Toggle old slope physics"

bool stickyByDefault = false;
bool suppressSlopeCommand = true;

enum packetType { setSticky, getSticky };

void setSlopeSticky(bool sticky) {
jjPlayersStickToSlopes = sticky;

jjSTREAM packet;
packet.push(uint8(setSticky));
packet.push(sticky);

jjSendPacket(packet, 0);

if (jjIsServer)
jjConsole("> Slope sticking is now " + (sticky ? "on" : "off") + "!", true);
}

void onLevelLoad() {
if (jjIsServer)
jjPlayersStickToSlopes = stickyByDefault;
else {
jjSTREAM packet;
packet.push(uint8(getSticky));
jjSendPacket(packet, 0);
}
}

bool onLocalChat(string &in stringReceived, CHAT::Type chatType) {
if (stringReceived == "!slope on") {
setSlopeSticky(true);

return suppressSlopeCommand;
}

if (stringReceived == "!slope off") {
setSlopeSticky(false);

return suppressSlopeCommand;
}

return false;
}

void onReceive(jjSTREAM &in packet, int clientID) {
uint8 type;

if (packet.pop(type)) {
if (type == setSticky) {
bool stick;
if (packet.pop(stick))
setSlopeSticky(stick);
} else if (jjIsServer && type == getSticky) {
jjSTREAM newPacket;
newPacket.push(uint8(setSticky));
newPacket.push(jjPlayersStickToSlopes);

jjSendPacket(newPacket, clientID);
}
} else {
jjConsole("> Failed to pop packet from client #" + (clientID + 1) + " (one-indexed)");
}
}
34 changes: 34 additions & 0 deletions mutators/oldslope/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@echo off

REM Read variables from run.ini
for /f "tokens=1* delims==" %%a in ('type "..\..\run.ini" ^| find "="') do (
if /i "%%a"=="GAME_DIRECTORY" set "GAME_DIRECTORY=%%b"
if /i "%%a"=="GAME_NAME" set "GAME_NAME=%%b"
)

echo Copying files...
copy "../../scripts/" "%GAME_DIRECTORY%" /y
for %%i in (*.j2l *.j2as *.mut *.asc) do (
copy "%%i" "%GAME_DIRECTORY%" /y
)

set "J2L_LEVEL="
set "MUTATOR="

echo Starting
for %%i in (*.j2l) do (
set "J2L_LEVEL=%%i"
goto :check_mutator
)

:check_mutator
for %%i in (*.mut) do (
set "MUTATOR=-mutators=%%i"
goto :start_game
)

:start_game
if not defined J2L_LEVEL set "J2L_LEVEL=battle1"
"%GAME_DIRECTORY%%GAME_NAME%" -server %MUTATOR% %J2L_LEVEL% -battle
@echo on

0 comments on commit 5b4c8ef

Please sign in to comment.