Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE: Torpedo hit events reach 'else catch all' logic and error at getName() #1337

Closed
thebgpikester opened this issue Jul 5, 2020 · 4 comments
Assignees
Labels
DCS bug DCS bug. Please report on ED forum. Reproduced Issue could be reproduced.

Comments

@thebgpikester
Copy link
Collaborator

thebgpikester commented Jul 5, 2020

Current Code block around line 7500

 if Event.IniObjectCategory == Object.Category.STATIC then
          if Event.id==31 then
            --env.info("FF event 31")
            -- Event.initiator is a Static object representing the pilot. But getName() error due to DCS bug.
            Event.IniDCSUnit = Event.initiator
            local ID=Event.initiator.id_
            Event.IniDCSUnitName = string.format("Ejected Pilot ID %s", tostring(ID))
            Event.IniUnitName = Event.IniDCSUnitName
            Event.IniCoalition = 0
            Event.IniCategory  = 0
            Event.IniTypeName = "Ejected Pilot"
          else
            Event.IniDCSUnit = Event.initiator
            Event.IniDCSUnitName = Event.IniDCSUnit:getName()
            Event.IniUnitName = Event.IniDCSUnitName
            Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName, false )
            Event.IniCoalition = Event.IniDCSUnit:getCoalition()
            Event.IniCategory = Event.IniDCSUnit:getDesc().category
            Event.IniTypeName = Event.IniDCSUnit:getTypeName()
          end
        end

When a torpedo hits, it creates an event like:

{[id]=2,[time]=28910.681,[initiator]={[id_]=33561088,},[target]={[id_]=16778240,},[weapon]={[id_]=33561088,},[IniObjectCategory]=3,[weapon_name]=weapons.torpedoes.G7A_T1,}

Because the IniObjectCategory is 3 (a static) it hits the if clause, because it is not event.id==31, it hits the else clause and because there is no Event.IniDCSUnit, it errors to main logs with "the unit does not exist".

I need to check with you on three things:
A check on what the "Event.IniObjectCategory == Object.Category.STATIC" is really for and if it is being used consistently by ED
Is this the only weapon that uses static category?
A check on the impact of this.... I need to ask, why do we even care about OnHit events?

@thebgpikester thebgpikester added Bug Moose bug that needs to be fixed. Todo On the list but work has not started yet. Low Prio Low priority issue. Could take time before being addressed. Reproduced Issue could be reproduced. labels Jul 5, 2020
@funkyfranky
Copy link
Collaborator

Thanks Pikey! To answer you three questions:

  1. I had introduced the if condition when the new event S_EVENT_LANDING_AFTER_EJECTION was introduced (before, there was no if condition for static objects at all). The initiator for that event is a static representing the pilot. However, unlike "normal" statics, the getName() function (and others) dont work for this object.
  2. Yes, I think it is the only weapon as the code ran well for years. In fact, I would say this is a DCS bug as the object category should be OBJECT.Category.WEAPON (=2) and not OBJECT.Category.STATIC (=3).
  3. Because people might hook into Hit events and do stuff (suppression class uses it, scoring also, users of cause).

@funkyfranky funkyfranky added the DCS bug DCS bug. Please report on ED forum. label Jul 6, 2020
@thebgpikester
Copy link
Collaborator Author

The bug was REPORTED but Grimes fedback it was known, I'm not entirely sure which is true, but if it is the latter, wouldn't expect to see much movement on this bug. We should leave the ticket open until the releases have matured past this point before giving up hope. The impact of the issue is fairly small amountd of log writing unless people want to hit handle torpedoes and are not aware of the issue. The impact would be they might exclude torps or have a few hours of confusion in the future.

@funkyfranky funkyfranky removed Bug Moose bug that needs to be fixed. Todo On the list but work has not started yet. Low Prio Low priority issue. Could take time before being addressed. labels Oct 27, 2020
@baluballa
Copy link
Collaborator

@thebgpikester @funkyfranky is this issue still relevant?

@thebgpikester
Copy link
Collaborator Author

Apprently Torpedoes are still WIP after 2 years so I think I will close this and if it crop up when they are being used more can revisit then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DCS bug DCS bug. Please report on ED forum. Reproduced Issue could be reproduced.
Projects
None yet
Development

No branches or pull requests

3 participants