ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.33k stars 526 forks source link

bIsPuff and damagesource for puffs #2591

Open jekyllgrim opened 1 month ago

jekyllgrim commented 1 month ago

Actors that were spawned by P_SpawnPuff will receive the new bISPUFF flag. This also adds a damagesource field to Actor which stores who fired the puff (similar to PUFFGETSOWNER + target, but unconditionally).

P.S. I don't know why but lline 708 kept being marked as changed for me when I added DamageSource to actor.zs. I'm guessing it has something to do with the fact that the comment on line 708 contains an invalid character.

RicardoLuis0 commented 1 month ago

shouldn't bISPUFF and damagesource be marked as readonly?

jekyllgrim commented 1 month ago

shouldn't bISPUFF and damagesource be marked as readonly?

Since there's no behavior tied to them, right now there's no technical need to do that. But if something gets attached to them in the future, it might be a good idea. Changing them dynamically in ZScript doesn't do anything, so there's no reason not to make them readonly either.

Boondorl commented 3 weeks ago

Since there's no behavior tied to them, right now there's no technical need to do that. But if something gets attached to them in the future, it might be a good idea.

Usually it's best to set it early as, once it's freely modifiable, you can't change that without causing potential breakage. It's simpler to go from readonly -> mutable than it is to go from mutable -> readonly. Though frankly I'd argue knowing if something is a puff and where it came from isn't impactful enough to require that kind of guarding. Generally it's only things that have important side effects (e.g. NOBLOCKMAP) that need to be marked immutable so they can be handled through the proper methods.