Skip to content

Instantly share code, notes, and snippets.

@root-cause
Created October 29, 2020 13:35
Show Gist options
  • Save root-cause/49e7b1601d531bb4c8ba18489ff6731c to your computer and use it in GitHub Desktop.
Save root-cause/49e7b1601d531bb4c8ba18489ff6731c to your computer and use it in GitHub Desktop.
const VFX_MODE_DEFAULT = 0;
const VFX_MODE_ALIEN = 1;
const VFX_MODE_CLOWN = 2;
async function requestNamedPtfxAssetAsync(ptfxAssetName) {
mp.game.streaming.requestNamedPtfxAsset(ptfxAssetName);
while (!mp.game.streaming.hasNamedPtfxAssetLoaded(ptfxAssetName)) {
await mp.game.waitAsync();
}
}
Object.defineProperty(mp.game.graphics, "bloodVfxMode", {
get() {
return this._vfxMode || VFX_MODE_DEFAULT;
},
async set(value) {
switch (value) {
case VFX_MODE_ALIEN:
await requestNamedPtfxAssetAsync("scr_rcbarry1");
mp.game.graphics.enableClownBloodVfx(false);
mp.game.graphics.enableAlienBloodVfx(true);
break;
case VFX_MODE_CLOWN:
await requestNamedPtfxAssetAsync("scr_rcbarry2");
mp.game.graphics.enableAlienBloodVfx(false);
mp.game.graphics.enableClownBloodVfx(true);
break;
default:
value = VFX_MODE_DEFAULT;
mp.game.graphics.enableAlienBloodVfx(false);
mp.game.graphics.enableClownBloodVfx(false);
break;
}
this._vfxMode = value;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment