Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array <Actor> demontargets;
- bool demonMorphActive;
- override void WorldThingspawned (worldevent e) {
- if (!e.thing)
- return;
- if (e.thing.bISMONSTER || e.thing.bMISSILE || (e.thing is "PlayerPawn")) {
- demontargets.push(e.thing);
- if (demonMorphActive && !e.thing.FindInventory("PK_DemonWeapon")) {
- e.thing.GiveInventory("PK_SlowMoControl",1);
- }
- }
- if ((e.thing is "PlayerPawn") && !e.thing.FindInventory("PK_DemonMorphControl"))
- e.thing.GiveInventory("PK_DemonMorphControl",1);
- }
- override void WorldTick() {
- if (players[consoleplayer].mo.FindInventory("PK_DemonWeapon"))
- Shader.SetEnabled( players[consoleplayer], "DemonMorph", true);
- else
- Shader.SetEnabled( players[consoleplayer], "DemonMorph", false);
- bool demonMorphFound = false;
- for (int pn = 0; pn < MAXPLAYERS; pn++) {
- if (!playerInGame[pn])
- continue;
- PlayerInfo player = players[pn];
- PlayerPawn mo = player.mo;
- if (!player || !mo)
- continue;
- let weap = PK_DemonWeapon(mo.FindInventory("PK_DemonWeapon"));
- demonMorphFound |= (weap != null);
- }
- if (!demonMorphActive && demonMorphFound) {
- for (int i = 0; i < demontargets.Size(); i++) {
- if (demontargets[i] && !(demontargets[i].FindInventory("PK_SlowMoControl")) && !(demontargets[i].FindInventory("PK_DemonWeapon")))
- demontargets[i].GiveInventory("PK_SlowMoControl",1);
- }
- demonMorphActive = true;
- }
- else if (demonMorphActive && !demonMorphFound) {
- for (int i = 0; i < demontargets.Size(); i++) {
- if (demontargets[i])
- demontargets[i].TakeInventory("PK_SlowMoControl",1);
- }
- demonMorphActive = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement