1. Post #281
    Gold Member
    ContiX's Avatar
    May 2008
    1,373 Posts
    It basically replaces the name with a number when its being sent to the client to greatly reduce the amount of data sent.
    Does it really make that much of a difference between 86 and "Asteroid Ore" in sending data? Isn't it a matter of 1 KB vs 2 KB or something? That's hardly a difference...

  2. Post #282
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    It helps to reduce lag, it's not really about the amount of data sent. Every little bit helps, it's far cheaper to send a small packet than a larger one. It's only one byte where the name would be ten or so bytes (number of characters +1)

  3. Post #283
    Gold Member
    ContiX's Avatar
    May 2008
    1,373 Posts
    Isn't that more like painting your car black so it'll absorb more light and thus be less impeded by the numerous photons bouncing around? I can't think that it would honestly help that much...

  4. Post #284
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    Okies DONE :)

    Is it ok for it to be done during InitPostEntity?
    Yeah

    Edited:

    Isn't that more like painting your car black so it'll absorb more light and thus be less impeded by the numerous photons bouncing around? I can't think that it would honestly help that much...
    As I said, every little bit helps
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1 (list)

  5. Post #285
    mbainrot's Avatar
    August 2008
    178 Posts
    What is the easiest and best way to add a custom storage?

    I tried creating my own entity and I am having no luck. It registers and what not but won't receive the asteroid_ore when the laser is firing SupplyResource("asteroid_ore",100)

    edit: nerver mind :P I got it working

    Gotta have a file under "EnvironmentsRD\lua\environments\lifesupport" which contains
    Code:
    Environments.RegisterResource("asteroid_ore")
    Environments.RegisterLSStorage("Asteroid Ore Storage", "env_asteroid_ore2", {[3600] = "asteroid_ore"}, 4084, 400, 300)
    Environments.RegisterDevice("Storages", "Resource Cache", "Large Ore Storage", "env_asteroid_ore2", "models/Slyfo/t-eng.mdl")
    and Environments does all the hard work :)

    edit2:
    You can also add your other stuff so it shows up in the stool and looks neater without the need for a pain in the ass custom stool

    edit3:
    After further testing I found that CmdrMatthew has made it really easy :)
    In your custom addon create the following folder structure
    YourAddon
    - lua
    -- environments
    --- lifesupport

    Basically when EntRegister.lua is run, at line 652 there is a loop that illiterates through all addon's lua folders looking for "environments/lifesupport/*.lua" and then pcall's "include" and "AddCSLuaFile" thus making your life as a developer easier. :)

    I will do up some quick instructions on how to add custom devices/storages to Environments
    Reply With Quote Edit / Delete Reply Windows 7 Australia Show Events Friendly Friendly x 1 (list)

  6. Post #286
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    The latest update is now out. It has some major bugfixes and feature improvements, including duping of cables, data syncing on join is now (hopefully) fixed, and files are more neatly organized.

  7. Post #287
    (User was banned for this post ("Reaction image"))
    Holt!'s Avatar
    September 2011
    4,024 Posts
    Im Getting a couple of errors with this. Mainly some blue Lua Errors on the side relating to nil value or something.

    Edited:

    Filename: CAF_Hooks, Message: Think3 Error: [addons\sb3\lua\entities\base_sb_environment\init.l ua:496] attempt to compare number with nil

    See if you make any sense out of that.

  8. Post #288
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    Im Getting a couple of errors with this. Mainly some blue Lua Errors on the side relating to nil value or something.

    Edited:

    Filename: CAF_Hooks, Message: Think3 Error: [addons\sb3\lua\entities\base_sb_environment\init.l ua:496] attempt to compare number with nil

    See if you make any sense out of that.
    Looks like you forgot to remove SB3. That file shouldn't even exist.

  9. Post #289
    BoxMonster's Avatar
    July 2008
    186 Posts
    Is CAF necessary for Environments?

  10. Post #290
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    Is CAF necessary for Environments?
    Nope. If you have errors with it not installed though, please tell me, it means I missed something and need to fix it.

  11. Post #291
    mbainrot's Avatar
    August 2008
    178 Posts
    There are a few errors that happen due to missing models, it might be worth listing all the depends so people know what they need

    I have the following and its relatively quiet (odd error when i do something arbituary like blow up a power plant, etc)
    - SBEP (all inc weapons to be sure)
    - SB Dev models (http://sbdevmodels.googlecode.com/svn/trunk/) -- Be careful when checking out... allot of it is raw models not compiled MDLs

  12. Post #292
    (User was banned for this post ("Reaction image"))
    Holt!'s Avatar
    September 2011
    4,024 Posts
    There are a few errors that happen due to missing models, it might be worth listing all the depends so people know what they need

    I have the following and its relatively quiet (odd error when i do something arbituary like blow up a power plant, etc)
    - SBEP (all inc weapons to be sure)
    - SB Dev models (http://sbdevmodels.googlecode.com/svn/trunk/) -- Be careful when checking out... allot of it is raw models not compiled MDLs
    You don't have lifesupport entities.

  13. Post #293
    BoxMonster's Avatar
    July 2008
    186 Posts
    I'm currently having an issue in sb_omen_v2 ( http://www.garrysmod.org/downloads/?a=view&id=123405 ) where, on the spawn planet, I lose health as if there's no oxygen whenever I take off my helmet, and putting the helmet on slowly drains oxygen in the same way. But I used the atmospheric probe, and all the gas levels and such were totally normal... Not sure what caused it, either. Everything is up to date, too.

  14. Post #294
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    I'm currently having an issue in sb_omen_v2 ( http://www.garrysmod.org/downloads/?a=view&id=123405 ) where, on the spawn planet, I lose health as if there's no oxygen whenever I take off my helmet, and putting the helmet on slowly drains oxygen in the same way. But I used the atmospheric probe, and all the gas levels and such were totally normal... Not sure what caused it, either. Everything is up to date, too.
    Try and clear out your data/environments folder and restart, or completely reload from map with the admin menu.

  15. Post #295
    mbainrot's Avatar
    August 2008
    178 Posts
    You don't have lifesupport entities.
    I don't have ls entities (as in the CAF'd version) and it works using the models included in the repo.

    I wrote a little C# program that lists all the models referenced by lua files in a folder...

    I am gonna prolly take some time in developing a repository of known addons that contain xyz models so that this little widget of mine can say "right, these are the models in use, these are the addons known to contain said models"

    These are all the models used in environments/environmentsRD
    Code:
    models/SBEP_community/d12airscrubber.mdl
    models/props_canal/canal_bridge03a.mdl
    models/props_canal/canal_bridge03b.mdl
    models/props_canal/canal_bridge03c.mdl
    models/props_lab/tpplugholder_single.mdl
    models/props_lab/tpplug.mdl
    models/player/charple01.mdl
    models/punisher239/punisher239_reactor_small.mdl
    models/ce_ls3additional/fusion_generator/fusion_generator_huge.mdl
    models/ce_ls3additional/fusion_generator/fusion_generator_large.mdl
    models/ce_ls3additional/fusion_generator/fusion_generator_medium.mdl
    models/ce_ls3additional/fusion_generator/fusion_generator_small.mdl
    models/Punisher239/punisher239_reactor_small.mdl
    models/Punisher239/punisher239_reactor_big.mdl
    models/ce_ls3additional/solar_generator/solar_generator_c_huge.mdl
    models/ce_ls3additional/solar_generator/solar_generator_c_large.mdl
    models/ce_ls3additional/solar_generator/solar_generator_c_medium.mdl
    models/ce_ls3additional/solar_generator/solar_generator_giant.mdl
    models/ce_ls3additional/solar_generator/solar_generator_huge.mdl
    models/ce_ls3additional/solar_generator/solar_generator_large.mdl
    models/ce_ls3additional/solar_generator/solar_generator_medium.mdl
    models/chipstiks_ls3_models/LargeH2OPump/largeh2opump.mdl
    models/props_phx/life_support/gen_water.mdl
    models/ce_ls3additional/compressor/compressor.mdl
    models/props_outland/generator_static01a.mdl
    models/ce_ls3additional/water_air_extractor/water_air_extractor.mdl
    models/Slyfo/electrolysis_gen.mdl
    models/ce_ls3additional/water_heater/water_heater.mdl
    models/props/de_nuke/storagetank.mdl
    models/ce_ls3additional/resource_tanks/resource_tank_large.mdl
    models/ce_ls3additional/resource_tanks/resource_tank_medium.mdl
    models/ce_ls3additional/resource_tanks/resource_tank_small.mdl
    models/ce_ls3additional/resource_tanks/resource_tank_tiny.mdl
    models/props_phx/life_support/battery_large.mdl
    models/props_phx/life_support/battery_medium.mdl
    models/props_phx/life_support/battery_small.mdl
    models/props_c17/substation_stripebox01a.mdl
    models/props_c17/substation_transformer01a.mdl
    models/props_wasteland/coolingtank02.mdl
    models/props_phx/life_support/canister_large.mdl
    models/props_phx/life_support/canister_medium.mdl
    models/props_phx/life_support/canister_small.mdl
    models/chipstiks_ls3_models/LargeSteamTank/largesteamtank.mdl
    models/ce_ls3additional/resource_cache/resource_cache_large.mdl
    models/ce_ls3additional/resource_cache/resource_cache_medium.mdl
    models/ce_ls3additional/resource_cache/resource_cache_small.mdl
    models/props_combine/combine_emitter01.mdl
    models/props_combine/combine_mine01.mdl
    models/Slyfo/t-eng.mdl
    models/props_phx/life_support/crylaser_small.mdl
    models/Slyfo_2/miscequipmentradiodish.mdl
    models/Spacebuild/Nova/recieverdish.mdl
    models/props_wasteland/panel_leverBase001a.mdl
    models/Environments_Node.mdl
    models/props_canal/rock_riverbed02c.mdl
    models//props_debris/concrete_spawnchunk001a.mdl
    models//props_debris/concrete_spawnchunk001b.mdl
    models//props_debris/concrete_spawnchunk001c.mdl
    models//props_debris/concrete_spawnchunk001d.mdl
    models//props_debris/concrete_spawnchunk001e.mdl
    models//props_debris/concrete_spawnchunk001f.mdl
    models//props_debris/concrete_spawnchunk001g.mdl
    models//props_debris/concrete_spawnchunk001h.mdl
    models//props_debris/concrete_spawnchunk001i.mdl
    models//props_debris/concrete_spawnchunk001j.mdl
    models//props_debris/concrete_spawnchunk001k.mdl
    models/props_wasteland/rockcliff01g.mdl
    models/props_wasteland/rockgranite01c.mdl
    models/props_wasteland/rockgranite04b.mdl
    models/props_wasteland/rockcliff01c.mdl
    models/props_wasteland/rockcliff01j.mdl
    models/props_wasteland/rockgranite02a.mdl
    models/props_wasteland/rockcliff01e.mdl
    models/props_wasteland/rockgranite01a.mdl
    models/props_wasteland/rockgranite03c.mdl
    models/props_wasteland/rockcliff01b.mdl
    models/props_wasteland/rockcliff01f.mdl
    models/props_wasteland/rockgranite01b.mdl
    models/props_junk/watermelon01.mdl
    models/props_wasteland/rockgranite04c.mdl
    models/ce_ls3additional/plants/plantfull.mdl
    models/slyfo/cup_noodle.mdl
    models/player/combine_super_soldier.mdl
    models/SBEP Player Models/bluehevsuit.mdl
    models/SBEP Player Models/orangehevsuit.mdl
    models/SBEP Player Models/redhevsuit.mdl
    models/Combine_Soldier_PrisonGuard.mdl
    models/Combine_Soldier.mdl
    models/Combine_Helicopter/helicopter_bomb01.mdl
    models/player/barney.mdl
    models/Slyfo_2/mmu_mk_1.mdl
    models/props_phx/construct/glass/glass_curve90x1.mdl
    Code for the little program is here :), note this was written in MS VS 2010 using .NET 3.0 framework not sure if code will work in previous versions of the framework.
    form1.cs
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    using System.IO;
    
    namespace GarrysModDependancyFinder
    {
        public partial class Form1 : Form
        {
            private delegate void ThreadSafeCall(String msg);
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                folderBrowserDialog1.ShowDialog();
    
                textBox1.Text = folderBrowserDialog1.SelectedPath;
            }
    
            private void RecurseFolder(String path)
            {
                String[] files = Directory.GetFiles(path);
    
                foreach (String file in files)
                {
                    if (file.Contains(".lua"))
                    {
                        ProcessFile(file);
                    }
                    
                    Application.DoEvents();
                }
    
                String[] folders = Directory.GetDirectories(path);
    
                foreach (String folder in folders)
                {
                    RecurseFolder(folder);
                    Application.DoEvents();
                }
            }
    
            private void ProcessFile(String file)
            {
                StreamReader fs = new StreamReader(file);
    
                while (fs.EndOfStream == false)
                {
                    String line = fs.ReadLine();
    
                    if (line.Contains(".mdl"))
                    {
                        handleLine(line);
                    }
                }
    
                fs.Close();
            }
    
            private void handleLine(String line)
            {
                line = line.Substring(0, line.IndexOf(".mdl\"")+4);
                line = line.Substring(line.LastIndexOf("\"")+1);
    
                if(!listBox1.Items.Contains(line))
                    AppendList(line);
            }
    
            private void AppendList(String item)
            {
                if (this.listBox1.InvokeRequired)
                {
                    ThreadSafeCall tsc = new ThreadSafeCall(AppendList);
                    this.listBox1.Invoke(tsc, item);
                }
                else
                {
                    this.listBox1.Items.Add(item);
                }
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
    
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                RecurseFolder(textBox1.Text);
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                textBox2.Text = "";
                foreach (String item in listBox1.Items)
                {
                    textBox2.Text += item + "\r\n";
                }
            }
        }
    }
    form1.designer.cs
    Code:
    namespace GarrysModDependancyFinder
    {
        partial class Form1
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
    
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
    
            #region Windows Form Designer generated code
    
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.label1 = new System.Windows.Forms.Label();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.button1 = new System.Windows.Forms.Button();
                this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
                this.button2 = new System.Windows.Forms.Button();
                this.listBox1 = new System.Windows.Forms.ListBox();
                this.button3 = new System.Windows.Forms.Button();
                this.textBox2 = new System.Windows.Forms.TextBox();
                this.SuspendLayout();
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(13, 13);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(29, 13);
                this.label1.TabIndex = 0;
                this.label1.Text = "Path";
                // 
                // textBox1
                // 
                this.textBox1.Location = new System.Drawing.Point(54, 10);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(224, 20);
                this.textBox1.TabIndex = 1;
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(284, 8);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 2;
                this.button1.Text = "Find folder";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // button2
                // 
                this.button2.Location = new System.Drawing.Point(365, 8);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(137, 23);
                this.button2.TabIndex = 3;
                this.button2.Text = "List all refences to mdls";
                this.button2.UseVisualStyleBackColor = true;
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // listBox1
                // 
                this.listBox1.FormattingEnabled = true;
                this.listBox1.Location = new System.Drawing.Point(23, 54);
                this.listBox1.Name = "listBox1";
                this.listBox1.Size = new System.Drawing.Size(578, 290);
                this.listBox1.TabIndex = 4;
                // 
                // button3
                // 
                this.button3.Location = new System.Drawing.Point(516, 361);
                this.button3.Name = "button3";
                this.button3.Size = new System.Drawing.Size(75, 23);
                this.button3.TabIndex = 5;
                this.button3.Text = "Spew items to text area";
                this.button3.UseVisualStyleBackColor = true;
                this.button3.Click += new System.EventHandler(this.button3_Click);
                // 
                // textBox2
                // 
                this.textBox2.Location = new System.Drawing.Point(33, 358);
                this.textBox2.Multiline = true;
                this.textBox2.Name = "textBox2";
                this.textBox2.ReadOnly = true;
                this.textBox2.Size = new System.Drawing.Size(379, 44);
                this.textBox2.TabIndex = 6;
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(641, 415);
                this.Controls.Add(this.textBox2);
                this.Controls.Add(this.button3);
                this.Controls.Add(this.listBox1);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.label1);
                this.Name = "Form1";
                this.Text = "Garry\'s Mod Dependancy Finder";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            #endregion
    
            private System.Windows.Forms.Label label1;
            private System.Windows.Forms.TextBox textBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
            private System.Windows.Forms.Button button2;
            private System.Windows.Forms.ListBox listBox1;
            private System.Windows.Forms.Button button3;
            private System.Windows.Forms.TextBox textBox2;
        }
    }
    You can use the code for what ever you want on the provisio if released it is open source and you give attribution for the parts of my code used :)

    Yes it's missing the error catching... this is a developer tool not a tool for nublets with random button clicking tendencies.

  16. Post #296
    endorphinsam's Avatar
    January 2010
    3,563 Posts
    a bunch of confusing stuph that I wont ever know what it means saddowns

    I wish lua wasn't so complicated. I want to learn it. but like, spoon feedi-I mean, putting food in the spoon and forcing it down my throat-feeding.

  17. Post #297
    mbainrot's Avatar
    August 2008
    178 Posts
    I wish lua wasn't so complicated. I want to learn it. but like, spoon feedi-I mean, putting food in the spoon and forcing it down my throat-feeding.
    It's basically a program looking for any string which is in double quotes (") and has .mdl in it :)

    .mdl is the extension for models.

    edit: lua is easy :), C++ is a nightmare :). Though I can code in C, C#, PHP, GarrysMod Lua, shell, ms batch.

  18. Post #298
    Gold Member
    LemONPLaNE's Avatar
    January 2008
    3,612 Posts
    I wish lua wasn't so complicated. I want to learn it. but like, spoon feedi-I mean, putting food in the spoon and forcing it down my throat-feeding.
    Lua is piss easy. The only language that's easier to learn is Python.

    Also, @mbainrot, nothing hard about C++. You just need to memorize it.

  19. Post #299
    endorphinsam's Avatar
    January 2010
    3,563 Posts
    It's basically a program looking for any string which is in double quotes (") and has .mdl in it :)

    .mdl is the extension for models.

    edit: lua is easy :), C++ is a nightmare :). Though I can code in C, C#, PHP, GarrysMod Lua, shell, ms batch.
    Whatever you just said I'm sure was a waste of time because I don't know what it means.

  20. Post #300
    mbainrot's Avatar
    August 2008
    178 Posts
    Lua is piss easy. The only language that's easier to learn is Python.

    Also, @mbainrot, nothing hard about C++. You just need to memorize it.
    It's the memory crap that does my head in :| having to alloc memory etc to avoid crashes.

    Anyway getting the thread back on topic :)

    Here is how to create an addon that adds a new storage device to Environments :) (Better documentation then my previous post)
    1) Create your basic addon (as in create the info.txt and "lua" folder)
    2) Go into the command prompt (In Windows 7 it's Start -> Run, then "cmd")
    3) Navigate to your garry's mod addons folder.
    For x64 users
    Code:
    cd C:\Program Files (x86)\Steam\steamapps\<steam username>\garrysmod\garrysmod\addons
    For 32 bit users
    Code:
    cd C:\Program Files\Steam\steamapps\<steam username>\garrysmod\garrysmod\addons
    4) move into your addon (in this tutorial it will be "example_env_addon")
    5) run the following command (this is the easiest way of creating the directory structure needed)
    Code:
    mkdir lua\environments\lifesupport
    6) Then run the following command
    Code:
    tree
    What "tree" does is spits out the directory structure allowing you to verify that you have done everything correctly (see the bellow screenshot)


    7) Create a file with a meaningful name in the "lua/environments/lifesupport" directory. In this example I will call it env_example_storage.lua
    8) Open up the file you created in step 7 in your favorite text editor (I personally use Notepad++ as it is free and has syntax highlighting) and drop the following text inside
    Code:
    Environments.RegisterResource("some random resource")
    
    Environments.RegisterLSStorage("My Random Storage", "env_random_storage", {[3600] = "some random resource"}, 4084, 400, 300)
    Environments.RegisterDevice("Storages", "Random Storage", "My Random Storage", "env_random_storage", "models/Slyfo/t-eng.mdl")
    Quick explanation of what these fields do (of the ones I know of anyway)
    Environments.RegisterResource("some random resource")
    This adds the resource to the system so any traffic involving the resource is sent as a number instead of a string... This is good because it reduces traffic on your server.

    Environments.RegisterLSStorage("My Random Storage", "env_random_storage", {[3600] = "some random resource"}, 4084, 400, 300)
    As the command suggests, it creates the "entity".
    First Argument: Human Readable name
    Second Argument: the ""class"" of the device, this can be either something you have made up (and thus unique) or an existing class (such as one you made)
    Third argument: is a list, I am not 100% sure what the number means but in order for the resource to register in a multi-resource storage device this number must be unique. CmdrMatthew could you please clarify exactly what the number does?
    Forth Argument: is listed as basevolume. This prolly has something todo with the amount of goo you can store in your tank
    Fifth Argument: is the base health of the storage. This determines how much abuse the storage can take before it goes pop
    Sixth Argument: is the base mass of the storage. E.g. how heavy it is.

    Environments.RegisterDevice("Storages", "Random Storage", "My Random Storage", "env_random_storage", "models/Slyfo/t-eng.mdl")
    This command tells environments to add the storage to the derma menu allowing the player to spawn it without l33t hax
    First Argument: This is what category the device lives under the "Life Support" category in the "Environments" tab
    Second Argument: This is what category the device lives under in the First Argument's category, e.g. for storage, it would be what category under the storage context
    Third Argument: This is the human readable name
    Forth Argument: This is the class of the entity you specified in the previous command.
    Fifth Argument: This is the model the object will spawn with. Note that you can have any number devices that are mechanically identical but have different models and will appear as separate devices.

    So there you go, that's how you create your own custom storage.

    So have fun and happy resourcing :)

  21. Post #301
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    Third argument: is a list, I am not 100% sure what the number means but in order for the resource to register in a multi-resource storage device this number must be unique. CmdrMatthew could you please clarify exactly what the number does?
    That number is the multiplier for how much of that resource can be put in that object. It is multiplied by the (model's volume)/(basevolume) to get how much can be stored of that resource. I need to get the table switched around so you can have multiple resources with the same multiplier. ex. {["steam"] = 3600}

  22. Post #302
    Gold Member
    LemONPLaNE's Avatar
    January 2008
    3,612 Posts
    That number is the multiplier for how much of that resource can be put in that object. It is multiplied by the (model's volume)/(basevolume) to get how much can be stored of that resource. I need to get the table switched around so you can have multiple resources with the same multiplier. ex. {["steam"] = 3600}
    PLEASE tell me you're planning to round the final number off so that I don't have to see "Oxygen tank: 21353568634574676358/6678569672685673746783567847852".

    2 500 000 is a valid amount of storage. 2 536 043 isn't.
    Reply With Quote Edit / Delete Reply Windows 7 Sweden Show Events Agree Agree x 1 (list)

  23. Post #303
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    PLEASE tell me you're planning to round the final number off so that I don't have to see "Oxygen tank: 21353568634574676358/6678569672685673746783567847852".

    2 500 000 is a valid amount of storage. 2 536 043 isn't.
    Well, if you could tell me how to do that (in Lua) I could. The only method I can think of is pretty bad, and involves strings....
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Friendly Friendly x 1 (list)

  24. Post #304
    Gold Member
    LemONPLaNE's Avatar
    January 2008
    3,612 Posts
    Well, if you could tell me how to do that (in Lua) I could. The only method I can think of is pretty bad, and involves strings....
    Code:
    function roundToNearest(n,magnitude){
        return int(round(n/magnitude)*magnitude)
    }
    The syntax is more pseudo-C++ than Lua, but I'm pretty sure there's a round function there somewhere, right?
    It's not the neatest thing ever, but at least the end result will look nice.

    Edited:

    Obviously, you need to add some special cases and long number detection.

    This Python program seems to do the trick, only skewing the result slightly when going into negatives:

    Code:
    def roundToNearest(n,mag):
        if len(str(abs(n)))>=10:return "Number too large"
        elif mag==0: return 0
        elif abs(n)<=abs(mag): return 0
        else:
            return int(round(n/mag)*mag)
    
    _______________________________________________________________________________
    
    >>> roundToNearest(2346467356,100000)
    'Number too large'
    >>> roundToNearest(2569246,10000)
    2560000
    >>> roundToNearest(2569246,100000)
    2500000
    >>> roundToNearest(-2569246,100000)
    -2600000
    This is, for the record, how my programming looks at 7AM after not getting any sleep. Don't bash me :(
    Reply With Quote Edit / Delete Reply Windows 7 Sweden Show Events Lua Helper Lua Helper x 1 (list)

  25. Post #305
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    That just rounds it. -snip-

    EDIT: Figured it out,
    local pow = math.ceil(math.log(num)/math.log(10))
    gives me the number of places the number has. Ex. 100 has 3, 50000 has 5. I then use this with math.Round().
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Winner Winner x 1Lua King Lua King x 1 (list)

  26. Post #306
    mbainrot's Avatar
    August 2008
    178 Posts
    That just rounds it. -snip-

    EDIT: Figure it out,
    local pow = math.ceil(math.log(num)/math.log(10))
    gives me the number of places the number has. Ex. 100 has 3, 50000 has 5. I then use this with math.Round().
    Very nicely done :)

    Edited:

    Oh there is an error that occurs when someone nukes a planet (e.g. using the GigaFish with gcombat)
    Timer Error: [addons\environments\lua\environments\core\sv_envir onments.lua:463] attempt to call method 'IsStar' (a nil value)

  27. Post #307

    May 2011
    14 Posts
    The hud is not displaying correctly seems to be like my screen is zoomed in, could be caused by of these errors that appear when i connect to my srcd
    Timer Error: [@addons\envcore\lua\environments\spacesuits\sv_sui t.lua:108] Tried to use a NULL entity!
    Timer Error: [@addons\envcore\lua\environments\core\sv_environme nts.lua:795] Tried to use a NULL entity!
    Timer Error: [@addons\envcore\lua\environments\core\sv_environme nts_players.lua:387] Tried to use a NULL entity!

  28. Post #308
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    The hud is not displaying correctly seems to be like my screen is zoomed in, could be caused by of these errors that appear when i connect to my srcd
    Timer Error: [@addons\envcore\lua\environments\spacesuits\sv_sui t.lua:108] Tried to use a NULL entity!
    Timer Error: [@addons\envcore\lua\environments\core\sv_environme nts.lua:795] Tried to use a NULL entity!
    Timer Error: [@addons\envcore\lua\environments\core\sv_environme nts_players.lua:387] Tried to use a NULL entity!
    None of those lines you gave me match up with anything I have. Try updating? Or tell me the code on those lines.

  29. Post #309
    Gold Member
    viperfan7's Avatar
    November 2007
    3,613 Posts
    well I think the helmet is broken for wide screen resolutions, what its doing is that its using the overlay used for non widescreen, but not stretching it

  30. Post #310
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    well I think the helmet is broken for wide screen resolutions, what its doing is that its using the overlay used for non widescreen, but not stretching it
    Yeah, go to the environments toolmenu tab, then settings. Use the bottom six sliders to adjust it to your screen. Quite a few people were complaining about resolutions not working (ones that my screen wouldnt go to) that I made a manual setup.

  31. Post #311
    Gold Member
    viperfan7's Avatar
    November 2007
    3,613 Posts
    oh kk, awesome, didn't realize it, oh and would it be possible to add a compass to the bottom of the helmet HUD?

  32. Post #312
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    oh kk, awesome, didn't realize it, oh and would it be possible to add a compass to the bottom of the helmet HUD?
    What would it point to?
    Also, does anyone have any ideas on anything new to add? I am making a new map especially for this addon, so basically the sky is the limit with your ideas.

  33. Post #313
    Gold Member
    viperfan7's Avatar
    November 2007
    3,613 Posts
    What would it point to?
    Also, does anyone have any ideas on anything new to add? I making a new map especially for this addon, so basically the sky is the limit with your ideas.
    well, it would use the same system that depthHUD inline uses, or you can have it so that it points the the center of the last atmosphere entered

  34. Post #314
    MrGman590's Avatar
    June 2010
    23 Posts
    Hey, you should add a change log. :D I always love seeing what devs have added, changed, removed or fixed.

    Edit: Also, how well does this work with the Gravity Hull Designator (GHD)?

  35. Post #315
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    Hey, you should add a change log. :D I always love seeing what devs have added, changed, removed or fixed.

    Edit: Also, how well does this work with the Gravity Hull Designator (GHD)?
    It works perfectly as far as I know. The change log is the svn, it tells you the changes made each update.

  36. Post #316
    MrGman590's Avatar
    June 2010
    23 Posts
    It works perfectly as far as I know. The change log is the svn, it tells you the changes made each update.
    Ah, thanks. Is there support for 1440x900? Because when I look at the cool HUD on that resolution, I can't see the temperature of the atmosphere, only the label...

  37. Post #317
    SB2DevTeam's Avatar
    September 2007
    384 Posts
    Ah, thanks. Is there support for 1440x900? Because when I look at the cool HUD on that resolution, I can't see the temperature of the atmosphere, only the label...
    Yeah, go to the environments toolmenu tab, then settings. Use the bottom six sliders to adjust it to your screen. Quite a few people were complaining about resolutions not working (ones that my screen wouldnt go to) that I made a manual setup.
    Reply With Quote Edit / Delete Reply Windows 7 Belgium Show Events Friendly Friendly x 1 (list)

  38. Post #318
    Gold Member
    viperfan7's Avatar
    November 2007
    3,613 Posts
    oh about the HUD config thing, it causes issues in pods, where I have it set up for 1920*1080, it loks fine out of pods, but when you hop in it cuts the top off, and that it dosn't save the values I set, so I have to change them every time I play


    never mind the saving thing, I'm an idiot
    Reply With Quote Edit / Delete Reply Windows 7 Canada Show Events Agree Agree x 1 (list)

  39. Post #319
    CmdrMatthew's Avatar
    August 2010
    1,179 Posts
    oh about the HUD config thing, it causes issues in pods, where I have it set up for 1920*1080, it loks fine out of pods, but when you hop in it cuts the top off, and that it dosn't save the values I set, so I have to change them every time I play
    Well, I need values from people about the proper settings for in and out of vehicles, at many resolutions. So once I get alot of them, I cant make it entirely automatic.

  40. Post #320
    Gold Member
    viperfan7's Avatar
    November 2007
    3,613 Posts
    kk, well, for mine, its been looking quite nice at 1.46 for both X-Y scales, and the Z scale is 1.8, I leave the offsets alone, while in pods I cannot change the offsets, but I leave the X-Y scales the same and set the Z scale to 1.45


    oh I also thought of a new feature, make it so that players can name the planets themselves, clientside, that way instead of a number it'll show a name for the planet, yet no extra data would be transmitted between the server and client since the names would be chosen by the client, it would also add to the exploration feeling of the game
    Reply With Quote Edit / Delete Reply Windows 7 Canada Show Events Agree Agree x 1 (list)