View Issue Details

IDProjectCategoryView StatusLast Update
0001084The Dark ModCodingpublic01.02.2021 14:13
ReporterSneaksieDave Assigned Totels  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.09Fixed in VersionTDM 2.09 
Summary0001084: Grabber doesn't allow frobbing after held item is removed
DescriptionSee discussion starting here for details:
https://forums.thedarkmod.com/index.php?/topic/8208-scripting-how-to-discussions/&tab=comments#comment-162092

In short, after a held junk item is remove()'d, frobbing to carry another item (perhaps any frobbing...) no longer functions. It must be IN the hand when this remove() occurs (if I throw the knife instead into the remove() field, I can still frob).
TagsNo tags attached.

Relationships

related to 0005302 resolvedstgatilov House of Locked Secrets: crash because inventory cursor points to empty category 

Activities

nbohr1more

nbohr1more

29.01.2021 04:44

developer   ~0013562

This might be fixed by 2993 and 5302
nbohr1more

nbohr1more

30.01.2021 12:41

developer   ~0013580

Now I have replication steps:

1) Start a small map such as Closemouthed Shadows
2) Open the console and invoke "spawn atdm:moveable_kitchen_knife_chef"
3) Identify the knife via g_showEntityInfo ( Should be idMoveable_atdm:moveable_kitchen_knife_chef_149 )
4) Pickup the knife
5) Open the console and invoke "remove idMoveable_atdm:moveable_kitchen_knife_chef_149"
6) Try to frob any other object

Not yet fixed...
nbohr1more

nbohr1more

30.01.2021 12:57

developer   ~0013581

Class.cpp > Event_Remove

(Current code)

CGrabber* grabber = gameLocal.m_Grabber;
    if (grabber)
    {
        // tels: If we remove a currently grabbed entity,
        // force the grabber to forget it
        idEntity *ent = grabber->GetSelected();
        if (ent == this)
        {
            grabber->Forget( ent );
        }
    }
nbohr1more

nbohr1more

30.01.2021 17:18

developer   ~0013583

game/gamesys/SysCmds > Cmd_Remove_f does not have this grabber check
nbohr1more

nbohr1more

30.01.2021 17:41

developer   ~0013584

Last edited: 30.01.2021 21:32

Rev 9094 (2.09 beta)

I suspect that this was fixed for scripts long ago. Now the console command is also fixed.
nbohr1more

nbohr1more

30.01.2021 21:25

developer   ~0013585

Originally fixed by Tels in Rev 2974
stgatilov

stgatilov

31.01.2021 16:16

administrator   ~0013589

Hey, nbohr1more, what's the point of rev 9094?

I would hardly call it "a fix", since it only affects console command.
The script code can call simple "remove" to kill entity directly, in which case your fix won't work.
Hot-reload can also remove entity directly without "remove" command.

If the problem is still here, it must be fixed in idEntity destructor.
This is the code which is surely called in all the possible cases.
nbohr1more

nbohr1more

31.01.2021 16:47

developer   ~0013590

To my understanding, the script will call the Event_Remove which has the fix that Tels provided.

My change simply allows a mapper to remove a held entity via the console without unexpectedly finding
that they can no longer frob things. It is much less important.

If there are other cases where this can happen we should harden them too.

I expect we would apply a similar fix to the "bad readable xdata causes grabber to break" issue.
stgatilov

stgatilov

31.01.2021 16:51

administrator   ~0013591

Last edited: 31.01.2021 16:52

Wouldn't it better to move Tels's fix to the destructor of idEntity?
There is already some other code (thee pieces now, all in different places) which checks if the removed entity is used by grabber.

UPDATE: by the way, now mappers use hot reload, and will soon complain about the same when they remove entity in DR.
nbohr1more

nbohr1more

31.01.2021 17:04

developer   ~0013592

Last edited: 31.01.2021 17:18

Yes, it would be better to move all these to the destructor "idEntity::~idEntity".
nbohr1more

nbohr1more

31.01.2021 17:31

developer   ~0013593

Alright this block needs to be rearranged for a purely held entity:

