Compare commits

..

No commits in common. "main" and "spraycans" have entirely different histories.

12 changed files with 101 additions and 207 deletions

View File

@ -131,28 +131,3 @@ Caution: May bite.
Loadout code: kac
## Spraypaint Cans
![Spray can sprite](sprites/spraycan/ksprb0.png)
It's just spraypaint.
Use it to cause property damage to the tyrant. Be creative while doing
so!
### How to use
Loadout code: ksp
Shake before attempting to spray.
Use firemode to select spray pattern.
Use the CVar `snektech_spraypattern` to directly set a spray pattern
name.
Use the CVar `snektech_maxspraysperplayer` to set the number of images
each player can spray before old ones are no longer refreshed
(non-refreshed ones will eventually disappear).

View File

@ -1,3 +1,2 @@
server int snektech_spawnflags = 11;
server int snektech_maxspraysperplayer = 10;
user string snektech_spraypattern = "SnekSpray_TransPride";

View File

@ -1,25 +1,20 @@
stretcher KiriInstantFade
fader KiriInstantFade
{
// You don't need this anymore! It's just here because a bunch of
// sprays were already made that use it!
// These numbers are designed to do nothing, and wait a long time
// before doing it. It's a no-op.
GoalX 1.0
GoalY 1.0
StretchStart 9999999.0
StretchTime 9999999.0
DecayStart 60.0
DecayTime 0.0
}
decal KiriTestDecal
{
pic KSPYA0
animator KiriInstantFade
randomflipx
}
decal SnekSpray_TransPride
{
pic KSPYA0
animator KiriInstantFade
randomflipx
translucent 0.8
}
@ -27,6 +22,7 @@ decal SnekSpray_TransPride
decal SnekSpray_LesbianPride
{
pic KSPYB0
animator KiriInstantFade
randomflipx
translucent 0.8
}
@ -34,6 +30,7 @@ decal SnekSpray_LesbianPride
decal SnekSpray_NBPride
{
pic KSPYC0
animator KiriInstantFade
randomflipx
translucent 0.8
}
@ -41,6 +38,7 @@ decal SnekSpray_NBPride
decal SnekSpray_AcePride
{
pic KSPYD0
animator KiriInstantFade
randomflipx
translucent 0.8
}
@ -48,29 +46,34 @@ decal SnekSpray_AcePride
decal SnekSpray_ProgressPride
{
pic KSPYE0
animator KiriInstantFade
translucent 0.8
}
decal SnekSpray_DemiPride
{
pic KSPYF0
animator KiriInstantFade
translucent 0.8
}
decal SnekSpray_PanPride
{
pic KSPYG0
animator KiriInstantFade
translucent 0.8
}
decal SnekSpray_SwitchPride
{
pic KSPYH0
animator KiriInstantFade
}
decal SnekSpray_BiPride
{
pic KSPYI0
animator KiriInstantFade
translucent 0.8
randomflipx
}
@ -78,6 +81,7 @@ decal SnekSpray_BiPride
decal SnekSpray_GayPride
{
pic KSPYJ0
animator KiriInstantFade
translucent 0.8
randomflipx
}

View File

