View Issue Details

IDProjectCategoryView StatusLast Update
0005050The Dark ModScript/Defpublic09.09.2019 14:51
ReporterDragoferAssigned To 
PrioritynormalSeveritynormalReproducibilityalways
Status newResolutionopen 
Product VersionTDM 2.07 
Target VersionFixed in Version 
Summary0005050: Electric lights don't toggle hide/show of targeted entities
DescriptionSwitching an electric light on or off will not toggle targeted entities between hide/show. An example usage case would be to let rays of moonlight appear when the light is switched off. To my knowledge this only works with lamps that have def_attached light entities, where the def_attached light entity targets the hidden entity via for instance "set target0 on flame".
Steps To ReproduceFind attached a small test map with an electric light and a lantern. Toggling the lantern will toggle the hidden lit version of the window. However, flipping the switch of the electric light will have no effect on the window.
TagsFix

Relationships

related to 0002564 new add "toggleTargets" to tdm_light_holder script object 

Activities

Dragofer

Dragofer

08.09.2019 15:37

reporter  

toggle_hide_show.map.txt (6,159 bytes)
Version 2
// entity 0
{
"classname" "worldspawn"
"editor_drMapPos1" "145.117 609.786 279.045"
"editor_drMapAngle1" "-48 150.8 0"
"editor_drMapPos2" "414.798 255.441 -264.933"
"editor_drMapAngle2" "2.10002 84.5976 0"
"editor_drMapPos3" "-749.97 -1606.21 -470.066"
"editor_drMapAngle3" "-3.29998 6.59757 0"
"editor_drMapPos4" "1014.05 -953.679 -556.857"
"editor_drMapAngle4" "-10.2 355.498 0"
"editor_drMapPos5" "987.599 3513.79 -319.877"
"editor_drMapAngle5" "-61.1999 172.198 0"
"editor_drMapPos6" "-1032.5 -2840 739.5"
"editor_drMapAngle6" "-77.0999 175.798 0"
"editor_drMapPos7" "952.822 285.005 1366.04"
"editor_drMapAngle7" "-74.8 149.373 0"
"editor_drMapPos8" "976 424 320"
"editor_drMapAngle8" "-3 15.3467 0"
"editor_drMapPos9" "409.146 547.464 392.83"
"editor_drMapAngle9" "-16.8 284.947 0"
"editor_drLastCameraPos" "29.5975 -22.8642 72.2517"
"editor_drLastCameraAngle" "-32.1 168.9 0"
// primitive 0
{
brushDef3
{
( 0 0 1 -144 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 128 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 1
{
brushDef3
{
( 0 0 1 -128 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 1 0 -80 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 2
{
brushDef3
{
( 0 0 1 -128 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 -80 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 3
{
brushDef3
{
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 -16 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 4
{
brushDef3
{
( 0 0 1 -128 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 -80 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 1 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 5
{
brushDef3
{
( 0 0 1 -128 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 0 -1 0 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 0 -1 0 -64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( -1 0 0 -80 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0
( 1 0 0 64 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/darkmod/wood/boards/pier_platform" 0 0 0
}
}
// primitive 6
{
patchDef2
{
"textures/darkmod/window/diamond_pattern02/diamond_pattern02"
( 3 3 0 0 0 )
(
( ( 16 54 24 0 0 ) ( 16 54 48 0 0.5 ) ( 16 54 72 0 1 ) )
( ( 32 54 24 0.5 0 ) ( 32 54 48 0.5 0.5 ) ( 32 54 72 0.5 1 ) )
( ( 48 54 24 1 0 ) ( 48 54 48 1 0.5 ) ( 48 54 72 1 1 ) )
)
}
}
}
// entity 1
{
"classname" "atdm:wall_sphere_lit"
"name" "atdm_wall_sphere_lit_1"
"origin" "-40 48 32"
"light_center" "0 0 28"
"light_radius" "180 180 180"
"model" "models/darkmod/lights/non-extinguishable/lamp_wall_sphere.ase"
"s_shader" "light_flicker_104"
"target0" "func_static_1"
}
// entity 2
{
"classname" "info_player_start"
"name" "info_player_start_1"
"origin" "-8 -48 0"
"angle" "90.000000"
}
// entity 3
{
"classname" "atdm:switch_flip"
"name" "atdm_switch_flip_1"
"origin" "-8 0 32"
"rotation" "1 0 0 0 1 0 0 0 1"
"rotate" "0 0 45"
"target0" "atdm_wall_sphere_lit_1"
"model" "models/darkmod/mechanical/switches/switch_rotate_lever.ase"
"frob_distance" "80"
"frob_box_size" "80"
}
// entity 4
{
"classname" "func_static"
"name" "func_static_1"
"model" "func_static_1"
"origin" "32 52 48"
"hide" "1"
// primitive 0
{
patchDef2
{
"textures/darkmod/window/diamond_pattern02/diamond_pattern02_brightlit"
( 3 3 0 0 0 )
(
( ( 16 52 24 0 0 ) ( 16 52 48 0 0.5 ) ( 16 52 72 0 1 ) )
( ( 32 52 24 0.5 0 ) ( 32 52 48 0.5 0.5 ) ( 32 52 72 0.5 1 ) )
( ( 48 52 24 1 0 ) ( 48 52 48 1 0.5 ) ( 48 52 72 1 1 ) )
)
}
}
}
// entity 5
{
"classname" "atdm:moveable_lantern_oil_hand02_lit"
"name" "atdm_moveable_lantern_oil_hand02_lit_1"
"origin" "-56 -16 12"
"rotation" "1 0 0 0 1 0 0 0 1"
"set target0 on light" "func_static_1"
}
// entity 6
{
"classname" "light"
"name" "ambient_world"
"origin" "56 -56 120"
"light_center" "0 0 0"
"light_radius" "320 320 320"
"_color" "0.1 0.1 0.1"
"texture" "lights/ambientlightnfo"
}
toggle_hide_show.map.txt (6,159 bytes)
VanishedOne

VanishedOne

08.09.2019 18:06

developer   ~0011837

Last edited: 08.09.2019 18:26

View 2 revisions

I see it's only the electric light that generates these console errors:

WARNING:script/tdm_light_holders.script(212): Thread 'tdm_light_holder::LightsT
oggleResponse': Function 'Close' not supported on entity 'func_static_1'
WARNING:script/tdm_light_holders.script(213): Thread 'tdm_light_holder::LightsT
oggleResponse': Function 'Off' not supported on entity 'func_static_1'
WARNING:script/tdm_light_holders.script(173): Thread 'tdm_light_holder::LightsT
oggleResponse': Function 'Open' not supported on entity 'func_static_1'
WARNING:script/tdm_light_holders.script(174): Thread 'tdm_light_holder::LightsT
oggleResponse': Function 'On' not supported on entity 'func_static_1'

Edit: at the moment my guess is that tdm_light_holder is intercepting STIM_TRIGGER, and tries to do various things to the target but not simply activate it.

Dragofer

Dragofer

08.09.2019 18:13

reporter   ~0011838

That might have to do with what I saw when I targeted doors from lamps: the doors would open/close when the lamps are lit/extinguished. Only wanted to swap the window skins on the doors.
VanishedOne

VanishedOne

08.09.2019 18:33

developer   ~0011839

Apparently calling Open/Close was added in 0002676.

That leads me to http://forums.thedarkmod.com/index.php?/topic/12418-beleaguered-fence-broken-due-to-tdm-change/ -- 'So it would seem like extinguishable light targetting something else do not work anymore. Looks like a tdm change has broken something and most likely this applies to all maps with extinguishable lights targeting something.'

'The reason was the removal of the activateTargets( self ); call. I see that there were problems with that, but I guess setting up a proxy script function should do the trick?'

'The problem with "activateTargets()" is that it is different from On/Off, it always toggles, that is not what the light holder entities are supposed to do, they are supposed to turn things on/off in sync.'
VanishedOne

VanishedOne

08.09.2019 20:34

developer   ~0011840

I'm not sure The Beleagured Fence has quite the original behaviour in its final revision: I found the same as http://forums.thedarkmod.com/index.php?/topic/11298-fan-mission-the-beleaguered-fence-by-sotha-20100623/&do=findComment&comment=323573 even on the highest difficulty, with the door already open. However, I confirmed that the torch *does* still target the door, and that the current behaviour is

torch on -> door opens (or stays open the first time)
torch off -> door closes

while with the original behaviour restored in the light holder script, the torch toggles the door again, so because it now starts open it becomes

torch on -> door closes
torch off -> door opens

The script could be modified to treat lights and light holders specially and simply activate other targets, which is what I'm trying now. Personally I think giving it special handling for frob movers was a mistake; they have nothing to do with light state. However, it's always *possible*, however unlikely, that some FM relies on the current non-toggle behaviour for frob mover targets. As noted, in TBF it does make a difference even if you have to go out of your way to discover it.
VanishedOne

VanishedOne

09.09.2019 14:51

developer   ~0011841

Attaching my altered light holder script in case anyone wants to try it. I haven't tested it thoroughly, but the test map now works (with a nice lack of console spam) and routine gameplay seems normal so far.

tdm_light_holders.script (11,929 bytes)

Issue History

Date Modified Username Field Change
08.09.2019 15:37 Dragofer New Issue
08.09.2019 15:37 Dragofer Tag Attached: Fix
08.09.2019 15:37 Dragofer File Added: toggle_hide_show.map.txt
08.09.2019 18:06 VanishedOne Note Added: 0011837
08.09.2019 18:13 Dragofer Note Added: 0011838
08.09.2019 18:26 VanishedOne Note Edited: 0011837 View Revisions
08.09.2019 18:33 VanishedOne Note Added: 0011839
08.09.2019 19:08 VanishedOne Relationship added related to 0002564
08.09.2019 20:34 VanishedOne Note Added: 0011840
09.09.2019 14:51 VanishedOne File Added: tdm_light_holders.script
09.09.2019 14:51 VanishedOne Note Added: 0011841