[MOD 0.13.x] Shuttle Train v1.1.0

Topics and discussion about specific mods
simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by simwir »

zytukin wrote:A simple solution for calling the train could be a way to open the GUI from outside the train, if that is possible. Like a button at the top of your screen the same way blueprint flipper, fat controller, and many other mods do. Then you could just open it and call it to whatever station is closest to you. As it is now, one can use the fat controller to remotely access the train and send it to your location (I do this with a normal train already for personal transport) but accessing the engine from outside the train still has the unmodded station listing gui. Eliminating that step (and the requirement of the fat controller to do it) would make the mod far more versatile and appealing.
Yeah that would be a good way to do it, the only hard part is finding a train, should it be the one closest to you or should you be able to pick from a list? I will be looking in to the possibilities when i get time. :)
DofD wrote:Stations from the Smart Trains mod are not recognized as stations and as such are not listed ;)
Other than that it works flawlessly in MP ^^
Maybe you could include an option so smart stations/stations are displayed separate. This might reduce the clutter in the menu?!
I had not considered smart stops, i know why it does not recognize them, and i think i also know how to fix it, so the possibility will be there in the future. I have created a bug/feature request issue on the github so that i remember about it. I think that the clutter will be fixed by the filtering that others have suggested.

Glad to hear that you didn't experience any problems in multiplayer, and if any appear make sure to get back to me :D

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by StanFear »

Hey, I made a pull request for filtering station in the list

feel free to merge it or not, but maybe don't merge it if you don't understand what changes I made, well, unless you are not doing this to learn lua : :) but just to have a super fun mod !

anyways, if you don't understand something, just ask ! and if this is your baby and you don't want help (by that I mean someone that does the work instead of you), I get it :D

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by simwir »

StanFear wrote:Hey, I made a pull request for filtering station in the list

feel free to merge it or not, but maybe don't merge it if you don't understand what changes I made, well, unless you are not doing this to learn lua : :) but just to have a super fun mod !

anyways, if you don't understand something, just ask ! and if this is your baby and you don't want help (by that I mean someone that does the work instead of you), I get it :D
Hey thanks for the help :D I do however seem to have a bug when i use it :/ If I change page it returns to the 1st after a short time.

User avatar
Roktaal
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Sat Mar 26, 2016 6:42 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by Roktaal »

DofD wrote:So i uploaded the mod to my .29 headless client and started it up
it only shows 2 stations atm but i have more in my network
Not shure if it is releated to multiplayer but i guess. Will test more ;D

Cancel this. Stations from the Smart Trains mod are not recognized as stations and as such are not listed ;)
Other than that it works flawlessly in MP ^^

Cheers

Edit 987423 :
Maybe you could include an option so smart stations/stations are displayed separate. This might reduce the clutter in the menu?!
It must be something with MP and train stop ownership. In SP smart train stops are recognized without issues as seen on the following screenshot:
Image

Vas
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Tue Apr 12, 2016 11:02 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by Vas »

I was hoping we could get compatibility with bob's mods, the one that adds the additional tiers of trains. Your shuttle barely moves if I put two MK3 wagons on it. Was hoping for Shuttle MK2 and Shuttle MK3 that works the same as the ones in bob's mod.
viewtopic.php?f=51&t=6987

I was also hoping that as suggested before, we could get a filter to show train stations with either a specific name, or you could make a "Shuttle Stop" (Train stop) that will show up on the shuttle's menu instead of showing "all stops".
You can get my mods by clicking here, and use discussions there or PMs here to suggest or report issues.
Want some blueprints made by me? Click here then!

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by StanFear »

Vas wrote:I was also hoping that as suggested before, we could get a filter to show train stations with either a specific name, or you could make a "Shuttle Stop" (Train stop) that will show up on the shuttle's menu instead of showing "all stops".
It has been done, if you take the code from the github repository, you'll have the filter (I don't know why simwir didn't update the main post yet)
I have to say (because I made the update that added the filter) that I'm proud of how it works (on a UX perspective at least :))

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train 0.0.2

Post by simwir »

Vas wrote:I was hoping we could get compatibility with bob's mods, the one that adds the additional tiers of trains. Your shuttle barely moves if I put two MK3 wagons on it. Was hoping for Shuttle MK2 and Shuttle MK3 that works the same as the ones in bob's mod.
viewtopic.php?f=51&t=6987
I have added this as a feature request on the github, and will look into it at some point.
Vas wrote:I was also hoping that as suggested before, we could get a filter to show train stations with either a specific name, or you could make a "Shuttle Stop" (Train stop) that will show up on the shuttle's menu instead of showing "all stops".
StanFear is right this feature has been implementet (by himself) and will be in the next release, the only reason i have not yet updated the firstpost to include it is that i'm working on getting the call button in that release as well. But if you can't wait to get it, which I completely understand, I have put together a quick guide on how you can get the latest features from the github. You can read about that on my website

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.0

