Doubled number of sprays that persist per player. Added example spray mod.

This commit is contained in:
Kiri 2023-09-09 18:03:56 -07:00
parent fe249bb6eb
commit 74dfb16dff
6 changed files with 63 additions and 40 deletions

View File

@ -0,0 +1,7 @@
decal SnekSpray_Example
{
pic KSPEA0
animator KiriInstantFade
translucent 0.8
randomflipx
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,7 @@
Sprite "KSPEA0", 250, 150
{
XScale 2
YScale 2
Offset 125, 75
Patch "sprites/sprays/example_spray.png", 0, 0
}

View File

@ -0,0 +1,9 @@
class SnekSpray_Example : SnekTechSprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_Example";
}
}

View File

@ -85,7 +85,7 @@ class SnekTechEventHandler : EventHandler
DoSnekTechBackpackSpawnCheck( DoSnekTechBackpackSpawnCheck(
e.Thing, e.Thing,
SNEKTECH_SPRAYCAN, SNEKTECH_SPRAYCAN,
"Sprayer"); "SnekTechSprayer");
} }
override void CheckReplacement(ReplaceEvent e) override void CheckReplacement(ReplaceEvent e)

View File

@ -21,7 +21,7 @@ enum KiriSprayerStatus
KIRI_SPRAY_WS_PRESSURE = 2 KIRI_SPRAY_WS_PRESSURE = 2
} }
class Sprayer : HDWeapon class SnekTechSprayer : HDWeapon
{ {
default default
{ {
@ -109,7 +109,7 @@ class Sprayer : HDWeapon
if(invoker.GetPressure() < KIRI_SPRAY_PRESSURE_PER_USE) { if(invoker.GetPressure() < KIRI_SPRAY_PRESSURE_PER_USE) {
invoker.owner.A_Log("Not enough pressure to spray."); invoker.owner.A_Log("Not enough pressure to spray.", true);
} else { } else {
@ -118,7 +118,7 @@ class Sprayer : HDWeapon
float zOffset = GunHeight() * 0.8; float zOffset = GunHeight() * 0.8;
FLineTraceData lineTraceData; FLineTraceData lineTraceData;
class<SprayerPattern> sprayerPatternClass = "SprayerPattern"; class<SnekTechSprayerPattern> sprayerPatternClass = "SnekTechSprayerPattern";
// Find the spray pattern class that matches the // Find the spray pattern class that matches the
// player's CVar for selected pattern. // player's CVar for selected pattern.
@ -126,10 +126,10 @@ class Sprayer : HDWeapon
"snektech_spraypattern", "snektech_spraypattern",
invoker.owner.player).GetString(); invoker.owner.player).GetString();
for(int i = 0; i < AllActorClasses.size(); i++) { for(int i = 0; i < AllActorClasses.size(); i++) {
class<SprayerPattern> thisPatternClass = (class<SprayerPattern>)(AllActorClasses[i]); class<SnekTechSprayerPattern> thisPatternClass = (class<SnekTechSprayerPattern>)(AllActorClasses[i]);
if(thisPatternClass) { if(thisPatternClass) {
if(thisPatternClass.GetClassName() == currentSprayCVar) { if(thisPatternClass.GetClassName() == currentSprayCVar) {
sprayerPatternClass = (class<SprayerPattern>)(AllActorClasses[i]); sprayerPatternClass = (class<SnekTechSprayerPattern>)(AllActorClasses[i]);
break; break;
} }
} }
@ -155,10 +155,10 @@ class Sprayer : HDWeapon
CHAN_WEAPON); CHAN_WEAPON);
[success, spawnedThing] = A_SpawnItemEx( [success, spawnedThing] = A_SpawnItemEx(
"SprayerDecalSpawner", "SnekTechSprayerDecalSpawner",
xofs : 0, yofs : 0, zofs : zOffset); xofs : 0, yofs : 0, zofs : zOffset);
SprayerDecalSpawner spawner = SprayerDecalSpawner(spawnedThing); SnekTechSprayerDecalSpawner spawner = SnekTechSprayerDecalSpawner(spawnedThing);
if(success && spawner) { if(success && spawner) {
spawner.A_SetPitch(pitch); spawner.A_SetPitch(pitch);
@ -172,7 +172,7 @@ class Sprayer : HDWeapon
} else { } else {
invoker.owner.A_Log("Not close enough to a wall to spray."); invoker.owner.A_Log("Not close enough to a wall to spray.", true);
} }
} }
@ -298,7 +298,7 @@ class Sprayer : HDWeapon
ret.clear(); ret.clear();
for(int i = 0; i < AllActorClasses.Size(); i++) { for(int i = 0; i < AllActorClasses.Size(); i++) {
class<Actor> c = AllActorClasses[i]; class<Actor> c = AllActorClasses[i];
if(c is "SprayerPattern" && c != "SprayerPattern") { if(c is "SnekTechSprayerPattern" && c != "SnekTechSprayerPattern") {
ret.push(c.GetClassName()); ret.push(c.GetClassName());
} }
} }
@ -324,7 +324,7 @@ class Sprayer : HDWeapon
// Set the new CVar. // Set the new CVar.
CVar.GetCVar("snektech_spraypattern", owner.player).SetString(patternList[newIndex]); CVar.GetCVar("snektech_spraypattern", owner.player).SetString(patternList[newIndex]);
currentPattern = CVar.GetCVar("snektech_spraypattern", owner.player).GetString(); currentPattern = CVar.GetCVar("snektech_spraypattern", owner.player).GetString();
owner.A_Log("Selected spray pattern: "..currentPattern); owner.A_Log("Selected spray pattern: "..currentPattern, true);
// Current pattern is referenced in the help text, so reset // Current pattern is referenced in the help text, so reset
// it. // it.
@ -358,7 +358,7 @@ class Sprayer : HDWeapon
} }
} }
class SprayerDecalSpawner : Actor class SnekTechSprayerDecalSpawner : Actor
{ {
default default
{ {
@ -382,10 +382,10 @@ class SprayerDecalSpawner : Actor
A_SprayDecal(actualDecalName, KIRI_SPRAY_DISTANCE); A_SprayDecal(actualDecalName, KIRI_SPRAY_DISTANCE);
// Figure out a new ID number. // Figure out a new ID number.
ThinkerIterator iter = ThinkerIterator.Create("SprayerDecalSpawner"); ThinkerIterator iter = ThinkerIterator.Create("SnekTechSprayerDecalSpawner");
SprayerDecalSpawner otherSpawner; SnekTechSprayerDecalSpawner otherSpawner;
int maxId = 0; int maxId = 0;
while(otherSpawner = SprayerDecalSpawner(iter.Next())) { while(otherSpawner = SnekTechSprayerDecalSpawner(iter.Next())) {
if(otherSpawner == self) { if(otherSpawner == self) {
continue; continue;
@ -401,14 +401,14 @@ class SprayerDecalSpawner : Actor
thisSprayerId = maxId + 1; thisSprayerId = maxId + 1;
// Clear old sprayers. // Clear old sprayers.
iter = ThinkerIterator.Create("SprayerDecalSpawner"); iter = ThinkerIterator.Create("SnekTechSprayerDecalSpawner");
while(otherSpawner = SprayerDecalSpawner(iter.Next())) { while(otherSpawner = SnekTechSprayerDecalSpawner(iter.Next())) {
if(otherSpawner == self) { if(otherSpawner == self) {
continue; continue;
} }
if(otherSpawner.thisSprayerId < (thisSprayerId - 5)) { if(otherSpawner.thisSprayerId < (thisSprayerId - 10)) {
if(otherSpawner.master == master) { if(otherSpawner.master == master) {
otherSpawner.Destroy(); otherSpawner.Destroy();
} }
@ -429,93 +429,93 @@ class SprayerDecalSpawner : Actor
} }
} }
class SprayerPattern : Actor class SnekTechSprayerPattern : Actor
{ {
string decalName; string decalName;
property decalName:decalName; property decalName:decalName;
default { default {
SprayerPattern.decalName "KiriTestDecal"; SnekTechSprayerPattern.decalName "KiriTestDecal";
} }
} }
class SnekSpray_TransPride : SprayerPattern class SnekSpray_TransPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_TransPride"; SnekTechSprayerPattern.decalName "SnekSpray_TransPride";
} }
} }
class SnekSpray_LesbianPride : SprayerPattern class SnekSpray_LesbianPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_LesbianPride"; SnekTechSprayerPattern.decalName "SnekSpray_LesbianPride";
} }
} }
class SnekSpray_NBPride : SprayerPattern class SnekSpray_NBPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_NBPride"; SnekTechSprayerPattern.decalName "SnekSpray_NBPride";
} }
} }
class SnekSpray_AcePride : SprayerPattern class SnekSpray_AcePride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_AcePride"; SnekTechSprayerPattern.decalName "SnekSpray_AcePride";
} }
} }
class SnekSpray_ProgressPride : SprayerPattern class SnekSpray_ProgressPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_ProgressPride"; SnekTechSprayerPattern.decalName "SnekSpray_ProgressPride";
} }
} }
class SnekSpray_DemiPride : SprayerPattern class SnekSpray_DemiPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_DemiPride"; SnekTechSprayerPattern.decalName "SnekSpray_DemiPride";
} }
} }
class SnekSpray_PanPride : SprayerPattern class SnekSpray_PanPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_PanPride"; SnekTechSprayerPattern.decalName "SnekSpray_PanPride";
} }
} }
class SnekSpray_SwitchPride : SprayerPattern class SnekSpray_SwitchPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_SwitchPride"; SnekTechSprayerPattern.decalName "SnekSpray_SwitchPride";
} }
} }
class SnekSpray_BiPride : SprayerPattern class SnekSpray_BiPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_BiPride"; SnekTechSprayerPattern.decalName "SnekSpray_BiPride";
} }
} }
class SnekSpray_GayPride : SprayerPattern class SnekSpray_GayPride : SnekTechSprayerPattern
{ {
default default
{ {
SprayerPattern.decalName "SnekSpray_GayPride"; SnekTechSprayerPattern.decalName "SnekSpray_GayPride";
} }
} }