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

[fixed] Blood on Saw/Spikes/Spiker will be toggled properly on changing g_kidssafe #2271

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Dec 25, 2024

Status

  • READY
  • I will incorporate #2275 , reverting changes done to Spiker layers. Not done, as explained here it introduces more problems.
  • Spiker layer is not behaving correctly after rejoining. Fixed ✔️
  • Spiker can't be hit by builder. Doesn't need fixing. Current dev build has builder always hit tag in GenericComponent.as ✔️
  • Spikes doesn't remember blood after rejoining. Fixed ✔️
  • After being cleaned and blending something again, Saw doesn't become bloody anymore. Fixed ✔️

Description

[fixed] Spikes, Spiker and Saw will properly remember if they are bloody or not and will instantly update their spritelayer when changing g_kidssafe from the menu
[changed] Spikes don't continuously update their animation frame in onTick() via calling onHealthChange()
[added] Water splash from bucket, water bomb or water arrow will remove the blood 
[added] Spiker will show blood on its tip even in closed state
[fixed] Spiker won't look bugged when rejoining server

Fixes #1811
Fixes #2274

This PR is a revive of #1854 with changes.

  • Fixed file conflicts and did some careful changes in order to support the bloody toggle and the clean sparkle effect.
  • The "no flesh gibs when kidssafe is on" part has been split into a separate PR [fixed] No flesh gibs when kidssafe is turned on #2269 .
  • In SplashWater.as, the check for the invincible tag is moved further down.
  • CleanSparkles.as won't produce sparkles if the blob has become bloody again.

@mugg91
Copy link
Contributor Author

mugg91 commented Dec 27, 2024

I'm having trouble fixing Saw in this PR.

This change from April 27 377a47b makes it so Saw only tags "bloody" on server and syncs it.
This works the first time, but when using water splash to remove the "bloody" tag and then blending something again, the tag is not synced to the client anymore. What did the above change fix? I might have to revert it if I can't find another solution.

EDIT:
After reverting the change, everything works normally.
a) New saw, b) saw that has become bloody, c) saw that has become bloody and then cleaned, and d) saw that has become bloody and then cleaned and then become bloody again
will all behave as expected when rejoining the server. The tag is added and removed at the correct time.
Also I don't see why we should run UpdateSprite(this) every tick.
So I'm going ahead with the revert.

@mugg91
Copy link
Contributor Author

mugg91 commented Dec 27, 2024

I tried for 2 hours and can't fix the spiker issue (with the spritelayer). It's in the older PR and vanilla, too.

Just because we would want to use Spike::hidden I don't think it warrants the use of a new common file and two more includes, so I'm reverting this.
@mugg91
Copy link
Contributor Author

mugg91 commented Dec 28, 2024

I tried for another 2 hours. Found that onSetStatic() is run when rejoining, which is kind of stupid but it explains why the attachment point offset gets set to the "hidden" positioning. By checking if there already is a spike attached to spiker, I can set the correct offset:

	AttachmentPoint@ mechanism = this.getAttachments().getAttachmentPointByName("MECHANISM");
	CBlob@ occ = mechanism.getOccupied();
	if (occ is null)
		mechanism.offset = Vec2f(0, -3); // no spike attached yet, set to "hidden" offset
	else
		mechanism.offset = Vec2f(0, occ.get_u8("state") == 0 ? -3 : -7); // spike is attached, set offset depending on current state

Did some other miscellaneous changes.

  • Saving the spiker netid to spike is no longer needed so those code lines are removed.
  • I removed the background spritelayer on spiker and adjusted the possible offset positionings for Spike.
  • I removed that spike would get set static - it's already attached so it's not like it's going to move.
  • Spike now correctly checks if damage is above 0 and we aren't in water, before applying the "bloody" tag, just like the old PR.
  • some code moved from Spike.as to new file SpikeCommon.as for use in Spiker.as and UpdateBloodySprite.as.

I tested with Spiker in various settings and it looks all correct now, even after rejoining. (Phew...)

PR is ready

@mugg91
Copy link
Contributor Author

mugg91 commented Dec 28, 2024

Before

BloodyNotFix.mp4

After

BloodyFix.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spike on Spiker has the wrong positioning when rejoining the server Make water clean bloody things
1 participant