Arachnids, would you like to know more...? Data.raw function replacement help!

Place to get help with not working mods / modding interface.
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

Hello, im trying to make a mod to replace base biter appearance with Arachnids from starship troopers. I am a 3d/2d artist so the artistic part is easy (still tweaking the textures, speed , etc, this is a wip) and i have someone that is taking care of the rig/animation. But im not a coder, aldo im logic and resourceful and i have a minimum of understanding in the dark art of programming but still, I come here to seek help :' )

Image

Image

https://www.youtube.com/watch?v=YIoEntu ... sletMaxime

here is the current code

Code: Select all

require ("util")


small_biter_scale = 0.9
small_biter_tint1 = {r=1, g=0.6, b=0, a=0}
small_biter_tint2 = {r=1 , g=0.9, b=0, a=0}


medium_biter_scale = 1.1
medium_biter_tint1 = {r=1, g=0.45, b=0, a=0}
medium_biter_tint2 = {r=1, g=0.7, b=0, a=0}


big_biter_scale = 1.3
big_biter_tint1 = {r=1, g=0.3, b=0, a=0}
big_biter_tint2 = {r=1, g=0.5, b=0, a=0}



behemoth_biter_scale = 1.6
behemoth_biter_tint1 = {r=1, g=0.1, b=0, a=0}
behemoth_biter_tint2 = {r=1, g=0.3, b=0, a=0}


