#Silly mod makin

1 messages · Page 1 of 1 (latest)

kindred briar
#

I making silly mod

severe wedge
#

6 minutes for a single steel plate woah

kindred briar
#

so true

rich agate
#

gregtech moment?

soft isle
#

I've always dreamed of GTNH being remade in factorio

kindred briar
kindred briar
soft isle
#

something that'd be cool if you do decide to do more about this is trying to implement multiblocks in some way

#

so like machines that have modular parts you can swap out

#

either by placing things or as like modules you can add to it, idk how that would work with allowing new recipes though

kindred briar
#

yeah id prob try do that

#

as yk

#

EBF is pretty early on in gtnh

#

im mostly still learning how factorio api works and making a tool to use

kindred briar
#

I made a very silly thingie in C#

#

its able to turn this c# code at runtime

#
m.Data += delegate()
{
    var fireArmor = (ArmorPrototype)table.deepcopy(data.raw["armor"]["heavy-armor"]); // copy the table that defines the heavy armor item into the fireArmor variable
    fireArmor.name = "fire-armor";
    fireArmor.icons =
    [
        new(){
        icon = fireArmor.icon,
        icon_size = fireArmor.icon_size,
        tint =  new(){r = 1, g = 0, b = 0, a = 0.3f} },
    ];
    fireArmor.resistances =
    [
        new(){
        type = new("physical"),
        decrease = 6,
        percent = 10
        },
        new(){
        type =  new("explosion"),
        decrease = 10,
        percent = 30
        },
        new(){
        type =  new("acid"),
        decrease = 5,
        percent = 30
        },
        new(){
        type =  new("fire"),
        decrease = 0,
        percent = 100
        }
    ];
    // create the recipe prototype from scratch
    var recipe = new RecipePrototype()
    {
        type = "recipe",
        name = "fire-armor",
        enabled = true,
        energy_required = 8, // time to craft in seconds (at crafting speed 1)
        ingredients =
        [
            (IngredientPrototype)new ItemIngredientPrototype() { name = new("copper-plate"), amount = 200 },
            (IngredientPrototype)new ItemIngredientPrototype() { name = new("steel-plate"), amount = 50 }
        ],
        results = [(ProductPrototype)new ItemProductPrototype(){name =new("fire-armor"), amount = 1}]
    };
    data.extend([fireArmor, recipe]);
};
#

into

#
local v_0 = table.deepcopy(data.raw["armor"]["heavy-armor"])
v_0.name = "fire-armor"
v_0.icons = {{icon = v_0.icon, icon_size = v_0.icon_size, tint = {r = 1, g = 0, b = 0, a = 0,3}}}
v_0.resistances = {{type = "physical", decrease = 6, percent = 10}, {type = "explosion", decrease = 10, percent = 30}, {type = "acid", decrease = 5, percent = 30}, {type = "fire", decrease = 0, percent = 100}}
local v_2 = {}
v_2.type = "recipe"
v_2.name = "fire-armor"
v_2.enabled = true
v_2.energy_required = 8
v_2.ingredients = {{name = "copper-plate", amount = 200, type = "item"}, {name = "steel-plate", amount = 50, type = "item"}}
v_2.results = {{name = "fire-armor", amount = 1, type = "item"}}
local v_1 = v_2
data.extend({v_0, v_1})

#

that took a couple days and idk why i made it, but like, why not:3

#

is cool

#

theres still a bit of stuff i need to implement

#

like loops and what not

#

oh and yeah the types are also generated from the wiki

#

its not ideal i still need to fix some stuff

kindred briar
soft isle
#

what does the code do though?

kindred briar
#

which code?

#

but made via c#

#

so its strongly typed and is just something i like more

kindred briar
#

made loops and conditions work

#
    for (int i = 0; i < 8; i++)
    {
        recipe.energy_required+=1;
    }

gets turned into

v_3 = 0
goto _593_
::_632_::
v_1.energy_required = v_1.energy_required + 1
v_3 = v_3 + 1
::_593_::
v_4 = v_3 < 8
if  (v_4) then
    goto _632_
end
#

yeah i used goto's instead of lua's for loop

#

deal with it

#

that allowed me to not make specifically a foor loop parsing, and just be done using a if parsing :P

soft isle
#

hmmm i don't nkow how to code but if this were to actually happen I could try helping with art, I have some ability in it I think

kindred briar
#

yea

kindred briar