Armor display on player

Place to get help with not working mods / modding interface.
Antharis
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Jun 23, 2015 4:43 am
Contact:

Armor display on player

Post by Antharis »

Hello. I just wanted to know, if say i add a new tier of modular power armor to the game, how do i make it look like the Power Armor MK1 and 2s from base game? Because it seems any custom armor added through modding does not change the player's sprite. It leaves it as when the game starts.
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

Re: Armor display on player

Post by semvoz »

Hello there,

In the base mod I would have a look to the following two files:

demo-entities.lua

Code: Select all

        -- modular armors are not in the demo
        armors = data.isdemo and {} or {"basic-modular-armor", "power-armor", "power-armor-mk2"},
        idle =
        {
          layers =
          {
            playeranimations.level1.idle,
            playeranimations.level1.idlemask,
            playeranimations.level3addon.idle,
            playeranimations.level3addon.idlemask
          }
        },
        idle_with_gun =
        {
          layers =
          {
            playeranimations.level1.idlewithgun,
            playeranimations.level1.idlewithgunmask,
            playeranimations.level3addon.idlewithgun,
            playeranimations.level3addon.idlewithgunmask,
          }
        },
        mining_with_hands =
        {
          layers =
          {
            playeranimations.level1.miningwithhands,
            playeranimations.level1.miningwithhandsmask,
            playeranimations.level3addon.miningwithhands,
            playeranimations.level3addon.miningwithhandsmask,
          }
        },
        mining_with_tool =
        {
          layers =
          {
            playeranimations.level1.miningwithtool,
            playeranimations.level1.miningwithtoolmask,
            playeranimations.level3addon.miningwithtool,
            playeranimations.level3addon.miningwithtoolmask,
          }
        },
        running_with_gun =
        {
          layers =
          {
            playeranimations.level1.runningwithgun,
            playeranimations.level1.runningwithgunmask,
            playeranimations.level3addon.runningwithgun,
            playeranimations.level3addon.runningwithgunmask,
          }
        },
        running =
        {
          layers =
          {
            playeranimations.level1.running,
            playeranimations.level1.runningmask,
            playeranimations.level3addon.running,
            playeranimations.level3addon.runningmask,
          }
        }
      }
demo-player-animations.lua

Code: Select all

  level3addon =
  {
    idle =
    {
      filename = "__base__/graphics/entity/player/player-armor2-idle.png",
      priority = "very-low",
      width = 38,
      height = 43,
      direction_count = 8,
      frame_count = 22,
      animation_speed = 0.15,
      shift = {-0.015625, -0.83125},
      axially_symmetrical = false
    },
    idlemask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-idle-color.png",
      priority = "very-low",
      width = 38,
      height = 45,
      direction_count = 8,
      frame_count = 22,
      apply_runtime_tint = true,
      animation_speed = 0.15,
      shift = {-0.015625, -0.796875},
      axially_symmetrical = false
    },
    idlewithgun =
    {
      filename = "__base__/graphics/entity/player/player-armor2-idle-gun.png",
      priority = "very-low",
      width = 38,
      height = 43,
      direction_count = 8,
      frame_count = 22,
      animation_speed = 0.15,
      shift = {-0.296875, -0.78125},
      axially_symmetrical = false
    },
    idlewithgunmask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-idle-gun-color.png",
      priority = "very-low",
      width = 38,
      height = 44,
      direction_count = 8,
      frame_count = 22,
      apply_runtime_tint = true,
      animation_speed = 0.15,
      shift = {-0.296875, -0.703125},
      axially_symmetrical = false
    },
    miningwithhands =
    {
      filename = "__base__/graphics/entity/player/player-armor2-mine.png",
      priority = "very-low",
      width = 42,
      height = 46,
      direction_count = 8,
      frame_count = 14,
      animation_speed = 0.6,
      shift = {-0.15625, -0.421875},
      axially_symmetrical = false
    },
    miningwithhandsmask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-mine-color.png",
      priority = "very-low",
      width = 40,
      height = 47,
      direction_count = 8,
      frame_count = 14,
      animation_speed = 0.6,
      apply_runtime_tint = true,
      shift = {-0.15625, -0.40625},
      axially_symmetrical = false
    },
    miningwithtool =
    {
      filename = "__base__/graphics/entity/player/player-armor2-mine-tool.png",
      priority = "very-low",
      width = 72,
      height = 61,
      direction_count = 8,
      frame_count = 26,
      line_length = 26,
      animation_speed = 0.9,
      shift = {-0.0625, -0.4375},
      axially_symmetrical = false
    },
    miningwithtoolmask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-mine-tool-color.png",
      priority = "very-low",
      width = 69,
      height = 68,
      direction_count = 8,
      frame_count = 26,
      line_length = 26,
      animation_speed = 0.9,
      apply_runtime_tint = true,
      shift = {-0.046875, -0.359375},
      axially_symmetrical = false
    },
    runningwithgun =
    {
      filename = "__base__/graphics/entity/player/player-armor2-run-gun.png",
      priority = "very-low",
      width = 37,
      height = 47,
      frame_count = 22,
      direction_count = 18,
      shift = {0,  -0.6875}
    },
    runningwithgunmask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-run-gun-color.png",
      priority = "very-low",
      width = 37,
      height = 50,
      frame_count = 22,
      direction_count = 18,
      apply_runtime_tint = true,
      shift = {0,  -0.609375}
    },
    running =
    {
      filename = "__base__/graphics/entity/player/player-armor2-run.png",
      priority = "very-low",
      width = 40,
      height = 54,
      frame_count = 22,
      direction_count = 8,
      shift = {0, -0.78125},
      axially_symmetrical = false
    },
    runningmask =
    {
      filename = "__base__/graphics/entity/player/player-armor2-run-color.png",
      priority = "very-low",
      width = 40,
      height = 43,
      frame_count = 22,
      direction_count = 8,
      apply_runtime_tint = true,
      shift = {0, -0.890625},
      axially_symmetrical = false
    },
  }
Basically I would guess that you have to implement your own animation and add it to the player for your new power armour.
You might be able to reuse existing animation and add a 'tint', maybe.
Antharis
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Jun 23, 2015 4:43 am
Contact:

Re: Armor display on player

Post by Antharis »

Thank you, sir! You are correct, i needed to add the new armor name to the following code for it to be recognized:

-- modular armors are not in the demo
armors = data.isdemo and {} or {"basic-modular-armor", "power-armor", "power-armor-mk2"},
idle =
{

and make it like so:

armors = data.isdemo and {} or {"basic-modular-armor", "power-armor", "power-armor-mk2", "CUSTOM-ARMOR-NAME1, "CUSTOM-ARMOR-NAME2"},

and so on...

That's only if people want to make their custom armor look like regular power armor, the second file is for tweaking in custom animations.
Post Reply

Return to “Modding help”