Page 1 of 1

BeamAttackParameter source_offset for more entities

Posted: Sun Oct 31, 2021 7:21 pm
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

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Posted: Mon Nov 01, 2021 8:11 am
by Klonan
In the action delivery you have:
source_offset = { 0, 0 }

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Posted: Mon Nov 01, 2021 9:20 pm
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.

Re: [1.1.45] source_offset not applied for BeamAttackParameter

Posted: Tue Nov 02, 2021 9:13 am
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)

Re: BeamAttackParameter source_offset for more entities

Posted: Wed Dec 22, 2021 10:39 pm
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.