BeamAttackParameter source_offset for more entities

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
evildogbot100
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Dec 18, 2016 3:02 pm
Contact:

BeamAttackParameter source_offset for more entities

Post by evildogbot100 »

Seems like source_offset property is not applied on BeamAttackParameter if the attacker is type:Unit

Code: Select all

  unit.attack_parameters = {
    type = "beam",
    source_direction_count = 32,
    source_offset = { 999, 999 },
    range = 5 * uscdat.range,
    cooldown = uscdat.cooldown / 0.4,
    cooldown_deviation = 0.05,
    warmup = 0,
    damage_modifier = 0.01,
    ammo_type = {
      category = "laser",
      action = {
        type = "direct",
        action_delivery = {
          type = "beam",
          beam = "laser-beam", --string.format("archon-lightning-%02d", level),
          max_length = 24,
          duration = 30,
          source_offset = { 0, 0 }
        }
      }
    },
    animation = A.archon_attack(),
    range_mode = "center-to-center"
  }

As you can see, the laser beam starts at exact center of the archon, despite having source offset of {999, 999}, Changing the value also doesn't do anything. That code snippet is on file protoss-redux_0.0.1/prototypes/entity/unit/archon.lua from my attached mods.zip file
Attachments
_autosave1.zip
(270.22 KiB) Downloaded 121 times
mods.zip
(40.5 MiB) Downloaded 159 times
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Post by Klonan »

In the action delivery you have:
source_offset = { 0, 0 }
evildogbot100
Fast Inserter
Fast Inserter
Posts: 152
Joined: Sun Dec 18, 2016 3:02 pm
Contact:

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Post by evildogbot100 »

On action_delivery, the source_offset only gives final offset to the beam starting point and doesn't rotate with the shooter. This is different behavior compared to laser-turret where the source_offset of the attack_parameter itself provides a rotating offset where it follows the rotation of the shooter.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Post by Klonan »

evildogbot100 wrote: Mon Nov 01, 2021 9:20 pm On action_delivery, the source_offset only gives final offset to the beam starting point and doesn't rotate with the shooter. This is different behavior compared to laser-turret where the source_offset of the attack_parameter itself provides a rotating offset where it follows the rotation of the shooter.
It looks like the logic is only implemented for the turrets at the moment,
So it won't work for units, characters, equipment, vehicles, etc.

I will move this to modding interface requests

(For dev, virtual Vector getBeamOffset() override is only implemented for Turret.cpp)
User avatar
snouz
Inserter
Inserter
Posts: 27
Joined: Sun Jan 03, 2021 6:01 pm
Contact:

Re: BeamAttackParameter source_offset for more entities

Post by snouz »

I noticed that too while trying to fix the laser gun beam from Bob warfare, which right now starts at the feet.

data.raw.gun["laser-rifle"].attack_parameters =
{
type = "beam",
ammo_category = "laser-rifle",
cooldown = 20,
movement_slow_down_factor = 0.5,
damage_modifier = 1.2,
source_offset = {0, -1.31439},
range = 20,
}

In this case, source_offset is completely ignored.
Graphically contributed to : Bio Industries (soon) | Warehousing | MFerrari's mods | Brevven's mods | Bob Artisanal Reskins | Mining Drones | Teleporters | Emoji signals
User avatar
TheKingJo
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sat Jan 02, 2021 1:22 am
Contact:

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Post by TheKingJo »

Klonan wrote: Tue Nov 02, 2021 9:13 am
evildogbot100 wrote: Mon Nov 01, 2021 9:20 pm On action_delivery, the source_offset only gives final offset to the beam starting point and doesn't rotate with the shooter. This is different behavior compared to laser-turret where the source_offset of the attack_parameter itself provides a rotating offset where it follows the rotation of the shooter.
It looks like the logic is only implemented for the turrets at the moment,
So it won't work for units, characters, equipment, vehicles, etc.

I will move this to modding interface requests

(For dev, virtual Vector getBeamOffset() override is only implemented for Turret.cpp)
Has this been adressed yet? Because I recently tried making a beam kind weapon for a car and wanted to setup the beam starting point offset but it wouldn't work as expected. The offset still only is static and doesn't rotate with the cars turret rotation so it never starts at the intended muzzle but at the base of the car + static offset
Post Reply

Return to “Modding interface requests”