RB Fog

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
I would love to, but I still have no time response on the server side xd, at the moment I have this:

C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RustBuster2016Server;
using Fougerite;  

namespace ClientCom
{
    public class ClientCom : Fougerite.Module

    {     
        public override string Author
        {
            get { return "Salva"; }
        }

        public override string Name
        {
            get { return "ClientCom"; }
        }

        public override Version Version
        {
            get { return new Version("1.0"); }
        }

        public override string Description
        {
            get { return "ClientCom"; }
        }

        public override void DeInitialize()
        {
            API.OnRustBusterUserMessage -= On_MessageReceived;
        }

        public override void Initialize()
        {        
            API.OnRustBusterUserMessage += On_MessageReceived;
        }

        public void On_MessageReceived(API.RustBusterUserAPI user, Message msgc)
        {     
            if (msgc.PluginSender == "FogPlugin")
            {         
                string msg = msgc.MessageByClient;                           
                if (msg == "ServerTime")
                {
                    string actualtime = World.GetWorld().Time.ToString();
                    msgc.ReturnMessage = actualtime;
                }
          
            }
        }
    }
}
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using RustBuster2016.API;
using UnityEngine;

namespace FogPlugin
{
  
    public class Test : RustBusterPlugin
    {
        public static string Time;
        public MainGUI test;
        private static GameObject Load;

        public override string Name
        {
            get { return "FogPlugin"; }
        }

        public override string Author
        {
            get { return "Salva"; }
        }

        public override Version Version
        {
            get { return new Version("1.0"); }
        }

        public override void DeInitialize()
        {         
            if (Load != null) UnityEngine.Object.Destroy(Load);
        }

        public override void Initialize()
        {
            if (this.IsConnectedToAServer)
            {                   
                string answer = this.SendMessageToServer("ServerTime");
                Time = answer;                          
                Load = new GameObject();                 
                test = Load.AddComponent<MainGUI>();
                UnityEngine.Object.DontDestroyOnLoad(Load);                                 
               
            }
            UnityEngine.Debug.Log("Loaded!");
        }
    }
}
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace FogPlugin
{
    public class MainGUI : MonoBehaviour
    {     
        public void OnGUI()
        {
          
            GUI.Box(new Rect(10, 10, 100, 90), "Time" + Test.Time);
            if (GUI.Button(new Rect(20, 40, 80, 20), " "))
            {

            }
        }
    }
}
 
Last edited:

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,066
4,435
113
At your house.
github.com
I would love to, but I still have no time response on the server side xd, at the moment I have this:

C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RustBuster2016Server;
using Fougerite;

namespace ClientCom
{
    public class ClientCom : Fougerite.Module

    {   
        public override string Author
        {
            get { return "Salva"; }
        }

        public override string Name
        {
            get { return "ClientCom"; }
        }

        public override Version Version
        {
            get { return new Version("1.0"); }
        }

        public override string Description
        {
            get { return "ClientCom"; }
        }

        public override void DeInitialize()
        {
            API.OnRustBusterUserMessage -= On_MessageReceived;
        }

        public override void Initialize()
        {      
            API.OnRustBusterUserMessage += On_MessageReceived;
        }

        public void On_MessageReceived(API.RustBusterUserAPI user, Message msgc)
        {   
            if (msgc.PluginSender == "FogPlugin")
            {       
                string msg = msgc.MessageByClient;                         
                if (msg == "ServerTime")
                {
                    string actualtime = World.GetWorld().Time.ToString();
                    msgc.ReturnMessage = actualtime;
                }
        
            }
        }
    }
}
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using RustBuster2016.API;
using UnityEngine;

namespace FogPlugin
{

    public class Test : RustBusterPlugin
    {
        public static string Time;
        public MainGUI test;
        private static GameObject Load;

        public override string Name
        {
            get { return "FogPlugin"; }
        }

        public override string Author
        {
            get { return "Salva"; }
        }

        public override Version Version
        {
            get { return new Version("1.0"); }
        }

        public override void DeInitialize()
        {       
            if (Load != null) UnityEngine.Object.Destroy(Load);
        }

        public override void Initialize()
        {
            if (this.IsConnectedToAServer)
            {                 
                string answer = this.SendMessageToServer("ServerTime");
                Time = answer;                        
                Load = new GameObject();               
                test = Load.AddComponent<MainGUI>();
                UnityEngine.Object.DontDestroyOnLoad(Load);                               
             
            }
            UnityEngine.Debug.Log("Loaded!");
        }
    }
}
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace FogPlugin
{
    public class MainGUI : MonoBehaviour
    {   
        public void OnGUI()
        {
        
            GUI.Box(new Rect(10, 10, 100, 90), "Time" + Test.Time);
            if (GUI.Button(new Rect(20, 40, 80, 20), " "))
            {

            }
        }
    }
}
I was talking about the screenshot not the code :p

 

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
Ups sorry!!

