Page 2 of 4

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

Posted: Tue Mar 01, 2016 2:49 am
by Jackalope_Gaming
If 0.13 somehow breaks this mod then yes, I'll update it.

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

Posted: Tue Mar 01, 2016 8:08 pm
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.

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

Posted: Wed Mar 02, 2016 1:47 am
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.

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

Posted: Fri Mar 18, 2016 5:09 pm
by erro
Hello.
Should i start the new game with this mod or i can use it on the existing save?

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

Posted: Fri Mar 18, 2016 9:26 pm
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.

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

Posted: Sat Mar 19, 2016 4:38 am
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.

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

Posted: Sat Mar 19, 2016 7:18 am
by Trev_lite
Here is a copy for download.

License: talk to Jackielope and GotLag

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

Posted: Sat Mar 19, 2016 11:25 am
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.

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

Posted: Sat Mar 19, 2016 12:35 pm
by Trev_lite
I made the changes.

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

Posted: Sat Mar 19, 2016 6:46 pm
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...

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

Posted: Sat Mar 19, 2016 10:36 pm
by Jackalope_Gaming
Update: I have added support for the More Locomotives mod.

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

Posted: Sun Mar 20, 2016 5:38 am
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

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

Posted: Sun Mar 20, 2016 6:22 am
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.

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

Posted: Mon Mar 21, 2016 3:43 pm
by Blackraz0r
This should be vanilla...

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

Posted: Thu Mar 24, 2016 3:02 am
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

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

Posted: Thu Mar 24, 2016 3:26 am
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.

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

Posted: Thu Mar 24, 2016 4:14 pm
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.

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

Posted: Fri Mar 25, 2016 5:48 pm
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!

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

Posted: Sat Mar 26, 2016 10:56 pm
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.

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

Posted: Fri Apr 08, 2016 1:24 pm
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