local function arachnidsrunanimation(scale, tint1, tint2)
  return
  {
    layers=
    {
      {
        filenames =
        {
          "__Arachnids__/graphics/Arachnids-run-01.png",
          "__Arachnids__/graphics/Arachnids-run-02.png",
          "__Arachnids__/graphics/Arachnids-run-03.png",
          "__Arachnids__/graphics/Arachnids-run-04.png"
        },
        slice = 8,
        lines_per_file = 8,
        line_length = 8,
        width = 202,
        height = 158,
        frame_count = 16,
        direction_count = 16,
        --shift = util.mul_shift(util.by_pixel(-2, -6), scale),
        scale = scale,
        hr_version =
        {
          filenames =
          {
            "__Arachnids__/graphics/hr-Arachnids-run-01.png",
            "__Arachnids__/graphics/hr-Arachnids-run-02.png",
            "__Arachnids__/graphics/hr-Arachnids-run-03.png",
            "__Arachnids__/graphics/hr-Arachnids-run-04.png"
          },
          slice = 8,
          lines_per_file = 8,
          line_length = 8,
          width = 398,
          height = 310,
          frame_count = 16,
          --shift = util.mul_shift(util.by_pixel(-1, -5), scale),
          direction_count = 16,
          scale = 0.5 * scale
        }
      },
      {
        filenames =
        {
          "__Arachnids__/graphics/Arachnids-run-mask1-01.png",
          "__Arachnids__/graphics/Arachnids-run-mask1-02.png",
          "__Arachnids__/graphics/Arachnids-run-mask1-03.png",
          "__Arachnids__/graphics/Arachnids-run-mask1-04.png"
        },
        slice = 8,
        lines_per_file = 8,
        flags = { "mask" },
        line_length = 8,
        width = 202,
        height = 158,
        frame_count = 16,
        direction_count = 16,
        --shift = util.mul_shift(util.by_pixel(-2, -6), scale),
        scale = scale,
        tint = tint1,
        hr_version =
        {
          filenames =
          {
            "__Arachnids__/graphics/hr-Arachnids-run-mask1-01.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask1-02.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask1-03.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask1-04.png"
          },
          slice = 8,
          lines_per_file = 8,
          line_length = 8,
          width = 398,
          height = 310,
          frame_count = 16,
          --shift = util.mul_shift(util.by_pixel(-1, -37), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          tint = tint1
        }
      },
      {
        filenames =
        {
          "__Arachnids__/graphics/Arachnids-run-mask2-01.png",
          "__Arachnids__/graphics/Arachnids-run-mask2-02.png",
          "__Arachnids__/graphics/Arachnids-run-mask2-03.png",
          "__Arachnids__/graphics/Arachnids-run-mask2-04.png"
        },
        slice = 8,
        lines_per_file = 8,
        flags = { "mask" },
        line_length = 8,
        width = 202,
        height = 158,
        frame_count = 16,
        direction_count = 16,
        --shift = util.mul_shift(util.by_pixel(-2, -6), scale),
        scale = scale,
        tint = tint2,
        hr_version =
        {
          filenames =
          {
            "__Arachnids__/graphics/hr-Arachnids-run-mask2-01.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask2-02.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask2-03.png",
            "__Arachnids__/graphics/hr-Arachnids-run-mask2-04.png"
          },
          slice = 8,
          lines_per_file = 8,
          line_length = 8,
          width = 398,
          height = 310,
          frame_count = 16,
          --shift = util.mul_shift(util.by_pixel(-1, -5), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          tint = tint2
        }
      },
      {
        filenames =
        {
          "__Arachnids__/graphics/Arachnids-run-shadow-01.png",
          "__Arachnids__/graphics/Arachnids-run-shadow-02.png",
          "__Arachnids__/graphics/Arachnids-run-shadow-03.png",
          "__Arachnids__/graphics/Arachnids-run-shadow-04.png"
        },
        slice = 8,
        lines_per_file = 8,
        line_length = 8,
        width = 202,
        height = 158,
        frame_count = 16,
        shift = util.mul_shift(util.by_pixel(0, 0), scale),
        direction_count = 16,
        scale =  1.5 * scale,
        draw_as_shadow = true,
        hr_version =
        {
          filenames =
          {
            "__base__/graphics/entity/biter/hr-biter-run-shadow-01.png",
            "__base__/graphics/entity/biter/hr-biter-run-shadow-02.png",
            "__base__/graphics/entity/biter/hr-biter-run-shadow-03.png",
            "__base__/graphics/entity/biter/hr-biter-run-shadow-04.png"
          },
          slice = 8,
          lines_per_file = 8,
          line_length = 8,
          width = 432,
          height = 292,
          frame_count = 16,
          shift = util.mul_shift(util.by_pixel(8, -1), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          draw_as_shadow = true
        }
      }
    }
  }
end

data.raw.unit['small-biter'].run_animation = arachnidsrunanimation (small_biter_scale, small_biter_tint1, small_biter_tint2)
data.raw.unit['medium-biter'].run_animation = arachnidsrunanimation (medium_biter_scale, medium_biter_tint1, medium_biter_tint2)
data.raw.unit['big-biter'].run_animation = arachnidsrunanimation (big_biter_scale, big_biter_tint1, big_biter_tint2)
data.raw.unit['behemoth-biter'].run_animation = arachnidsrunanimation (behemoth_biter_scale, behemoth_biter_tint1, behemoth_biter_tint2)


I would like to know if there is a way to use data.raw for the bloodtint function? Or do i need to copy all the parts from here? https://wiki.factorio.com/Data.raw

Code: Select all

function bloodtint()
return {r = 51, g = 202, b = 51}
end
I also need to do the same with the blood puddle, but the code that create the corpse and biter die animation isn't warping around my head. Replacing the run annim was easy once someone showed me the data.raw exemple but the blood pudle is within a "sheet" and im not so sure how i can use that. I tried the data raw and made a arachniddieanimation but an errow was returning me a nill value within corps. So im not sure what part i can instance.

this is the biter die animation function

Code: Select all

function biterdieanimation(scale, tint1, tint2)
  return
  {
    layers=
    {
      {
        filenames =
        {
          "__base__/graphics/entity/biter/biter-die-01.png",
          "__base__/graphics/entity/biter/biter-die-02.png",
          "__base__/graphics/entity/biter/biter-die-03.png",
          "__base__/graphics/entity/biter/biter-die-04.png",
          "__base__/graphics/entity/biter/biter-die-05.png",
          "__base__/graphics/entity/biter/biter-die-06.png",
          "__base__/graphics/entity/biter/biter-die-07.png",
          "__base__/graphics/entity/biter/biter-die-08.png",
          "__base__/graphics/entity/biter/biter-die-09.png",
          "__base__/graphics/entity/biter/biter-die-10.png",
          "__base__/graphics/entity/biter/biter-die-11.png",
          "__base__/graphics/entity/biter/biter-die-12.png",
          "__base__/graphics/entity/biter/biter-die-13.png",
          "__base__/graphics/entity/biter/biter-die-14.png",
          "__base__/graphics/entity/biter/biter-die-15.png",
          "__base__/graphics/entity/biter/biter-die-16.png",
          "__base__/graphics/entity/biter/biter-die-17.png"
        },
        slice = 4,
        lines_per_file = 4,
        line_length = 4,
        width = 276,
        height = 202,
        frame_count = 17,
        direction_count = 16,
        shift= util.mul_shift(util.by_pixel(-2, -4), scale),
        scale = scale,
        hr_version =
        {
          filenames =
          {
            "__base__/graphics/entity/biter/hr-biter-die-01.png",
            "__base__/graphics/entity/biter/hr-biter-die-02.png",
            "__base__/graphics/entity/biter/hr-biter-die-03.png",
            "__base__/graphics/entity/biter/hr-biter-die-04.png",
            "__base__/graphics/entity/biter/hr-biter-die-05.png",
            "__base__/graphics/entity/biter/hr-biter-die-06.png",
            "__base__/graphics/entity/biter/hr-biter-die-07.png",
            "__base__/graphics/entity/biter/hr-biter-die-08.png",
            "__base__/graphics/entity/biter/hr-biter-die-09.png",
            "__base__/graphics/entity/biter/hr-biter-die-10.png",
            "__base__/graphics/entity/biter/hr-biter-die-11.png",
            "__base__/graphics/entity/biter/hr-biter-die-12.png",
            "__base__/graphics/entity/biter/hr-biter-die-13.png",
            "__base__/graphics/entity/biter/hr-biter-die-14.png",
            "__base__/graphics/entity/biter/hr-biter-die-15.png",
            "__base__/graphics/entity/biter/hr-biter-die-16.png",
            "__base__/graphics/entity/biter/hr-biter-die-17.png"
          },
          slice = 4,
          lines_per_file = 4,
          line_length = 4,
          width = 544,
          height = 402,
          frame_count = 17,
          shift = util.mul_shift(util.by_pixel(0, -4), scale),
          direction_count = 16,
          scale = 0.5 * scale
        }
      },
      {
        filenames =
        {
          "__base__/graphics/entity/biter/biter-die-mask1-01.png",
          "__base__/graphics/entity/biter/biter-die-mask1-02.png",
          "__base__/graphics/entity/biter/biter-die-mask1-03.png",
          "__base__/graphics/entity/biter/biter-die-mask1-04.png",
          "__base__/graphics/entity/biter/biter-die-mask1-05.png",
          "__base__/graphics/entity/biter/biter-die-mask1-06.png",
          "__base__/graphics/entity/biter/biter-die-mask1-07.png",
          "__base__/graphics/entity/biter/biter-die-mask1-08.png",
          "__base__/graphics/entity/biter/biter-die-mask1-09.png",
          "__base__/graphics/entity/biter/biter-die-mask1-10.png",
          "__base__/graphics/entity/biter/biter-die-mask1-11.png",
          "__base__/graphics/entity/biter/biter-die-mask1-12.png",
          "__base__/graphics/entity/biter/biter-die-mask1-13.png",
          "__base__/graphics/entity/biter/biter-die-mask1-14.png",
          "__base__/graphics/entity/biter/biter-die-mask1-15.png",
          "__base__/graphics/entity/biter/biter-die-mask1-16.png",
          "__base__/graphics/entity/biter/biter-die-mask1-17.png"
        },
        slice = 4,
        lines_per_file = 4,
        flags = { "mask" },
        line_length = 4,
        width = 198,
        height = 166,
        frame_count = 17,
        direction_count = 16,
        shift = util.mul_shift(util.by_pixel(0, -22), scale),
        scale = scale,
        tint = tint1,
        hr_version =
        {
          filenames =
          {
            "__base__/graphics/entity/biter/hr-biter-die-mask1-01.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-02.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-03.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-04.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-05.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-06.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-07.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-08.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-09.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-10.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-11.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-12.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-13.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-14.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-15.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-16.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask1-17.png"
          },
          slice = 4,
          lines_per_file = 4,
          line_length = 4,
          width = 398,
          height = 328,
          frame_count = 17,
          shift = util.mul_shift(util.by_pixel(-1, -21), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          tint = tint1
        }
      },
      {
        filenames =
        {
          "__base__/graphics/entity/biter/biter-die-mask2-01.png",
          "__base__/graphics/entity/biter/biter-die-mask2-02.png",
          "__base__/graphics/entity/biter/biter-die-mask2-03.png",
          "__base__/graphics/entity/biter/biter-die-mask2-04.png",
          "__base__/graphics/entity/biter/biter-die-mask2-05.png",
          "__base__/graphics/entity/biter/biter-die-mask2-06.png",
          "__base__/graphics/entity/biter/biter-die-mask2-07.png",
          "__base__/graphics/entity/biter/biter-die-mask2-08.png",
          "__base__/graphics/entity/biter/biter-die-mask2-09.png",
          "__base__/graphics/entity/biter/biter-die-mask2-10.png",
          "__base__/graphics/entity/biter/biter-die-mask2-11.png",
          "__base__/graphics/entity/biter/biter-die-mask2-12.png",
          "__base__/graphics/entity/biter/biter-die-mask2-13.png",
          "__base__/graphics/entity/biter/biter-die-mask2-14.png",
          "__base__/graphics/entity/biter/biter-die-mask2-15.png",
          "__base__/graphics/entity/biter/biter-die-mask2-16.png",
          "__base__/graphics/entity/biter/biter-die-mask2-17.png"
        },
        slice = 4,
        lines_per_file = 4,
        flags = { "mask" },
        line_length = 4,
        width = 200,
        height = 166,
        frame_count = 17,
        direction_count = 16,
        shift = util.mul_shift(util.by_pixel(-2, -22), scale),
        scale = scale,
        tint = tint2,
        hr_version =
        {
          filenames =
          {
            "__base__/graphics/entity/biter/hr-biter-die-mask2-01.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-02.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-03.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-04.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-05.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-06.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-07.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-08.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-09.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-10.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-11.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-12.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-13.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-14.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-15.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-16.png",
            "__base__/graphics/entity/biter/hr-biter-die-mask2-17.png"
          },
          slice = 4,
          lines_per_file = 4,
          line_length = 4,
          width = 396,
          height = 330,
          frame_count = 17,
          shift = util.mul_shift(util.by_pixel(-1, -22), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          tint = tint2
        }
      },
      {
        filenames =
        {
          "__base__/graphics/entity/biter/biter-die-shadow-01.png",
          "__base__/graphics/entity/biter/biter-die-shadow-02.png",
          "__base__/graphics/entity/biter/biter-die-shadow-03.png",
          "__base__/graphics/entity/biter/biter-die-shadow-04.png",
          "__base__/graphics/entity/biter/biter-die-shadow-05.png",
          "__base__/graphics/entity/biter/biter-die-shadow-06.png",
          "__base__/graphics/entity/biter/biter-die-shadow-07.png",
          "__base__/graphics/entity/biter/biter-die-shadow-08.png",
          "__base__/graphics/entity/biter/biter-die-shadow-09.png",
          "__base__/graphics/entity/biter/biter-die-shadow-10.png",
          "__base__/graphics/entity/biter/biter-die-shadow-11.png",
          "__base__/graphics/entity/biter/biter-die-shadow-12.png",
          "__base__/graphics/entity/biter/biter-die-shadow-13.png",
          "__base__/graphics/entity/biter/biter-die-shadow-14.png",
          "__base__/graphics/entity/biter/biter-die-shadow-15.png",
          "__base__/graphics/entity/biter/biter-die-shadow-16.png",
          "__base__/graphics/entity/biter/biter-die-shadow-17.png"
        },
        slice = 4,
        lines_per_file = 4,
        line_length = 4,
        width = 282,
        height = 192,
        frame_count = 17,
        shift = util.mul_shift(util.by_pixel(4, 0), scale),
        direction_count = 16,
        scale = scale,
        draw_as_shadow = true,
        hr_version =
        {
          filenames =
          {
            "__base__/graphics/entity/biter/hr-biter-die-shadow-01.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-02.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-03.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-04.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-05.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-06.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-07.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-08.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-09.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-10.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-11.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-12.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-13.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-14.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-15.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-16.png",
            "__base__/graphics/entity/biter/hr-biter-die-shadow-17.png"
          },
          slice = 4,
          lines_per_file = 4,
          line_length = 4,
          width = 564,
          height = 384,
          frame_count = 17,
          shift = util.mul_shift(util.by_pixel(4, 0), scale),
          direction_count = 16,
          scale = 0.5 * scale,
          draw_as_shadow = true
        }
      }
    }
  }
end
and this is the puddle part

Code: Select all

function add_biter_die_animation(scale, tint1, tint2, corpse)
  corpse.animation = biterdieanimation(scale, tint1, tint2)
  corpse.dying_speed = 0.04
  corpse.time_before_removed = 15 * 60 * 60
  corpse.direction_shuffle = { { 1, 2, 3, 16 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } }
  corpse.shuffle_directions_at_frame = 7
  corpse.final_render_layer = "lower-object-above-shadow"

  corpse.ground_patch_render_layer = "decals" -- "transport-belt-integration"
  corpse.ground_patch_fade_in_delay = 1 / 0.02 --  in ticks; 1/dying_speed to delay the animation until dying animation finishes
  corpse.ground_patch_fade_in_speed = 0.002
  corpse.ground_patch_fade_out_start = 50 * 60
  corpse.ground_patch_fade_out_duration = 20 * 60

  local a = 1
  local d = 0.9
  corpse.ground_patch =
  {
    sheet =
    {
      filename = "__base__/graphics/entity/biter/blood-puddle-var-main.png",
      flags = { "low-object" },
      line_length = 4,
      variation_count = 4,
      frame_count = 1,
      width = 84,
      height = 68,
      shift = util.by_pixel(1, 0),
      tint = {r = 0.6 * d * a, g = 0.1 * d * a, b = 0.6 * d * a, a = a},
      scale = scale,
      hr_version =
      {
        filename = "__base__/graphics/entity/biter/hr-blood-puddle-var-main.png",
        flags = { "low-object" },
        line_length = 4,
        variation_count = 4,
        frame_count = 1,
        width = 164,
        height = 134,
        shift = util.by_pixel(-0.5,-0.5),
        tint = {r = 0.6 * d * a, g = 0.1 * d * a, b = 0.6 * d * a, a = a},
        scale = 0.5 * scale
      }
    }
  }
  return corpse
end
If anyone as the time and energy to explain, that would be amazing, and i will make sure to put you in the mod credits
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3715
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by DaveMcW »

You don't have to use those functions if you don't understand them.

Check out the data.raw dump (search for blood-puddle) to see what the final data.raw table should look like. How you get there is up to you.
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

i tryied this, but i get an error, return nil value.

Code: Select all

arachnids_ground_patch = {
        sheet = {
          filename = "__base__/graphics/entity/biter/blood-puddle-var-main.png",
          flags = {
            "low-object"
          },
          frame_count = 1,
          height = 68,
          hr_version = {
            filename = "__base__/graphics/entity/biter/hr-blood-puddle-var-main.png",
            flags = {
              "low-object"
            },
            frame_count = 1,
            height = 134,
            line_length = 4,
            scale = 0.25,
            shift = {
              -0.015625,
              -0.015625
            },
            tint = {
              a = 1,
              b = 0.54000000000000004,
              g = 0.090000000000000018,
              r = 0.54000000000000004
            },
            variation_count = 4,
            width = 164
          },
          line_length = 4,
          scale = 0.5,
          shift = {
            0.03125,
            0
          },
          tint = {
            a = 1,
            b = 0.54000000000000004,
            g = 0.090000000000000018,
            r = 0.54000000000000004
          },
          variation_count = 4,
          width = 84
        }
      }

data.raw['small-biter-corpse'].ground_patch = arachnids_ground_patch
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

just needed this at the end data.raw["corpse"]["small-biter-corpse"].ground_patch = arachnids_ground_patch
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

Now i need to do the same with the bloodtint particle

Code: Select all

local function arachnids_bloodtint()
return {r = 50, g = 204, b = 50}
end

data.raw["particles"].bloodtint = arachnids_bloodtint
but this return me a nill value
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by Pi-C »

aotenshin wrote: Wed May 11, 2022 10:07 am Now i need to do the same with the bloodtint particle

Code: Select all

local function arachnids_bloodtint()
return {r = 50, g = 204, b = 50}
end

data.raw["particles"].bloodtint = arachnids_bloodtint
but this return me a nill value
You're making data.raw["particles"].bloodtint a reference to the function arachnids_bloodtint, but you actually want it to be the result of calling the function:

Code: Select all

data.raw["particles"].bloodtint = arachnids_bloodtint()
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

thank you, but i still get a nill value

Code: Select all

function arachnids_bloodtint()
return {r = 172, g = 51, b = 204}
end


data.raw["particles"].bloodtint = arachnids_bloodtint()
could it be because its a global variable? ( underFactorio\data\base\prototypes\particles.lua )

I tried to use particle_animations.get_blood_particle_pictures to redefine

Code: Select all

 make_particle
  {
    name = "blood-particle",
    life_time = 180,
    pictures = particle_animations.get_blood_particle_pictures({tint = bloodtint()}),
    shadows = particle_animations.get_blood_particle_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}),
    draw_shadow_when_on_ground = false,
    ended_in_water_trigger_effect = false,
    movement_modifier_when_on_ground = 0,
    render_layer = "higher-object-under"
  },
but i still do smth wrong
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

Im trying to replace the {tint = bloodtint()} to my own value

Code: Select all

make_particle
  {
    name = "blood-particle",
    life_time = 180,
    pictures = particle_animations.get_blood_particle_pictures({tint = bloodtint()}),
    shadows = particle_animations.get_blood_particle_pictures({ tint = shadowtint(), shift = util.by_pixel (1,0)}),
    draw_shadow_when_on_ground = false,
    ended_in_water_trigger_effect = false,
    movement_modifier_when_on_ground = 0,
    render_layer = "higher-object-under"
  },
currently im using

Code: Select all

 arachnids_bloodtint = particle_animations.get_blood_particle_pictures({tint = {r = 20, g = 202, b = 20}})

data.raw["optimized-particle"]["blood-particle"]["pictures"]particle_animations.get_blood_particle_pictures = arachnids_bloodtint
but i assume particle animation should not be there, i'm kinda stuck, i managed to make my own instance of the blood puddle , but the blood particle are not working
aotenshin
Burner Inserter
Burner Inserter
Posts: 8
Joined: Tue Sep 03, 2019 5:03 pm
Contact:

Re: Arachnids, would you like to know more...? Data.raw function replacement help!

Post by aotenshin »

Solved ; )
Post Reply

Return to “Modding help”