Saffith wrote:That sort of raises another point: weapon hitboxes are set up in the constructor, and weapons created by scripts always start out facing upward. Their hitboxes don't vary depending on their direction like built-in ones would. I don't know what if anything should be done about that. I'm not sure anyone's ever even noticed, let alone complained about it.
That is a very valid point, and we should consider fixing it. Most of the time, users that scritpt weapons are content to correct the hitbox manually, but it would be better to start them with defaults that match their internal counterparts base don direction. This in theory, may affect some scripts, but it can be handled by the script metadata for 2.60. Alternatively, I can just modify CreateLWeaponDx to include this, and leave CreateLWeapon alone.
In fact, that function may already fix this issue, but I doubt it. CreateLWeaponDx() is a new internal function, for the Screen pointer that forwards data from the itemclass information from an item to generate a weapon, as Lwpns.add() normally does. That forwards the sprites and other data values that a weapon uses when added, but I do not think that the hitbox sizing is part of that information as-is. The present arg order is :
[FONT=Courier New]CreateLWeaponDx(int type, int parentitem); [/FONT]
This could also be solved at the std.zh level, by adding a function that sets the hitboxes based on constants. That may be the most desirable method, as it does not force the change on anyone. IDK what is best here.
ywkls wrote:Whoops. I didn't understand what you meant the first time.EW_BEAM and EW_MAGIC both seem to share the rotated hitbox properties. At a guess, I'd say that this is either what makes them hurt Link, or is just that LW_REFBEAM and LW_REFMAGIC are basicially generated in the same fashion.
Either way, looks like this may not be a bug after all; just an oddity.
Not a problem. When you initially brought this up, I thought that you meant that a script generated reflected weapon had its hitbox rotated from what an internal reflected weapon (i.e, the identical type) has in the engine, but the issue that Saffith raises is quite valid. Script generated weapons do not inherit properly anyway.
Reflected weapons are a bit strange in general though, so your confusion is understandable. The hitboxes are designed to fit around the default sprites, in theory. Some of this is going to be fixed by having weapon editor stuff in the future. In theory, I could make it possible to set these things in 2.54, but I would rather wait to see how this develops, so that I do not make a huge mess out of feature migration, and the need to preserve older stuff. (e.g. Adding weapon hitoffsets to the item editor, then needing to preserve that feature forever.)