if (gameLocal.m_Grabber && gameLocal.m_Grabber->GetEquipped() == this)
    {
        if ( spawnArgs.GetBool("shoulderable") )
        {
            gameLocal.Printf("Grabber: Forcefully unshouldering %s because it will be removed.\n", GetName() );
            gameLocal.m_Grabber->UnShoulderBody(this);
        }
        gameLocal.Printf("Grabber: Forcefully dequipping %s because it will be removed.\n", GetName() );
        gameLocal.m_Grabber->Forget(this);
    }
nbohr1more

nbohr1more

31.01.2021 23:55

developer   ~0013595

Last edited: 01.02.2021 00:07

Here is the revised block:

if (gameLocal.m_Grabber )
    {
        
        if ( gameLocal.m_Grabber->GetEquipped() == this )
        {

            if ( spawnArgs.GetBool("shoulderable") )
            {
                gameLocal.Printf("Grabber: Forcefully unshouldering %s because it will be removed.\n", GetName() );
                gameLocal.m_Grabber->UnShoulderBody(this);
            }
        gameLocal.Printf("Grabber: Forcefully dequipping %s because it will be removed.\n", GetName() );
        gameLocal.m_Grabber->Forget(this);

       }
       else if ( gameLocal.m_Grabber->GetSelected() == this )
       {
        gameLocal.m_Grabber->Forget(this);
       }
    }


Rev 9097
stgatilov

stgatilov

01.02.2021 13:45

administrator   ~0013599

Yes, this is much better.
Thanks!

By the way, could you please look why your editor does not support editorconfig?
The lines you added have spaces instead of tabs.
Normally, this should not happen for decent editors, because of .editorconfig rules.
stgatilov

stgatilov

01.02.2021 13:58

administrator   ~0013601

Committed minor cleanup in svn rev 9099.

Issue History

Date Modified Username Field Change
04.09.2008 22:24 SneaksieDave New Issue
15.05.2020 03:21 nbohr1more Description Updated
29.01.2021 04:40 nbohr1more Relationship added related to 0005302
29.01.2021 04:44 nbohr1more Note Added: 0013562
29.01.2021 04:44 nbohr1more Status new => feedback
29.01.2021 04:44 nbohr1more Target Version => TDM 2.09
30.01.2021 12:41 nbohr1more Note Added: 0013580
30.01.2021 12:42 nbohr1more Status feedback => confirmed
30.01.2021 12:57 nbohr1more Note Added: 0013581
30.01.2021 17:18 nbohr1more Note Added: 0013583
30.01.2021 17:41 nbohr1more Note Added: 0013584
30.01.2021 17:42 nbohr1more Status confirmed => resolved
30.01.2021 17:42 nbohr1more Resolution open => fixed
30.01.2021 17:42 nbohr1more Fixed in Version => TDM 2.09
30.01.2021 21:25 nbohr1more Note Added: 0013585
30.01.2021 21:27 nbohr1more Assigned To => tels
30.01.2021 21:27 nbohr1more Fixed in Version TDM 2.09 => TDM 1.00
30.01.2021 21:27 nbohr1more Target Version TDM 2.09 =>
30.01.2021 21:32 nbohr1more Note Edited: 0013584
31.01.2021 16:16 stgatilov Note Added: 0013589
31.01.2021 16:47 nbohr1more Note Added: 0013590
31.01.2021 16:51 stgatilov Note Added: 0013591
31.01.2021 16:52 stgatilov Note Edited: 0013591
31.01.2021 17:04 nbohr1more Note Added: 0013592
31.01.2021 17:12 nbohr1more Note Edited: 0013592
31.01.2021 17:18 nbohr1more Note Edited: 0013592
31.01.2021 17:31 nbohr1more Note Added: 0013593
31.01.2021 23:55 nbohr1more Note Added: 0013595
01.02.2021 00:07 nbohr1more Note Edited: 0013595
01.02.2021 13:45 stgatilov Note Added: 0013599
01.02.2021 13:58 stgatilov Note Added: 0013601
01.02.2021 14:13 nbohr1more Fixed in Version TDM 1.00 => TDM 2.09
01.02.2021 14:13 nbohr1more Target Version => TDM 2.09