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

[GAME] prop_physics simply disappear when broken all at once with ent_fire command. #327

Open
andris86 opened this issue Sep 11, 2024 · 3 comments
Labels
Bug Something isn't working

Comments

@andris86
Copy link

Describe the bug

This is a Half-Life 2 bug.

There are two ways to break prop_physics entities with ent_fire command:

  • break
  • sethealth 0

Break input breaks all prop_physics in the map. SetHealth 0 breaks only those prop_physics which can be broken with weapons or gravity.

But using both methods results in prop_physics entities simply disappearing when they are all broken at once, no gibs are produced. For example with this command:
ent_fire prop_physics sethealth 0

In opposite, if first parameter contains a target name or !picker, gibs are produced giving effect that object was actually broken.

Steps to reproduce

Steps to reproduce the behavior:

  1. Load a map and find breakable prop_physics entities. Beginning of d2_coast_01 is good example.

  2. Launch ent_fire prop_physics sethealth 0

  3. prop_physics simply disappear.

  4. Restart the map.

  5. Now face one specific physics prop and launch ent_fire !picker sethealth 0

  6. prop_physics now breaks producing gibs.

Expected behavior

When using these commands, prop_physics entities break producing gibs as if broken by a weapon or gravity.

@andris86 andris86 added the Bug Something isn't working label Sep 11, 2024
@TeamSpen210
Copy link

Oooh, this is a very interesting situation. I think this is working as it should. Gibs don't have their own entity, they are simply themselves prop_physics with a spawnflag set to indicate that they're a gib. When entity I/O is executed, it scans through all the entities in the map, checks if they match the name, runs the input code, then continues to the next entity.

So what is happening here is that for each prop in the map, it gets broken, spawning gibs. Those gibs are then added to the end of the entity list. But the IO code is still processing entities, so it keeps going, finds the newly spawned gibs, and promptly fires Break/SetHealth at the gibs too. So they also break, just vanishing.

You can see this pretty clearly if you first do ent_fire prop_physics addoutput "targetname orig_props", so all the existing props get a name. Running the break command with developer 2 on, you'll see all the unnamed gibs receiving the input.

I'm thinking your actual intention is to break all non-gib props, right? I think you'd need to use VScript to check for the spawnflag (SF_PHYSPROP_IS_GIB = 0x400000). Maybe we should have filter_activator_flags, then you could use point_advanced_finder.

@andris86
Copy link
Author

andris86 commented Sep 12, 2024

Thank you very much for answer!

ent_fire prop_physics addoutput "targetname orig_props"

This actually game me an idea how to actually break all physics props and produce gibs. prop_physics actually break when you launch this command afterwards: ent_fire orig_props sethealth 0.

I'm not a modder and I know very little about C++. Instead I am making a .cfg script that breaks everything in the map when executed so this was a major problem. But now it's fixed. Nevertheless, I would still like this issue from Half-Life 2 to be fixed here in Mapbase.

@TeamSpen210
Copy link

Ah yes, that would work. If they're going to be immediately dying it doesn't really matter that other logic wouldn't be able to find their entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants