View Issue Details

IDProjectCategoryView StatusLast Update
0006062Spring engineLuapublic2018-11-04 17:13
ReporterFloris Assigned Togajop  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version104.0 +git 
Summary0006062: IsUnitInView() and IsUnitVisible() return true for unsynced gadgets
DescriptionThe unit is invisible to me but these functions return true regardless
TagsNo tags attached.
Checked infolog.txt for Errors

Activities

gajop

2018-11-04 13:51

developer   ~0019469

Unsynced gadgets have global LOS afaik: https://springrts.com/wiki/Lua:Environments

Kloot

2018-11-04 14:14

developer   ~0019470

they do, see also the discussion in #6011

Floris

2018-11-04 15:30

reporter   ~0019472

6011 = Access Denied.

Kloot

2018-11-04 15:52

developer   ~0019473

[me]

Spring.IsUnitVisible only returns whether a unit is potentially visible by the camera, and if called from a gadget (which has more access priviledges than a widget) it ignores LOS.



[Doo]

isn't that "Spring.IsUnitInView"? What are the differences?
Is there a specfic call that returns true if a unit is curently being drawn, regardless of los?



[me]

Spring.IsUnitInView is a stripped-down version of Spring.IsUnitVisible (IsUnitVisible checks access rights of the Lua script calling it and takes some optional arguments, IsUnitInView does neither)

"Is there a specfic call that returns true if a unit is curently being drawn, regardless of los?"

no, that would not make sense because unit drawing is itself tied to LOS.



[Doo]

There are some cases though, aren't there? Using SetUnitAlwaysVisible, wouldn't that make a unit visible regardless of its LOS state?



[me]

"Using SetUnitAlwaysVisible, wouldn't that make a unit visible regardless of its LOS state?"

An always-visible unit will still only be drawn if it is in view, so IsUnitInView will see it when the player does.

Floris

2018-11-04 16:42

reporter   ~0019474

okay... so no way to know if a unit is in user-los from a gadget.

I've stripped the nanolaser gadget unsynced part and made it into a widget, it works

gajop

2018-11-04 17:03

developer   ~0019475

Seems to me the issue is resolved then.

Kloot

2018-11-04 17:11

developer   ~0019476

fyi you should be able to just wrap IsUnitInLos in a CallAsTeam.

gajop

2018-11-04 17:13

developer   ~0019477

Ah yes, see here: https://springrts.com/wiki/Lua_System

Issue History

Date Modified Username Field Change
2018-11-04 12:58 Floris New Issue
2018-11-04 13:51 gajop Note Added: 0019469
2018-11-04 14:14 Kloot Note Added: 0019470
2018-11-04 15:30 Floris Note Added: 0019472
2018-11-04 15:52 Kloot Note Added: 0019473
2018-11-04 16:42 Floris Note Added: 0019474
2018-11-04 17:03 gajop Assigned To => gajop
2018-11-04 17:03 gajop Status new => closed
2018-11-04 17:03 gajop Resolution open => no change required
2018-11-04 17:03 gajop Note Added: 0019475
2018-11-04 17:11 Kloot Note Added: 0019476
2018-11-04 17:13 gajop Note Added: 0019477