MODの作り方/レーザータレットについて

Last-modified: 2017-03-04 (土) 19:36:46
Version0.14.22現在の情報です

ソース

 {
   type = "electric-turret",
   name = "laser-turret",
   icon = "__base__/graphics/icons/laser-turret.png",
   flags = { "placeable-player", "placeable-enemy", "player-creation"},
   minable = { mining_time = 0.5, result = "laser-turret" },
   max_health = 1000,
   corpse = "medium-remnants",
   collision_box = {{ -0.7, -0.7}, {0.7, 0.7}},
   selection_box = {{ -1, -1}, {1, 1}},
   rotation_speed = 0.01,
   preparing_speed = 0.05,
   dying_explosion = "medium-explosion",
   folding_speed = 0.05,
   energy_source =
   {
     type = "electric",
     buffer_capacity = "801kJ",
     input_flow_limit = "9600kW",
     drain = "24kW",
     usage_priority = "primary-input"
   },

 アニメーションとサウンドの設定部分は省略

   attack_parameters =
   {
     type = "projectile",
     ammo_category = "electric",
     cooldown = 20,
     projectile_center = {0, -0.2},
     projectile_creation_distance = 1.4,
     range = 25,
     damage_modifier = 4,
     ammo_type =
     {
       type = "projectile",
       category = "laser-turret",
       energy_consumption = "800kJ",
       action =
       {
         {
           type = "direct",
           action_delivery =
           {
             {
               type = "projectile",
               projectile = "laser",
               starting_speed = 0.28
             }
           }
         }
       }
     },
     sound = make_laser_sounds()
   },
   call_for_help_radius = 40
 }

解説

レーザータレットのデータは
 Factorio/data/base/prototypes/entity
  beams.lua
  turrets.lua
にあります。


  • max_health
    タレットの耐久力
  • energy_source
    • buffer_capacity
      タレットに蓄電しておけるエネルギー量  1[J]=1[W]x1[s]
    • input_flow_limit
      タレットの充電に使う電力量の最大値
      最大9600kWで801kJを充電するので、電力供給が十分なら0.08[秒]で満タンになる
  • drain = "24kW",
    待機電力 使わなくても設置してあるだけで消費する電力量

attack_parameters部

  • range
    射程範囲
  • energy_consumption
    1発の発射にかかるエネルギー量
    初期値だと1発撃つとタレットの蓄電量は1[kJ]になる。(つまりほぼ空)
    80[kJ]に設定すると、タレットに蓄電されているエネルギーだけで10発撃てる。
    (充電も同時に行われているので、それほど神経質にならなくても大丈夫)
    この数値を下げると省エネ化が可能になる。
     
    modで省エネ化をするには下記のようにenergy_consumptionの数値を上書き設定する。
    data.raw["electric-turret"]["laser-turret"].attack_parameters.ammo_type.energy_consumption="80kJ"

レーザーの攻撃力などは
 beams.lua
に記載されています