Jump to content

[1.12.4] SimpleLogistics! (SLOG) v2.0.6.0 - `<Supply & Demand>` [29 Dec 2022]


zer0Kerbal

Recommended Posts

5 minutes ago, zer0Kerbal said:

thank you.

I believe it does - code is elegant and well written - @RealGecko did good code. :D

uses:


if (FlightGlobals.ActiveVessel.situation != Vessel.Situations.LANDED) {}

 

Sorry, bad explanation on my part. While the code is correct, the situation reported by KSP may not be.

It used to be, that when loading a vessel in the flight scene for the first time, regardless of whether that vessel had launched the situation would be Vessel.Situations.Prelaunch. Staging the vessel then properly set the situation (this is why you sometimes have to stage twice when loading a vessel).

Actually, that's easily tested... leave it with me, I'll do a quick test and run the debugger, see what it says, and report back.

Edited by severedsolo
Link to comment
Share on other sites

Just now, severedsolo said:

Sorry, bad explanation on my part. While the code is correct, the situation reported by KSP may not be.

It used to be, that when loading a vessel in the flight scene for the first time, regardless of whether that vessel had launched the situation would be Vessel.Situations.Prelaunch. Staging the vessel then properly set the code (this is why you sometimes have to stage twice when loading a vessel).

Actually, that's easily tested... leave it with me, I'll do a quick test and run the debugger, see what it says, and report back.

thank you!

open to almost all PR's. :D

 

Now if only could find someone to update the GUI...

Link to comment
Share on other sites

12 minutes ago, zer0Kerbal said:

thank you!

open to almost all PR's

Looks like that's been fixed (or never affected landed vessels), Situation was correctly reporting as Landed when switching back.

