Skip to content

Commit

Permalink
v0.2
Browse files Browse the repository at this point in the history
Added UI impovements on the client. I also added a basic config setting. I will not build it, so you must build it yourself. The config feature is untested.
  • Loading branch information
VirtualBrightPlayz committed Nov 16, 2018
1 parent 90a00e9 commit 9d34dfe
Show file tree
Hide file tree
Showing 37 changed files with 448 additions and 169 deletions.
5 changes: 4 additions & 1 deletion Mod8/Mod8.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Smod2;
using Smod2.Attributes;
using Smod2.Config;
using System.Net;
using System.Net.Sockets;

Expand Down Expand Up @@ -29,14 +30,16 @@ public override void OnEnable()
this.Info("Mod8 plugin enabled.");
this.Info("Connecting to node.js server");
tcp = new TcpClient();
tcp.Connect("127.0.0.1", 8080);
tcp.Connect(this.GetConfigString("tcpmapip"), this.GetConfigInt("tcpmapport"));
s = tcp.GetStream();
rm = new RoomManager();
}

public override void Register()
{
this.AddEventHandlers(new Mod8EventHandler(this));
this.AddConfig(new ConfigSetting("tcpmapport", 8080, SettingType.NUMERIC, true, "The TcpClient port"));
this.AddConfig(new ConfigSetting("tcpmapip", "127.0.0.1", SettingType.STRING, true, "The TcpClient ip"));
//this.AddCommand("pswd", new PasswordCmd(this));
}
}
Expand Down
103 changes: 3 additions & 100 deletions Mod8/Mod8EventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace VirtualBrightPlayz.SCPSL.Mod8
{
internal class Mod8EventHandler : IEventHandlerFixedUpdate, IEventHandlerRoundStart, IEventHandlerPlayerJoin, IEventHandlerDisconnect
internal class Mod8EventHandler : IEventHandlerFixedUpdate, IEventHandlerPlayerJoin, IEventHandlerDisconnect
{
private Plugin plugin;
private ImageGenerator img;
Expand Down Expand Up @@ -40,7 +40,7 @@ void IEventHandlerPlayerJoin.OnPlayerJoin(PlayerJoinEvent ev)
{
newkey += pswd[UnityEngine.Random.Range(0, pswd.Length)];
}
plugin.Info(ev.Player.IpAddress);
//plugin.Info(ev.Player.IpAddress);
conns.Add(ev.Player.IpAddress, ev.Player.SteamId);
keys.Add(ev.Player.SteamId, newkey);
ev.Player.SendConsoleMessage("Your SteamID is: " + ev.Player.SteamId);
Expand All @@ -54,7 +54,7 @@ void IEventHandlerDisconnect.OnDisconnect(DisconnectEvent ev)
foreach (var conn in conns)
{
bool hasfound = false;
plugin.Info(conn.Value);
//plugin.Info(conn.Value);
foreach (var item in plugin.Server.GetPlayers())
{
if (item.SteamId == conn.Value)
Expand All @@ -79,92 +79,13 @@ void IEventHandlerDisconnect.OnDisconnect(DisconnectEvent ev)

void IEventHandlerFixedUpdate.OnFixedUpdate(FixedUpdateEvent ev)
{
//plugin.Info(ServerTime.time.ToString());
pTime -= Time.fixedDeltaTime;
if (pTime < 0)
{
pTime = 1;
//plugin.Info(Math.Floor(Time.realtimeSinceStartup) + "running");
try
{
var mod8 = (Mod8)plugin;
//mod8.rm.
//Texture2D texure = new Texture2D(img.colorMap.Count * 5, img.colorMap.Count * 5);
/*img.GenerateMap(0);
string str = string.Empty;
str += " { ";
str += " \"rooms\": [ ";
var objs = img.colorMap;
for (int i = 0; i < objs.Count; i++)
{
var obj = objs[i];
str += " { ";
str += " \"posx\": \"" + obj.centerOffset.x.ToString() + "\", ";
str += " \"posy\": \"" + obj.centerOffset.y.ToString() + "\", ";
str += " \"posz\": \"" + obj.centerOffset.y.ToString() + "\", ";
str += " \"rotx\": \"" + obj.rotationY.ToString() + "\", ";
str += " \"roty\": \"" + obj.rotationY.ToString() + "\", ";
str += " \"rotz\": \"" + obj.rotationY.ToString() + "\", ";
str += " \"id\": \"" + obj.type.ToString() + "\" ";
if (i + 1 >= objs.Count)
{
str += " } ";
}
else
{
str += " }, ";
}
}
str += " ] ";
str += " } ";
str += ";";*/
/*foreach (var room in mod8.rm.rooms)
{
byte[] tex = ((Texture2D)room.icon.texture).EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../" + room.label + ".png", tex);
}*/

//plugin.Info(RemoteAdmin.QueryProcessor.Localplayer.NetworkServerRandom);
//plugin.Info(RemoteAdmin.QueryProcessor.Localplayer.ServerRandom);
//plugin.Info(RemoteAdmin.QueryProcessor.ServerStaticRandom);
if (!RandomSeedSync.generated)
{
/*plugin.Info("not generated");
var rss = PlayerManager.localPlayer.GetComponent<RandomSeedSync>();
img = (ImageGenerator)GameObject.FindObjectOfType(typeof(ImageGenerator));
//mod8.rm.GenerateMap(rss.Networkseed);
plugin.Info(img.GenerateMap(rss.Networkseed).ToString());
//plugin.Info(img.roomsOfType.Length.ToString());
foreach (var item in img.roomsOfType)
{
foreach (var item2 in item.roomsOfType)
{
plugin.Info(item2.label);
plugin.Info(item2.type.ToString());
/*var tex = (Texture2D)item2.iconMinimap;
var bytes = tex.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/../" + item2.label + ".png", bytes);*
}
}*/
}

/*var lczRooms = GameObject.Find("LightRooms").transform;
foreach (Transform room in lczRooms)
{
plugin.Info(room.gameObject.name);
}
plugin.Info(lczRooms.childCount.ToString());*/

//var local = PlayerManager.localPlayer.GetComponents<Component>();
/*plugin.Info(local.Length.ToString());
foreach (var comp in local)
{
plugin.Info(comp.GetType().ToString());
}*/

//plugin.Info(img.availableRooms.Count.ToString());

string str = string.Empty;
str += " { ";
Expand Down Expand Up @@ -282,32 +203,14 @@ void IEventHandlerFixedUpdate.OnFixedUpdate(FixedUpdateEvent ev)
str += ";";
ASCIIEncoding asen = new ASCIIEncoding();
byte[] ba = asen.GetBytes(str);
//plugin.Info("Transmitting.....");

mod8.s.Write(ba, 0, ba.Length);
/*foreach (var room in rooms)
{
plugin.Info(room.readonlyPoint.position.ToString());
}*/
}
catch (Exception e)
{
plugin.Info(e.Message);
}
}
}

void IEventHandlerRoundStart.OnRoundStart(RoundStartEvent ev)
{
Mod8 mod8 = (Mod8)plugin;
/*foreach (var item in PlayerManager.localPlayer.GetComponents<Component>())
{
File.AppendAllText(Application.dataPath + "/../file.txt", item.GetType().ToString() + '\n');
}
foreach (GameObject item in GameObject.FindObjectsOfType(typeof(GameObject)))
{
File.AppendAllText(Application.dataPath + "/../file69.txt", item.name + '\n');
}*/
}
}
}
Binary file added Mod8Server/public/049.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/096.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/106.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/173.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/372.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/914.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Mod8Server/public/Airlock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Armory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Cafe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Checkpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Chkp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/ClassD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/CollapsedTunnel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Endoof.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/GateA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/GateB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/HID.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Intercom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Lift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions Mod8Server/public/Root_914.svg

This file was deleted.

3 changes: 0 additions & 3 deletions Mod8Server/public/Root_Chkp.svg

This file was deleted.

3 changes: 0 additions & 3 deletions Mod8Server/public/Root_Crossing.svg

This file was deleted.

3 changes: 0 additions & 3 deletions Mod8Server/public/Root_Straight.svg

This file was deleted.

3 changes: 0 additions & 3 deletions Mod8Server/public/Root_Troom.svg

This file was deleted.

Binary file added Mod8Server/public/Servers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Mod8Server/public/Shelter.png
Binary file added Mod8Server/public/Testroom.png
Binary file added Mod8Server/public/Vent.png
Binary file added Mod8Server/public/WC.png
3 changes: 3 additions & 0 deletions Mod8Server/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title>SCP: SL MiniMap</title>
<script src="/socket.io/socket.io.js" charset="utf-8"></script>
<script src="translate.js" charset="utf-8"></script>
<script src="map.js" charset="utf-8"></script>
<style media="screen">
html, body, canvas {
Expand Down Expand Up @@ -95,6 +96,8 @@
<input id="key" type="text" placeholder="Key..."></input><br>
<button id="submit" onclick="login();">Submit Key (if blank, you might only be able to see rooms!)</button><br>
<button id="cookies" onclick="toggleSavedCookies();">Delete/Save SteamID in cookies</button>
<br>
<a href="https://github.com/VirtualBrightPlayz/scpslminimap"><button><h3>GitHub</h3></button></a>
</div>
</body>
</html>
Loading

0 comments on commit 9d34dfe

Please sign in to comment.