[MOD 0.12.x] The 8L Train Project v1.2.3 (Updated '16-05-01)

Topics and discussion about specific mods
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Jackalope_Gaming »

If 0.13 somehow breaks this mod then yes, I'll update it.
MONOmah_V
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Jan 29, 2015 3:28 am
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by MONOmah_V »

Jackielope wrote:I don't have a repository, though I am working on including graphics and such for other mods which so far is just using Photoshop to enlarge the sprite sheets. If I was really shooting for the stars I could make this into something like "The 8L Train Project" where I'd end up supporting as many train mods as I could.

What kinds of things would you (and others who can chip in their opinions) like to see in the repository?

Right now I'm learning how to do the conditional modding where my mod looks for another mod and then does some changes to make interactions work better.
I created repo for myself to mess around with code, but if you wish to do this right/your way, you can recreate it and I will create a fork. But this is lyrics.

You can see, what I've done with your mod. And I'm very open to suggestions about modding rules and style for Factorio.

I removed I think completely unnecessary extension and redefining of base cargo-wagon and locomotive. To achieve desired behavior it is sufficient to reassign required properties of entities (dynamic languages, yarrr).

I did not found a proper way to check inside mod/script whether some specific mods is installed, so I hardcoded Bob's mod's upgraded versions of railroad entities.
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Jackalope_Gaming »

This mod is the first time I've ever done lua programming, so forgive me if things aren't done as neatly as they could be. I only watched the video Klonan made and went straight from there.

Your comment has me thinking about whether it's better to have the entity files the way I did them or have them be reassigned like you've done. I'm a bit partial to having them still as their full entities so people can more easily fiddle with them on their own and understand what's going on, but I suppose a case can be made for the reassignment programming to also be something people can fiddle with and learn from.

And yeah, I haven't yet figured out how to have my mod check for other mods. I do know how to have it check for certain entities though such as FARL, but before I add FARL support into the public version of this mod I need to learn how to do the conditional dependencies so I can compare those methods and then get feedback on which one is easier for me to support other modders with, or for them to support me.
erro
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Mar 15, 2016 3:38 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by erro »

Hello.
Should i start the new game with this mod or i can use it on the existing save?
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Jackalope_Gaming »

erro wrote:Hello.
Should i start the new game with this mod or i can use it on the existing save?
The mod can be added to an existing save and it won't cause any problems other than you'll maybe have to redo train stations.
GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by GotLag »

Jackielope wrote:
erro wrote:Hello.
Should i start the new game with this mod or i can use it on the existing save?
The mod can be added to an existing save and it won't cause any problems other than you'll maybe have to redo train stations.
And re-place the trains.
Jackielope wrote:I don't have a repository, though I am working on including graphics and such for other mods which so far is just using Photoshop to enlarge the sprite sheets. If I was really shooting for the stars I could make this into something like "The 8L Train Project" where I'd end up supporting as many train mods as I could.

What kinds of things would you (and others who can chip in their opinions) like to see in the repository?

Right now I'm learning how to do the conditional modding where my mod looks for another mod and then does some changes to make interactions work better.
You don't need to change the sprites, you can set sprite scale in prototype definitions.

Here is a full re-implementation I created for my singleplayer game, with scaled sprites:
info.json
data.lua
entities.lua
Total size 1.5 kB, zipped.
Trev_lite
Inserter
Inserter
Posts: 43
Joined: Sat Mar 28, 2015 9:20 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Trev_lite »

Here is a copy for download.

License: talk to Jackielope and GotLag
Attachments
Train Length Fix_1.0.0.zip
Train Length Fix 1.0.0 by Jackielope and GotLag
Compiled by Trev_lite
(1.38 KiB) Downloaded 138 times
GotLag
Filter Inserter
Filter Inserter
Posts: 532
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by GotLag »

On further reflection, changing the selection boxes to {{-0.85, -4}, {0.85, 4}} on cargo wagons, locomotives and rail tankers may be a good idea. It makes it much easier to see where the ends of wagons are.
Trev_lite
Inserter
Inserter
Posts: 43
Joined: Sat Mar 28, 2015 9:20 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Trev_lite »

I made the changes.
Attachments
Train Length Fix_1.0.1.zip
(1.38 KiB) Downloaded 157 times
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x]Train position and length fix (updated 2016-2-13

Post by Jackalope_Gaming »

Trev_lite wrote:I made the changes.
GotLag wrote: You don't need to change the sprites, you can set sprite scale in prototype definitions.
(snip)
I was not aware of this. That will make things significantly easier.

Thanks to both of you it feels feasible to support every train mod. I have used the code Trev_lite made and added support for FARL, RailTanker, and Bob's Mods and made a GitHub repository at https://github.com/Jackalope-Gaming/8L- ... tag/v1.0.0.


I have renamed this mod "The 8L Train Project" now that I can fully support basically all other train mods pretty easily. Thanks again to both of you for providing a much better way of creating this mod.

Dammit, I made another Reddit thread and it used Buggi's avatar again when it should clearly be using my own...
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Jackalope_Gaming »

Update: I have added support for the More Locomotives mod.
Trev_lite
Inserter
Inserter
Posts: 43
Joined: Sat Mar 28, 2015 9:20 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Trev_lite »

the info.json and folder name have not been updated to 1.1.0
to get it to work for now you can just rename the mod to 1.0.0
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Jackalope_Gaming »

It's fixed now to be 1.1.0, and I've made a note to myself that it might not be the best thing to do two updates the same day. If I had remembered the More Locomotives mod existed before or while adding in support for the others this would be 1.0.0, but since I didn't and I want to go with the semantic versioning where the middle number is minor content updates it is now 1.1.0.
Blackraz0r
Inserter
Inserter
Posts: 49
Joined: Sun Dec 28, 2014 1:03 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Blackraz0r »

This should be vanilla...
Zanthras
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Mar 24, 2016 2:51 am
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Zanthras »

Doesnt quite work right in .29 it seems. The third cargo wagon wont start loading from its last spot until a 4th wagon is added.

copper sitting in chest not loading

4th car placed, copper loads
blackjackblk
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Mar 24, 2016 3:24 am
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by blackjackblk »

FYI, the current zipped folder includes a '-' before the version when it should be a '_'. This causes factorio to complain that the mod is not the expected version.
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Jackalope_Gaming »

Zanthras wrote:Doesnt quite work right in .29 it seems. The third cargo wagon wont start loading from its last spot until a 4th wagon is added.
This is a problem with the base game too. To test this in the base game set down one locomotive, then seven cargo wagons. The seventh one can't load at the end unless there's a wagon behind it.

It looks like it's a problem when the wagon ends on a whole number tile so to speak. Since that's the entire point of this mod, I don't know if it's possible for me to change it.

It might have been a change in .27 that caused this to be more pronounced. See viewtopic.php?f=3&t=21789 and viewtopic.php?t=19604.
blackjackblk wrote:FYI, the current zipped folder includes a '-' before the version when it should be a '_'. This causes factorio to complain that the mod is not the expected version.
I have fixed that here on the forums and on GitHub.
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Jackalope_Gaming »

Good news everyon! In the latest Friday Facts the devs wrote this:

These are to be finished:
...
* Redo of the train graphics and fixing the train distances, so they are whole tiles and vertical and horizontal distances are the same.


This will make my mod obsolete, which was actually one of my goals since the hope was the devs would make the trains be full tile lengths in the base game. Not only that, I didn't even dream that they'd decide to revisit their previous design choices about vertical train length being equal to horizontal train length. Wube Software, you guys are awesome!
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.1.0

Post by Jackalope_Gaming »

I have updated the mod to 1.2.0. The programming has once again been revamped, and support for Color Coding has been added.

This is likely to be the final version for this mod due to not finding other train mods I can support and the upcoming 0.13 train fixes in the official Factorio release that will incorporate the effects of my mod.
Meppi
Inserter
Inserter
Posts: 29
Joined: Thu Apr 07, 2016 2:57 pm
Contact:

Re: [MOD 0.12.x] The 8L Train Project v1.2.0 (Updated '16-03-26)

Post by Meppi »

Hey, i noticed the position of the cargo wagons is still a little off. I found out it is due to the position where the train stops at the station,
which is with a distance of 0.5 between the frontal joint and the center of the station.

If you change joint_distance to 5 and connection_distance to 3, on both locomotive and wagon, the wagons line up with the grid perfectly.
(connection_distance on the locomotive doesn't seem to do anything though)
You then also have to increase the collision_box to (-2.7 , 2.7) to fit the joints inside.


Here is the changed entities.lua:

Code: Select all

supported_wagons = {
    -- base game
    "cargo-wagon",

    -- Rail Tanker
    "rail-tanker",

    -- Bob's mods
    "cargo-wagon-2",
    "cargo-wagon-3",
    "armoured-cargo-wagon",
}

supported_locos = {
    -- base game
    "diesel-locomotive",

    -- FARL
    "farl",

    -- Bob's mods
    "diesel-locomotive-2",
    "diesel-locomotive-3",
    "armoured-diesel-locomotive",

    -- More Locomotives
    "cargo-locomotive",
    "hs-locomotive",

    -- Color-coding colored locos
    "diesel-locomotive-red",
    "diesel-locomotive-orange",
    "diesel-locomotive-yellow",
    "diesel-locomotive-green",
    "diesel-locomotive-cyan",
    "diesel-locomotive-blue",
    "diesel-locomotive-purple",
    "diesel-locomotive-magenta",
    "diesel-locomotive-white",
    "diesel-locomotive-black",
}


-- reconfigure all supported cargo wagons for 8L size
for i,name in ipairs(supported_wagons) do
    if  data.raw["cargo-wagon"][name] then
        data.raw["cargo-wagon"][name].collision_box = {{-0.6, -2.7}, {0.6, 2.7}}
        data.raw["cargo-wagon"][name].selection_box = {{-1, -4.5}, {1, 3}}
        data.raw["cargo-wagon"][name].connection_distance = 3
        data.raw["cargo-wagon"][name].joint_distance = 5
        data.raw["cargo-wagon"][name].pictures.scale = 1.09
        data.raw["cargo-wagon"][name].pictures.shift = {0.79, -0.55}
        if name == "rail-tanker" then
            -- picture scale and shift need to be overridden with these values for rail tanker
            data.raw["cargo-wagon"][name].pictures.scale = 1.08
            data.raw["cargo-wagon"][name].pictures.shift = {2.05, -0.60}
        end
    end
end

-- reconfigure all supported locos for 8L size
for i,name in ipairs(supported_locos) do
    if  data.raw["locomotive"][name] then
        data.raw["locomotive"][name].collision_box = {{-0.6, -2.7}, {0.6, 2.7}}
        data.raw["locomotive"][name].selection_box = {{-1, -4.5}, {1, 3}}
        data.raw["locomotive"][name].connection_distance = 3
        data.raw["locomotive"][name].joint_distance = 5
        data.raw["locomotive"][name].pictures.shift = {1.0, -0.5}
    end
end
Post Reply

Return to “Mods”