Is it intentional that you could be careening around the surface at 200m/s and have the logistics running? (there's no speed check).

Edited by severedsolo
Link to comment
Share on other sites

46 minutes ago, severedsolo said:

Looks like that's been fixed (or never affected landed vessels), Situation was correctly reporting as Landed when switching back.

good to know, and thanks for checking.

46 minutes ago, severedsolo said:

Is it intentional that you could be careening around the surface at 200m/s and have the logistics running? (there's no speed check).

I think it was/is intentional; if I was a better coder I would add an option to the game settings menu (I can add the game settings menu/option/difficulty settings anything more, not so much) to enable/disable movement.

difficulty settings would control how far; currently all vessels in physics range (IIRC) - so about 2.5km.

but that is for another day. :D

Link to comment
Share on other sites

Ah, thank you. This mod looks to "hit the spot." I've been doing a game with progressive colonization, which I'm mostly liking fairly well. But resupplying my bases with snacks was being awkward. Its built-in resource transfer mechanism is a bit heavy handed all or nothing. Once left the crew of my resupply mission with no snacks to get home on. I had been trying KAS for the purpose; it works, but is awkward. Simple Logistics looks much.... simpler. I had the misfortune to first try it yesterday. Couldn't get the UI to come up at all and I found a hundred megabyte log file full of errors. A bit of pawing around uncovered the texture files with the wrong type.... which got fixed today. Now it works.

Hmm. In addition to resupply missions, it occurs to me that this could allow me to make use of my tier0 base after it is obsolete and would otherwise be scrapped. If I plunk my tier 1 base down nearby, I can still use the abandoned tier 0 one to supplement the storage and power generation. I'll see how that works, but it seems like a plan.

Link to comment
Share on other sites

4 hours ago, rmaine said:

which got fixed today. Now it works.

*sheepish grin* sorry 'bout that. not enough Jeb's Coffee.

4 hours ago, rmaine said:

supplement the storage and power generation

yes, anything that has the basic ability to be a controllable vessel now can act as auxiliary storage - as long as it is landed. :) /YMMV/

happy provisioning! it's loading day!

ps: there has always been talk about what to do with used fuel tanks in NASA and others....

Edited by zer0Kerbal
Link to comment
Share on other sites

14 minutes ago, linuxgurugamer said:

Is the range configurable?  In other words, is there a way to only include vessels within 100 metere rather than 2.5km?

at this moment - no. range is determined by physics range (if I am understanding the code).

However, I believe that with a little code it can be limited like that. it is one my long term stretch goals. Adding the settings/difficulty code is simple (thanks to you)..

should be just adding an additional condition in this code (&& closer than double rangeLimit)

Spoiler

		private void FixedUpdate() {
			// Find all resources in the network
			partResources.Clear ();
			foreach (Vessel vessel in FlightGlobals.VesselsLoaded) {
				if (vessel.situation != Vessel.Situations.LANDED)
					continue;

				LogisticsModule lm = vessel.FindPartModuleImplementing<LogisticsModule> ();
				if (lm != null)
				if (!lm.IsActive)
					continue;
				
				foreach (Part part in vessel.parts) {
					if (part.State == PartStates.DEAD)
						continue;
					
					foreach (PartResource resource in part.Resources) {
						if (resource.info.resourceTransferMode == ResourceTransferMode.NONE ||
							resource._flowMode == PartResource.FlowMode.None ||
							!resource._flowState)
							continue;
						
						partResources.Add (resource);
					}
				}
			}

using this with a tank locker (like one of your mods) might also present some interesting game play options.

I also like the suggestion above concerning speed < maxSpeed as a gameplay option ( @severedsolo ) . (see wiki for full ideas/wishlist)

continuing with what @severedsolo suggested, " Vessel.Situations.PRELAUNCH Vessel.Situations.SPLASHED" should be added (with option to disable in settings) since I can see valid gameplay options especially with EL...

Edited by zer0Kerbal
Link to comment
Share on other sites

2 minutes ago, zer0Kerbal said:

I just don't know how to find the distance (straight line) from the current vessel to the the vessel being queried. something like vessel.rangeto...

https://github.com/severedsolo/AllAboard/blob/e0d460fbe86117d89640a0fbdb3124f707386ca6/AllAboard/ModuleDockingPortAirlock.cs#L46

(Obviously ignore the angle stuff, and this is looking from a part to a vessel, but the basic idea is the same)

Edited by severedsolo
Link to comment
Share on other sites

very stretch goal:

cleverbobcatResources has some real cool code for drawing a line (or highlighting an area) showing resource transfers.

including: focused transfer, area transfer, line-of-sight, LoR (loss-over-range (efficiency))

 

10 minutes ago, severedsolo said:

https://github.com/severedsolo/AllAboard/blob/e0d460fbe86117d89640a0fbdb3124f707386ca6/AllAboard/ModuleDockingPortAirlock.cs#L46

(Obviously ignore the angle stuff, and this is looking from a part to a vessel, but the basic idea is the same)

nice. thank you.

rough in coding

Spoiler

        public bool InRange(Vessel vessel)
        {
            Transform partTransform = part.transform;
            Vector3 directionToTarget = partTransform.position - kerbalOnEva.vessel.transform.position;
            double angle = Vector3.Angle(GetPortDirection(), directionToTarget);
            double distance = directionToTarget.magnitude;

            Dbg("Angle " + angle);
            Dbg("Range " + distance);

            // if (Mathf.Abs(angle) < 35 && distance < range) return true;
	    if (distance < range) return true;
            return false;
        }

 

that should get it 90% of the way. keeping the angle for future jic.

Edited by zer0Kerbal
Link to comment
Share on other sites

@zer0Kerbal - you may already know this, but just to explain what the code is doing.

By subtracting the two Vector3's from each other, you create a Vector that "points" between the two objects. Then Vector3.magnitude gives you the distance (in this case it's measured in meters, but it doesn't have to be)

Edited by severedsolo
Link to comment
Share on other sites

@zer0Kerbal While it might be nice to also say that the from/to for transferring resources must be within a certain altitude of each other, I don't really think that's necessary.

My issue was transferring resources from 2.5km on one side to 2.5km on the other side.  I can live with a much smaller sphere and just hand-wave the resource transfer.

You may also want to consider a blacklist of resources that can't be transferred.  For example, EC, Ore, liquid hydrogen, etc

Link to comment
Share on other sites

10 hours ago, vardicd said:

@zer0Kerbal Since installing the new version of the mod, I haven't had a single crash on vessel recovery, and just moving the plane down the runway a distance allowed me to use the logistics as normal, so that was the source of the other issue i had. 

glad to hear that!

 

 

ad hoc, ergo promptus hoc:

am looking at adding vessel.situation - prelaunch and splashed as optional conditions that allow SL to function.

Link to comment
Share on other sites

1 hour ago, slaintemaith said:

Re: Original post.

*dependencies 

I know.  I'm that guy.

I was going to post the same correction. Did a quick Google to make sure I didn't have it wrong. (I *hate* it when I post a correction and it turns out that my correction is wrong. :-(). Hmm. It's more complicated than I thought. Though the "e" spelling is generally preferred in modern American English, apparently the "a" spelling was used in the past and still in some contexts in British English... or something like that. So I decided to just keep my mouth (well, fingers) shut, even though the "a" spelling still looks jarring to me. :-)

Link to comment
Share on other sites

4 hours ago, slaintemaith said:

dependencies 

thank you. noticed it on other related postings, and thought I had swashed the typo everywhere... guess not.

Done.

3 hours ago, rmaine said:

I was going to post the same correction. Did a quick Google to make sure I didn't have it wrong. (I *hate* it when I post a correction and it turns out that my correction is wrong. :-(). Hmm. It's more complicated than I thought. Though the "e" spelling is generally preferred in modern American English, apparently the "a" spelling was used in the past and still in some contexts in British English... or something like that. So I decided to just keep my mouth (well, fingers) shut, even though the "a" spelling still looks jarring to me. :-)

I blame my oops on spending too much time corresponding with friends who use Her Majesty's English.

Link to comment
Share on other sites

 

Version 2.0.3.0.3 for Kerbal Space Program 1.8.1

Released on 2020-01-26

SimpleLogistics version 2.0.3.0.3KSP 1.8.xCKAN listedSoftware License GPLv3NonSoftware License CC 4.0 BY-NC-SA

Version 2.0.3.0.3 - Verbunden? - Branché? - プラグインしましたか?

  • Netzwerk für Logistics
  • Added localization for German (de-de.cfg) (thank you @malanok1)
  • Réseau logistique
  • Added localization for French (fr-fr.cfg) (translate.google.com)
  • 物流ネットワーク
  • Added localization for Japanese (jp.cfg) (translate.google.com)
  • SimpleLogistics now speaks six languages (Ch-De-En-Es-Fr-Jp)

    Kerbal Space Program 1.8.1
    Unity 2019.2.2f1
    .NET Framework 4.8

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...