C#:
RenderSettings.fog = true;
RenderSettings.fogColor = Color.white;
RenderSettings.fogDensity = 0.1f;
RenderSettings.fogMode = FogMode.Exponential;
Camera.main.clearFlags = CameraClearFlags.Depth;
Camera.main.backgroundColor = new Color(0f, 0f, 0f, 0.02f);
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,066
4,435
113
At your house.
github.com
Ups sorry!!

C#:
RenderSettings.fog = true;
RenderSettings.fogColor = Color.white;
RenderSettings.fogDensity = 0.1f;
RenderSettings.fogMode = FogMode.Exponential;
Camera.main.clearFlags = CameraClearFlags.Depth;
Camera.main.backgroundColor = new Color(0f, 0f, 0f, 0.02f);
I was talking about the screenshot, not the code :p

But doesn't matter now, thanks for sharing.
 

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
My idea is to create an environment of ascending fog and automatic descending, but still I have not got the time (which explains at the beginning of the thread), any help is welcome, greetings
 
  • Like
Reactions: Mehran

xandeturf

Moderator
Moderator
Nov 4, 2015
132
25
28
34
Nice, this week I was studying the addition of new objects, I hope this weekend can, haha. Let's show what RustBuster can do!
 

xandeturf

Moderator
Moderator
Nov 4, 2015
132
25
28
34
my script FPS+ i not time to publish plugin.
C#:
  //btn fps+
            if (GUI.Button(new Rect(3, 3, 113, 18), "FPS+", buttonStyle))
            {
                if (!loadDefault)
                {
                    heightmapPixelError = Terrain.activeTerrain.heightmapPixelError;
                    detailObjectDistance = Terrain.activeTerrain.detailObjectDistance;
                    treeDistance = Terrain.activeTerrain.treeDistance;
                    treeMaximumFullLODCount = Terrain.activeTerrain.treeMaximumFullLODCount;
                    loadDefault = true;
                }

                if (fpsBoostActive)
                {
                    Terrain.activeTerrain.heightmapPixelError = heightmapPixelError;
                    Terrain.activeTerrain.detailObjectDistance = detailObjectDistance;
                    Terrain.activeTerrain.treeDistance = treeDistance;
                    Terrain.activeTerrain.treeMaximumFullLODCount = treeMaximumFullLODCount;
                    fpsBoostActive = false;
                }
                else
                {
                    Terrain.activeTerrain.heightmapPixelError = 110;
                    Terrain.activeTerrain.detailObjectDistance = 0;
                    Terrain.activeTerrain.treeDistance = 225;
                    Terrain.activeTerrain.treeMaximumFullLODCount = 0;
                    fpsBoostActive = true;
                }
            }
 
  • Like
Reactions: Assassin and salva

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
Yes, I know, my pc stinks of shit.

 

Pompeyo

Plugin Developer
Plugin Developer
Jan 6, 2018
87
236
33
43
Cuba
I really would like to be able to achieve this on my server, I wonder, if these changes are included in the rustbuster?
or should I use a plugin ??
thanks for the help, and sorry for my bad english
 

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
I really would like to be able to achieve this on my server, I wonder, if these changes are included in the rustbuster?
or should I use a plugin ??
thanks for the help, and sorry for my bad english

Yes ... obviously as you see above ... the code was already published, it is done through a plugin that is not public ... if you have programming knowledge you can do it without problems, otherwise ... .if you really need it I can compile and publish it, greetings
 
  • Like
Reactions: Pompeyo

Pompeyo

Plugin Developer
Plugin Developer
Jan 6, 2018
87
236
33
43
Cuba
@salva
205/5000
More or less I have a programming base, I will try to do it with the codes published above, anyway a little help would not be bad, if you could do it, I would really appreciate it, regards!
 

salva

Friendly self-taught developer
Administrator
Jan 31, 2016
576
606
63
@salva
205/5000
More or less I have a programming base, I will try to do it with the codes published above, anyway a little help would not be bad, if you could do it, I would really appreciate it, regards!
Yes, I have it done on my server, but in a much more complex and tedious way ... the code above is only the tip of the iceberg, I will try to do something simple if I get some free time these days
 
  • Like
Reactions: samvds