@ -1,6 +0,0 @@
decal SnekSpray_Example
{
pic KSPEA0
translucent 0.8
randomflipx
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

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

View File

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

View File

@ -35,7 +35,7 @@ sprite JMPRD0, 49, 43 {
}
sprite JMPKA0, 48, 32 {
offset 24, 32
offset 24, 16
patch JMPKA0,0,0 { }
}
@ -77,7 +77,7 @@ Sprite "KCPLD0", 130, 108
{
XScale 4
YScale 4
Offset 64, 100
Offset 64, 52
Patch "sprites/cacoplush/cacoplushie_pickup.png", 0, 0
}
@ -111,7 +111,7 @@ Sprite "KCPLG0", 130, 108
Sprite "KSPRB0", 48, 48
{
Offset 24, 48
Offset 24, 24
Patch KSPRB0,0,0 { }
}

View File

@ -8,17 +8,17 @@
const HDLD_KIRI_CACOPLUSHIE = "kac";
const KIRI_CACOPLUSHIE_FAINTED_MONSTER_COOLDOWN = 60;
const KIRI_CACOPLUSHIE_CLASS = "FlyZapper";
const KIRI_CACOPLUSHIE_CLASS = "Trilobite";
// For testing out shield mechanics, if we ever open this up to other
// monster types...
//
// const KIRI_CACOPLUSHIE_CLASS = "Baron";
// const KIRI_CACOPLUSHIE_CLASS = "PainLord";
//
// Hey, want to see something totally broken? Spawn an imp healer and
// raise an army!
//
// const KIRI_CACOPLUSHIE_CLASS = "HealerImp";
// const KIRI_CACOPLUSHIE_CLASS = "Regentipede";
const KIRI_CACOPLUSHIE_WEAPONSTATUS_MONSTER_HEALTH = 1;
const KIRI_CACOPLUSHIE_WEAPONSTATUS_MONSTER_SHIELD = 2;
@ -77,7 +77,6 @@ class KiriCacodemonPlushie : HDWeapon {
"Fido",
"Thor",
"Loki",
"Bucky",
"Taiyo",
"Fluffy",
"Leonardo",
@ -285,8 +284,8 @@ class KiriCacodemonPlushie : HDWeapon {
A_StartSound("potion/chug");
invoker.owner.A_TakeInventory("SecondBlood", 1, TIF_NOTAKEINFINITE);
invoker.setMonsterHealth(
int(invoker.getMonsterHealth() +
invoker.getMonsterMaxHealth() * 0.25));
invoker.getMonsterHealth() +
invoker.getMonsterMaxHealth() * 0.25);
// Throw out a spend blood bag.
A_SpawnItemEx(
@ -304,14 +303,13 @@ class KiriCacodemonPlushie : HDWeapon {
HDBleedingWound hbl = HDBleedingWound.inflict(
invoker.owner, 2, 1, source : invoker.owner);
// FIXME this gets rounded down to 0
//HDPlayerPawn(invoker.owner).bloodloss += 0.1;
HDPlayerPawn(invoker.owner).bloodloss += 0.1;
A_StartSound(invoker.owner.painsound);
invoker.setMonsterHealth(
int(invoker.getMonsterHealth() +
invoker.getMonsterMaxHealth() * 0.1));
invoker.getMonsterHealth() +
invoker.getMonsterMaxHealth() * 0.1);
}
}

View File

@ -84,7 +84,7 @@ class GretchenCounter : HDWeapon
weaponstatus[KGC_BATTERY] > 0)
{
// Discharge rate: 1/1000 chance per tick.
int r = random(0, 16000);
int r = random(0, 4000);
if(r < 2) {
weaponstatus[KGC_BATTERY] -= 1;
}

View File

@ -85,7 +85,7 @@ class SnekTechEventHandler : EventHandler
DoSnekTechBackpackSpawnCheck(
e.Thing,
SNEKTECH_SPRAYCAN,
"SnekTechSprayer");
"Sprayer");
}
override void CheckReplacement(ReplaceEvent e)
@ -100,8 +100,8 @@ class SnekTechEventHandler : EventHandler
DoSnekTechReplacement(
SNEKTECH_GRETCHENCOUNTER,
"PortableStimpack", "GretchenCounter",
2, e);
"Stimpack", "GretchenCounter",
12, e);
DoSnekTechReplacement(
SNEKTECH_JUMPERCABLES,

View File

@ -1,9 +1,6 @@
// ----------------------------------------------------------------------
// Spraypaint cans
// ----------------------------------------------------------------------
//
// Super cheap.
//
// FIXME: Make consts and enums consistent formatting.
// FIXME: Add bulk.
const KIRI_SPRAY_DISTANCE = 96;
const KIRI_SPRAY_SHAKEANIM_MAXANGLE = 20.0;
@ -21,7 +18,7 @@ enum KiriSprayerStatus
KIRI_SPRAY_WS_PRESSURE = 2
}
class SnekTechSprayer : HDWeapon
class Sprayer : HDWeapon
{
default
{
@ -109,14 +106,16 @@ class SnekTechSprayer : HDWeapon
if(invoker.GetPressure() < KIRI_SPRAY_PRESSURE_PER_USE) {
invoker.owner.A_Log("Not enough pressure to spray.", true);
invoker.owner.A_Log("Not enough pressure to spray.");
} else {
Actor spawnedThing;
bool success;
float zOffset = GunHeight() * 0.8;
FLineTraceData lineTraceData;
class<SnekTechSprayerPattern> sprayerPatternClass = "SnekTechSprayerPattern";
class<SprayerPattern> sprayerPatternClass = "SprayerPattern";
// Find the spray pattern class that matches the
// player's CVar for selected pattern.
@ -124,10 +123,10 @@ class SnekTechSprayer : HDWeapon
"snektech_spraypattern",
invoker.owner.player).GetString();
for(int i = 0; i < AllActorClasses.size(); i++) {
class<SnekTechSprayerPattern> thisPatternClass = (class<SnekTechSprayerPattern>)(AllActorClasses[i]);
class<SprayerPattern> thisPatternClass = (class<SprayerPattern>)(AllActorClasses[i]);
if(thisPatternClass) {
if(thisPatternClass.GetClassName() == currentSprayCVar) {
sprayerPatternClass = (class<SnekTechSprayerPattern>)(AllActorClasses[i]);
sprayerPatternClass = (class<SprayerPattern>)(AllActorClasses[i]);
break;
}
}
@ -152,12 +151,15 @@ class SnekTechSprayer : HDWeapon
"kiri/spraycan_spray",
CHAN_WEAPON);
let normal = lineTraceData.HitDir;
let spawnedThing = Actor.Spawn("SnekTechSprayerDecalSpawner", lineTraceData.HitLocation - normal);
SnekTechSprayerDecalSpawner spawner = SnekTechSprayerDecalSpawner(spawnedThing);
[success, spawnedThing] = A_SpawnItemEx(
"SprayerDecalSpawner",
xofs : 0, yofs : 0, zofs : zOffset);
if(spawner) {
spawner.angle = VectorAngle(-normal.x, -normal.y);
SprayerDecalSpawner spawner = SprayerDecalSpawner(spawnedThing);
if(success && spawner) {
spawner.A_SetPitch(pitch);
spawner.A_SetAngle(angle);
spawner.actualDecalName = actualDecalName;
spawner.master = invoker.owner;
@ -167,19 +169,15 @@ class SnekTechSprayer : HDWeapon
} else {
invoker.owner.A_Log("Not close enough to a wall to spray.", true);
invoker.owner.A_Log("Not close enough to a wall to spray.");
}
}
}
goto waiting;
unload:
KSPR A 2 { invoker.CycleSprayPattern(-1); }
goto waiting;
firemode:
KSPR A 2 { invoker.CycleSprayPattern(1); }
KSPR A 2 { invoker.CycleSprayPattern(); }
goto waiting;
waiting:
@ -247,8 +245,8 @@ class SnekTechSprayer : HDWeapon
}
int time = level.TotalTime;
int lastChargedTime = int(round(
float(pressure - KIRI_SPRAY_MAXPRESSURE) / float(KIRI_SPRAY_PRESSURE_DECAY_RATE) + time));
int lastChargedTime = round(
float(pressure - KIRI_SPRAY_MAXPRESSURE) / float(KIRI_SPRAY_PRESSURE_DECAY_RATE) + time);
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = lastChargedTime;
}
@ -297,13 +295,13 @@ class SnekTechSprayer : HDWeapon
ret.clear();
for(int i = 0; i < AllActorClasses.Size(); i++) {
class<Actor> c = AllActorClasses[i];
if(c is "SnekTechSprayerPattern" && c != "SnekTechSprayerPattern") {
if(c is "SprayerPattern" && c != "SprayerPattern") {
ret.push(c.GetClassName());
}
}
}
void CycleSprayPattern(int increment)
void CycleSprayPattern()
{
// Find the current entry in the list of patterns.
String currentPattern = CVar.GetCVar("snektech_spraypattern", owner.player).GetString();
@ -317,27 +315,13 @@ class SnekTechSprayer : HDWeapon
currentIndex = -1;
}
// Increment/decrement the index.
int newIndex = (currentIndex + increment) % patternList.size();
if(newIndex < 0) {
newIndex = patternList.size() - 1;
}
// Increment the index.
int newIndex = (currentIndex + 1) % patternList.size();
// Set the new CVar.
currentPattern = patternList[newIndex];
// first, update the Actual cvar
if (owner.PlayerNumber() == consoleplayer)
CVar.FindCVar("snektech_spraypattern").SetString(currentPattern);
// then update the per-player copy so the help text is correct
CVar.GetCVar("snektech_spraypattern", owner.player).SetString(currentPattern);
// Print it.
owner.A_Log(
String.format(
"Selected spray pattern: (%d/%d) %s",
newIndex + 1, patternList.size(),
currentPattern),
true);
CVar.GetCVar("snektech_spraypattern", owner.player).SetString(patternList[newIndex]);
currentPattern = CVar.GetCVar("snektech_spraypattern", owner.player).GetString();
owner.A_Log("Selected spray pattern: "..currentPattern);
// Current pattern is referenced in the help text, so reset
// it.
@ -366,13 +350,12 @@ class SnekTechSprayer : HDWeapon
return
WEPHELP_FIREMODE .. " Cycle pattern (current: "..currentPattern..").\n"..
WEPHELP_UNLOAD .. " Cycle pattern (backwards).\n"..
WEPHELP_ALTFIRE .. " Shake the can.\n"..
WEPHELP_FIRE .. " "..messages[messageIndex % messages.Size()].."\n";
}
}
class SnekTechSprayerDecalSpawner : Decal
class SprayerDecalSpawner : Actor
{
default
{
@ -386,73 +369,20 @@ class SnekTechSprayerDecalSpawner : Decal
stop;
}
int timeSinceLastSpray;
int thisSprayerId;
String actualDecalName;
Array<Thinker> decals;
void SpawnDecal()
{
Thinker think;
array<thinker> seen;
// find every decal that Isn't ours
let iter = ThinkerIterator.Create('Thinker', STAT_DECAL);
while (think = iter.Next()) {
// BaseDecal isn't exported to zscript so we have to filter this manually
if (think.GetClassName() == 'BaseDecal') {
seen.Push(think);
}
}
// SpawnDecal checks arg0 for the decal ID/name.
// gzdoom passes string arguments as negated string table indices, so
// we need to cast the decal name to a Name (implicitly adding it to
// the string table), then to an int (to get the index).
args[0] = -int(Name(actualDecalName));
Super.SpawnDecal();
// then find every decal that we spawned
iter.Reinit();
while (think = iter.Next()) {
if (think.GetClassName() == 'BaseDecal' &&
seen.Find(think) == seen.Size())
{
decals.Push(think);
}
}
}
override void OnDestroy()
{
for (let i = 0; i < decals.Size(); i++) {
if (decals[i]) {
decals[i].Destroy();
}
}
}
// Decal::BeginPlay deletes the actor
override void BeginPlay() {Actor.BeginPlay();}
override void PostBeginPlay()
{
Super.PostBeginPlay();
// copy A_SprayDecal z offset
setz(pos.z + height / 2);
SpawnDecal();
if (decals.Size() == 0) {
Destroy();
return;
}
A_SprayDecal(actualDecalName, KIRI_SPRAY_DISTANCE);
// Figure out a new ID number.
ThinkerIterator iter = ThinkerIterator.Create("SnekTechSprayerDecalSpawner");
SnekTechSprayerDecalSpawner otherSpawner;
ThinkerIterator iter = ThinkerIterator.Create("SprayerDecalSpawner");
SprayerDecalSpawner otherSpawner;
int maxId = 0;
while(otherSpawner = SnekTechSprayerDecalSpawner(iter.Next())) {
while(otherSpawner = SprayerDecalSpawner(iter.Next())) {
if(otherSpawner == self) {
continue;
@ -468,111 +398,121 @@ class SnekTechSprayerDecalSpawner : Decal
thisSprayerId = maxId + 1;
// Clear old sprayers.
iter = ThinkerIterator.Create("SnekTechSprayerDecalSpawner");
while(otherSpawner = SnekTechSprayerDecalSpawner(iter.Next())) {
iter = ThinkerIterator.Create("SprayerDecalSpawner");
while(otherSpawner = SprayerDecalSpawner(iter.Next())) {
if(otherSpawner == self) {
continue;
}
int maxSpraysPerPlayer =
CVar.GetCVar("snektech_maxspraysperplayer").GetInt();
if(otherSpawner.thisSprayerId <= (thisSprayerId - maxSpraysPerPlayer)) {
if(otherSpawner.thisSprayerId < (thisSprayerId - 5)) {
if(otherSpawner.master == master) {
otherSpawner.Destroy();
}
}
}
}
override void Tick()
{
super.Tick();
timeSinceLastSpray++;
if(timeSinceLastSpray >= 35 * 60) {
A_SprayDecal(actualDecalName, KIRI_SPRAY_DISTANCE);
timeSinceLastSpray = 0;
}
}
}
class SnekTechSprayerPattern : Actor
class SprayerPattern : Actor
{
string decalName;
property decalName:decalName;
default {
SnekTechSprayerPattern.decalName "KiriTestDecal";
SprayerPattern.decalName "KiriTestDecal";
}
}
class SnekSpray_TransPride : SnekTechSprayerPattern
class SnekSpray_TransPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_TransPride";
SprayerPattern.decalName "SnekSpray_TransPride";
}
}
class SnekSpray_LesbianPride : SnekTechSprayerPattern
class SnekSpray_LesbianPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_LesbianPride";
SprayerPattern.decalName "SnekSpray_LesbianPride";
}
}
class SnekSpray_NBPride : SnekTechSprayerPattern
class SnekSpray_NBPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_NBPride";
SprayerPattern.decalName "SnekSpray_NBPride";
}
}
class SnekSpray_AcePride : SnekTechSprayerPattern
class SnekSpray_AcePride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_AcePride";
SprayerPattern.decalName "SnekSpray_AcePride";
}
}
class SnekSpray_ProgressPride : SnekTechSprayerPattern
class SnekSpray_ProgressPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_ProgressPride";
SprayerPattern.decalName "SnekSpray_ProgressPride";
}
}
class SnekSpray_DemiPride : SnekTechSprayerPattern
class SnekSpray_DemiPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_DemiPride";
SprayerPattern.decalName "SnekSpray_DemiPride";
}
}
class SnekSpray_PanPride : SnekTechSprayerPattern
class SnekSpray_PanPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_PanPride";
SprayerPattern.decalName "SnekSpray_PanPride";
}
}
class SnekSpray_SwitchPride : SnekTechSprayerPattern
class SnekSpray_SwitchPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_SwitchPride";
SprayerPattern.decalName "SnekSpray_SwitchPride";
}
}
class SnekSpray_BiPride : SnekTechSprayerPattern
class SnekSpray_BiPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_BiPride";
SprayerPattern.decalName "SnekSpray_BiPride";
}
}
class SnekSpray_GayPride : SnekTechSprayerPattern
class SnekSpray_GayPride : SprayerPattern
{
default
{
SnekTechSprayerPattern.decalName "SnekSpray_GayPride";
SprayerPattern.decalName "SnekSpray_GayPride";
}
}