Post by simwir »

Version 1.0.0 is now out!
Featuring:
  • Station filtering
  • Alphabetically sorted train station list
  • Call button to get the train to come to you
The station filtering has been developed by Stanfear.
The sorting of the stations list has been developed by Roktaal

User avatar
DofD
Inserter
Inserter
Posts: 24
Joined: Thu Jun 18, 2015 10:16 am
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.0

Post by DofD »

Got something new for you ;)
Image

It seems to conflict with the [MOD 0.12.x] The 8L Train Project v1.2.2 (Updated '16-04-12). It doesnt crash without this mod ^^
Just a heads up for you to prevent further complications in the future :D

Cheers

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.0

Post by StanFear »

DofD wrote:Got something new for you ;)
log
It seems to conflict with the [MOD 0.12.x] The 8L Train Project v1.2.2 (Updated '16-04-12). It doesnt crash without this mod ^^
Just a heads up for you to prevent further complications in the future :D

Cheers
Is fixed in a current pull request, if you want to fix it manually while waiting for an official release, change line 48 in control lua from

Code: Select all

 if (player.vehicle == nil or player.vehicle ~= nil and player.vehicle.name ~= "shuttleTrain") and player.gui.top.shuttleTop == nil then
to

Code: Select all

 if (player.vehicle == nil or player.vehicle ~= nil and player.vehicle.name ~= "shuttleTrain") and player.gui.top.shuttleFrame == nil then

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by simwir »

Mod is now updated with the changes by Stanfear

Changelog
  • Fixed crash bug reported here
  • Fixed multiple shuttles being sent to stations with the same name
  • Fixed certain chars in statioins names would crash
  • Distance check is now done so that it's the train nearest the station not the player

User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by Jackalope_Gaming »

Is the Shuttle Train button on the top left supposed to show up before having researched Shuttle Trains? I recently added the mod to my list (and I'll also be supporting it with my 8L Train Project mod) so it has been brought into a map that has everything else researched. The button is also showing up on a save that has only just finished researching trains but hasn't built any yet.

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by simwir »

Jackielope wrote:Is the Shuttle Train button on the top left supposed to show up before having researched Shuttle Trains? I recently added the mod to my list (and I'll also be supporting it with my 8L Train Project mod) so it has been brought into a map that has everything else researched. The button is also showing up on a save that has only just finished researching trains but hasn't built any yet.
Well it's supposed to happen in the sense that there is no code to make it not happen. However I hope to in the future make is so that it does not happen.

I'm happy that you are adding support for my mod :D

User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by Jackalope_Gaming »

And thank you for making this mod! One thing I am really hoping can work with this is having a little electric monorail system or whatever that only transports the player character. Useful for going around the base.

I noticed you've got a bit of a problem in the code though: In the item.lua file you've got the stack size as 1. The vanilla game has locomotives stacking to 5. I've already changed the number in my own copy of your mod and that fixes the issue.

As for coding it so the button doesn't pop up until after the research is done, I'm not sure how to do it myself but I do know Choumiko and Outsider know how to do that since they both have mods that add a button on the top left after the mod has been researched. Choumiko has done work on YARM, FARL, SmartTrains, and TheFATController. Outsider has the Advanced Logistics Systems mod. Before directly asking them for some help it'd probably be worthwhile to dig through the coding to hopefully see what it would take to make the button only pop up after the research.

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by simwir »

Jackielope wrote:And thank you for making this mod! One thing I am really hoping can work with this is having a little electric monorail system or whatever that only transports the player character. Useful for going around the base.

I noticed you've got a bit of a problem in the code though: In the item.lua file you've got the stack size as 1. The vanilla game has locomotives stacking to 5. I've already changed the number in my own copy of your mod and that fixes the issue.

As for coding it so the button doesn't pop up until after the research is done, I'm not sure how to do it myself but I do know Choumiko and Outsider know how to do that since they both have mods that add a button on the top left after the mod has been researched. Choumiko has done work on YARM, FARL, SmartTrains, and TheFATController. Outsider has the Advanced Logistics Systems mod. Before directly asking them for some help it'd probably be worthwhile to dig through the coding to hopefully see what it would take to make the button only pop up after the research.
Thaks for letting me know about the tsack size of only 1, that was an oversight and has been fixed for next release :D

I will be sure to check out their code to see how they did it.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by StanFear »

simwir wrote: Thaks for letting me know about the tsack size of only 1, that was an oversight and has been fixed for next release :D

I will be sure to check out their code to see how they did it.
that's actually fairly easy : when creating the GUI, check if the player's force has the research complete (player.force.technologies["tech_name"].researched)
if it is not, just create the GUI for all players of the force when a tech is researched (using event on_research_finished)
You might have to do a little thinking if you want to handle player changing forces

User avatar
Roktaal
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Sat Mar 26, 2016 6:42 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by Roktaal »

Check my Mod Iconizer. It handles research in a fairly simple way altho it doesn't handle players changing force

simwir
Inserter
Inserter
Posts: 23
Joined: Wed Mar 16, 2016 7:24 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by simwir »

StanFear wrote:that's actually fairly easy : when creating the GUI, check if the player's force has the research complete (player.force.technologies["tech_name"].researched)
if it is not, just create the GUI for all players of the force when a tech is researched (using event on_research_finished)
You might have to do a little thinking if you want to handle player changing forces
I don't really know how forces work so that might be part og it, but i did try to check you are mentioning. In the branch Call Button on line 60 of the control.lua i run this check (it's in a comment but let's pretend)

Code: Select all

player.force.technologies["shuttleTrain_tech"].researched
But it keeps returning false even if the research is complete. If i run the console command:

Code: Select all

/c game.player.force.technologies["shuttleTrain_tech"].researched = true
It will show as researched in the research menu, but not enable the button :/
Roktaal wrote:Check my Mod Iconizer. It handles research in a fairly simple way altho it doesn't handle players changing force
Ok i will take a look at that :D

User avatar
Roktaal
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Sat Mar 26, 2016 6:42 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by Roktaal »

This is a simple solution:
I've added

Code: Select all

script.on_event(defines.events.on_research_finished, function(event)
	for player_index, player in pairs(game.players) do
		addPlayerGui(player, event.research.name)
	end
end)
and changed function addPlayerGui to

Code: Select all

function addPlayerGui(player, research_name)
    if (player.vehicle == nil or player.vehicle ~= nil and player.vehicle.name ~= "shuttleTrain") and player.gui.top.shuttleFrame == nil then
		if research_name == "shuttleTrain_tech" or player.force.technologies["shuttleTrain_tech"].researched then
			player.gui.top.add{type="frame", name="shuttleFrame", direction = "vertical"}
			player.gui.top.shuttleFrame.add{type="button", name="shuttleTop", style="st_top_image_button_style" }
		end
    end
end
This was enough to make the button appear only when the tech is researched.

...but my OCD kicked in :mrgreen: so I went further and removed the frame and redesigned button style. My personal preference is to avoid as much elements as possible so having only a button is better than having a button inside a frame, but thats my personal preference.

User avatar
StanFear
Fast Inserter
Fast Inserter
Posts: 236
Joined: Sun Dec 15, 2013 2:49 pm
Contact:

Re: [MOD 0.12.x] Shuttle Train v1.0.1

Post by StanFear »

Roktaal wrote:This is a simple solution:
I've added

Code: Select all

script.on_event(defines.events.on_research_finished, function(event)
	for player_index, player in pairs(game.players) do
		addPlayerGui(player, event.research.name)
	end
end)
and changed function addPlayerGui to

Code: Select all

function addPlayerGui(player, research_name)
    if (player.vehicle == nil or player.vehicle ~= nil and player.vehicle.name ~= "shuttleTrain") and player.gui.top.shuttleFrame == nil then
		if research_name == "shuttleTrain_tech" or player.force.technologies["shuttleTrain_tech"].researched then
			player.gui.top.add{type="frame", name="shuttleFrame", direction = "vertical"}
			player.gui.top.shuttleFrame.add{type="button", name="shuttleTop", style="st_top_image_button_style" }
		end
    end
end
This was enough to make the button appear only when the tech is researched.

...but my OCD kicked in :mrgreen: so I went further and removed the frame and redesigned button style. My personal preference is to avoid as much elements as possible so having only a button is better than having a button inside a frame, but thats my personal preference.
wow, this is overkill :)
first, here, you're adding the button to all player even those not in the force that did the research
seccound, instead of passing the tech name as a parameter, why don't you do the check in the on_research_finished ?

Post Reply

Return to “Mods”