Cleanup and stuff.
This commit is contained in:
parent
a521cd6074
commit
13a99783b3
1
TODO.md
1
TODO.md
@ -15,3 +15,4 @@
|
|||||||
- ~~Frag counter in loadout starts with no battery~~
|
- ~~Frag counter in loadout starts with no battery~~
|
||||||
- ~~Organize source_data~~
|
- ~~Organize source_data~~
|
||||||
|
|
||||||
|
- Loadout code descriptions (hdweapon.loadoutcodes)
|
||||||
|
@ -9,7 +9,8 @@ enum SnekTechSpawnFlags
|
|||||||
{
|
{
|
||||||
SNEKTECH_GRETCHENCOUNTER = 0,
|
SNEKTECH_GRETCHENCOUNTER = 0,
|
||||||
SNEKTECH_JUMPERCABLES = 1,
|
SNEKTECH_JUMPERCABLES = 1,
|
||||||
SNEKTECH_CACOPLUSHIE = 2
|
SNEKTECH_CACOPLUSHIE = 2,
|
||||||
|
SNEKTECH_SPRAYCAN = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
class SnekTechEventHandler : EventHandler
|
class SnekTechEventHandler : EventHandler
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
|
|
||||||
// FIXME: Make consts and enums consistent formatting.
|
// FIXME: Make consts and enums consistent formatting.
|
||||||
|
|
||||||
const KIRI_SPRAYDISTANCE = 96;
|
const KIRI_SPRAY_DISTANCE = 96;
|
||||||
const KIRI_SPRAY_SHAKEANIM_MAXANGLE = 20.0;
|
const KIRI_SPRAY_SHAKEANIM_MAXANGLE = 20.0;
|
||||||
const KIRI_SPRAY_MAXPAINT = 50;
|
const KIRI_SPRAY_MAXPAINT = 50;
|
||||||
const KIRI_SPRAY_MAXPRESSURE = 100;
|
const KIRI_SPRAY_MAXPRESSURE = 100;
|
||||||
const KIRI_SPRAY_PRESSUREBUILDSCALE = 20;
|
const KIRI_SPRAY_PRESSUREBUILDSCALE = 20;
|
||||||
const KIRI_SPRAY_PRESSURE_PER_USE = (KIRI_SPRAY_MAXPRESSURE / 2);
|
const KIRI_SPRAY_PRESSURE_PER_USE = (KIRI_SPRAY_MAXPRESSURE / 2);
|
||||||
|
|
||||||
|
const HDLD_KIRI_SPRAYCAN = "ksp";
|
||||||
|
|
||||||
enum KiriSprayerStatus
|
enum KiriSprayerStatus
|
||||||
{
|
{
|
||||||
KIRISPRAYER_PAINT = 1,
|
KIRI_SPRAY_WS_PAINT = 1,
|
||||||
KIRISPRAYER_PRESSURE = 2
|
KIRI_SPRAY_WS_PRESSURE = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
class Sprayer : HDWeapon
|
class Sprayer : HDWeapon
|
||||||
@ -28,6 +30,14 @@ class Sprayer : HDWeapon
|
|||||||
|
|
||||||
+INVENTORY.PERSISTENTPOWER;
|
+INVENTORY.PERSISTENTPOWER;
|
||||||
+INVENTORY.INVBAR;
|
+INVENTORY.INVBAR;
|
||||||
|
|
||||||
|
// inventory.icon "KSPRB0";
|
||||||
|
inventory.pickupsound "kiri/spraycan_rattle";
|
||||||
|
inventory.pickupmessage "Picked up some spraypaint cans.";
|
||||||
|
// inventory.amount 1;
|
||||||
|
// inventory.maxamount 100;
|
||||||
|
|
||||||
|
hdweapon.refid HDLD_KIRI_SPRAYCAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
states
|
states
|
||||||
@ -57,20 +67,20 @@ class Sprayer : HDWeapon
|
|||||||
// Taper off pressure increase amount based on how much
|
// Taper off pressure increase amount based on how much
|
||||||
// pressure is in there already.
|
// pressure is in there already.
|
||||||
float pressureIncreaseScale = 1.0 - (
|
float pressureIncreaseScale = 1.0 - (
|
||||||
float(invoker.weaponstatus[KIRISPRAYER_PRESSURE]) /
|
float(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE]) /
|
||||||
float(KIRI_SPRAY_MAXPRESSURE));
|
float(KIRI_SPRAY_MAXPRESSURE));
|
||||||
pressureIncreaseScale *= pressureIncreaseScale;
|
pressureIncreaseScale *= pressureIncreaseScale;
|
||||||
|
|
||||||
// Add pressure.
|
// Add pressure.
|
||||||
invoker.weaponstatus[KIRISPRAYER_PRESSURE] +=
|
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] +=
|
||||||
random(0,
|
random(0,
|
||||||
KIRI_SPRAY_PRESSUREBUILDSCALE
|
KIRI_SPRAY_PRESSUREBUILDSCALE
|
||||||
* invoker.weaponstatus[KIRISPRAYER_PAINT]
|
* invoker.weaponstatus[KIRI_SPRAY_WS_PAINT]
|
||||||
/ KIRI_SPRAY_MAXPAINT);
|
/ KIRI_SPRAY_MAXPAINT);
|
||||||
|
|
||||||
// Cap pressure amount.
|
// Cap pressure amount.
|
||||||
if(invoker.weaponstatus[KIRISPRAYER_PRESSURE] > KIRI_SPRAY_MAXPRESSURE) {
|
if(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] > KIRI_SPRAY_MAXPRESSURE) {
|
||||||
invoker.weaponstatus[KIRISPRAYER_PRESSURE] = KIRI_SPRAY_MAXPRESSURE;
|
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] = KIRI_SPRAY_MAXPRESSURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -82,7 +92,7 @@ class Sprayer : HDWeapon
|
|||||||
fire:
|
fire:
|
||||||
KSPR A 2 {
|
KSPR A 2 {
|
||||||
|
|
||||||
if(invoker.weaponstatus[KIRISPRAYER_PRESSURE] < KIRI_SPRAY_PRESSURE_PER_USE) {
|
if(invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] < KIRI_SPRAY_PRESSURE_PER_USE) {
|
||||||
|
|
||||||
invoker.owner.A_Log("Not enough pressure to spray.");
|
invoker.owner.A_Log("Not enough pressure to spray.");
|
||||||
|
|
||||||
@ -117,7 +127,7 @@ class Sprayer : HDWeapon
|
|||||||
// Find a wall to spray on.
|
// Find a wall to spray on.
|
||||||
bool traceHit = LineTrace(
|
bool traceHit = LineTrace(
|
||||||
angle,
|
angle,
|
||||||
KIRI_SPRAYDISTANCE,
|
KIRI_SPRAY_DISTANCE,
|
||||||
pitch,
|
pitch,
|
||||||
flags : TRF_THRUACTORS,
|
flags : TRF_THRUACTORS,
|
||||||
offsetz : zOffset,
|
offsetz : zOffset,
|
||||||
@ -141,8 +151,8 @@ class Sprayer : HDWeapon
|
|||||||
spawner.actualDecalName = actualDecalName;
|
spawner.actualDecalName = actualDecalName;
|
||||||
spawner.master = invoker.owner;
|
spawner.master = invoker.owner;
|
||||||
|
|
||||||
invoker.weaponstatus[KIRISPRAYER_PRESSURE] -= KIRI_SPRAY_PRESSURE_PER_USE;
|
invoker.weaponstatus[KIRI_SPRAY_WS_PRESSURE] -= KIRI_SPRAY_PRESSURE_PER_USE;
|
||||||
invoker.weaponstatus[KIRISPRAYER_PAINT] -= 1;
|
invoker.weaponstatus[KIRI_SPRAY_WS_PAINT] -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -175,15 +185,25 @@ class Sprayer : HDWeapon
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override bool AddSpareWeapon(actor newowner)
|
||||||
|
{
|
||||||
|
return AddSpareWeaponRegular(newowner);
|
||||||
|
}
|
||||||
|
|
||||||
|
override HDWeapon GetSpareWeapon(actor newowner, bool reverse, bool doselect)
|
||||||
|
{
|
||||||
|
return GetSpareWeaponRegular(newowner, reverse, doselect);
|
||||||
|
}
|
||||||
|
|
||||||
override void InitializeWepStats(bool idfa)
|
override void InitializeWepStats(bool idfa)
|
||||||
{
|
{
|
||||||
super.InitializeWepStats(idfa);
|
super.InitializeWepStats(idfa);
|
||||||
|
|
||||||
weaponstatus[KIRISPRAYER_PRESSURE] = 0;
|
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = 0;
|
||||||
|
|
||||||
// Add a little bit of randomness to the amount of paint in
|
// Add a little bit of randomness to the amount of paint in
|
||||||
// the can.
|
// the can.
|
||||||
weaponstatus[KIRISPRAYER_PAINT] =
|
weaponstatus[KIRI_SPRAY_WS_PAINT] =
|
||||||
KIRI_SPRAY_MAXPAINT
|
KIRI_SPRAY_MAXPAINT
|
||||||
- random(0, KIRI_SPRAY_MAXPAINT / 10);
|
- random(0, KIRI_SPRAY_MAXPAINT / 10);
|
||||||
}
|
}
|
||||||
@ -194,9 +214,9 @@ class Sprayer : HDWeapon
|
|||||||
|
|
||||||
// Gradually decay pressure.
|
// Gradually decay pressure.
|
||||||
if(random(0, 256) < 4) {
|
if(random(0, 256) < 4) {
|
||||||
weaponstatus[KIRISPRAYER_PRESSURE] -= 1;
|
weaponstatus[KIRI_SPRAY_WS_PRESSURE] -= 1;
|
||||||
if(weaponstatus[KIRISPRAYER_PRESSURE] < 0) {
|
if(weaponstatus[KIRI_SPRAY_WS_PRESSURE] < 0) {
|
||||||
weaponstatus[KIRISPRAYER_PRESSURE] = 0;
|
weaponstatus[KIRI_SPRAY_WS_PRESSURE] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,12 +227,12 @@ class Sprayer : HDWeapon
|
|||||||
{
|
{
|
||||||
// Current pressure (top bar).
|
// Current pressure (top bar).
|
||||||
statusBar.DrawWepNum(
|
statusBar.DrawWepNum(
|
||||||
weaponstatus[KIRISPRAYER_PRESSURE],
|
weaponstatus[KIRI_SPRAY_WS_PRESSURE],
|
||||||
KIRI_SPRAY_MAXPRESSURE, posy:-10);
|
KIRI_SPRAY_MAXPRESSURE, posy:-10);
|
||||||
|
|
||||||
// Total paint remaining (bottom bar).
|
// Total paint remaining (bottom bar).
|
||||||
statusBar.DrawWepNum(
|
statusBar.DrawWepNum(
|
||||||
weaponstatus[KIRISPRAYER_PAINT],
|
weaponstatus[KIRI_SPRAY_WS_PAINT],
|
||||||
KIRI_SPRAY_MAXPAINT);
|
KIRI_SPRAY_MAXPAINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +267,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();
|
||||||
invoker.owner.A_Log("Selected spray pattern: "..currentPattern);
|
owner.A_Log("Selected spray pattern: "..currentPattern);
|
||||||
|
|
||||||
// Current pattern is referenced in the help text, so reset
|
// Current pattern is referenced in the help text, so reset
|
||||||
// it.
|
// it.
|
||||||
@ -297,7 +317,7 @@ class SprayerDecalSpawner : Actor
|
|||||||
override void PostBeginPlay()
|
override void PostBeginPlay()
|
||||||
{
|
{
|
||||||
Super.PostBeginPlay();
|
Super.PostBeginPlay();
|
||||||
A_SprayDecal(actualDecalName, KIRI_SPRAYDISTANCE);
|
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("SprayerDecalSpawner");
|
||||||
@ -342,7 +362,7 @@ class SprayerDecalSpawner : Actor
|
|||||||
timeSinceLastSpray++;
|
timeSinceLastSpray++;
|
||||||
|
|
||||||
if(timeSinceLastSpray >= 35 * 60) {
|
if(timeSinceLastSpray >= 35 * 60) {
|
||||||
A_SprayDecal(actualDecalName, KIRI_SPRAYDISTANCE);
|
A_SprayDecal(actualDecalName, KIRI_SPRAY_DISTANCE);
|
||||||
timeSinceLastSpray = 0;
|
timeSinceLastSpray = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user