Initial spraycan implementation.
This commit is contained in:
parent
b98e8cd96f
commit
4d5e7f1d0e
12
decaldef.txt
Normal file
12
decaldef.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fader KiriInstantFade
|
||||||
|
{
|
||||||
|
DecayStart 60.0
|
||||||
|
DecayTime 0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
decal KiriTestDecal
|
||||||
|
{
|
||||||
|
pic KSPYA0
|
||||||
|
animator KiriInstantFade
|
||||||
|
randomflipx
|
||||||
|
}
|
BIN
source_data/spray_transpride.aseprite
Normal file
BIN
source_data/spray_transpride.aseprite
Normal file
Binary file not shown.
BIN
source_data/spraycan_base.kra
Normal file
BIN
source_data/spraycan_base.kra
Normal file
Binary file not shown.
BIN
source_data/spraycan_base.png
Normal file
BIN
source_data/spraycan_base.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
BIN
source_data/spraycan_metallic.png
Normal file
BIN
source_data/spraycan_metallic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
BIN
source_data/spraycan_model.blend
Normal file
BIN
source_data/spraycan_model.blend
Normal file
Binary file not shown.
BIN
source_data/spraycan_render.png
Normal file
BIN
source_data/spraycan_render.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
BIN
source_data/spraycan_render_pickup.png
Normal file
BIN
source_data/spraycan_render_pickup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
BIN
source_data/spraycan_roughness.png
Normal file
BIN
source_data/spraycan_roughness.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
16
textures.txt
16
textures.txt
@ -106,3 +106,19 @@ Sprite "KCPLG0", 130, 108
|
|||||||
Patch "sprites/cacoplush/cacoplushie_glowing3.png", 0, 0
|
Patch "sprites/cacoplush/cacoplushie_glowing3.png", 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Spray can
|
||||||
|
|
||||||
|
Sprite "KSPYA0", 250, 150
|
||||||
|
{
|
||||||
|
XScale 2
|
||||||
|
YScale 2
|
||||||
|
Offset 125, 75
|
||||||
|
Patch KSPYA0,0,0 { }
|
||||||
|
}
|
||||||
|
|
||||||
|
Sprite "KSPRB0", 48, 48
|
||||||
|
{
|
||||||
|
Offset 24, 24
|
||||||
|
Patch KSPRB0,0,0 { }
|
||||||
|
}
|
||||||
|
@ -4,3 +4,4 @@ version "4.10"
|
|||||||
#include "zscript/jumpercables.zs"
|
#include "zscript/jumpercables.zs"
|
||||||
#include "zscript/gretchencounter.zs"
|
#include "zscript/gretchencounter.zs"
|
||||||
#include "zscript/cacoplushie.zs"
|
#include "zscript/cacoplushie.zs"
|
||||||
|
#include "zscript/spraycan.zs"
|
||||||
|
142
zscript/spraycan.zs
Normal file
142
zscript/spraycan.zs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
|
||||||
|
const KIRI_SPRAYDISTANCE = 96;
|
||||||
|
|
||||||
|
class Sprayer : HDWeapon
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
radius 2;
|
||||||
|
height 4;
|
||||||
|
+SpriteAngle;
|
||||||
|
Scale 0.4;
|
||||||
|
|
||||||
|
+hdweapon.fitsinbackpack;
|
||||||
|
+weapon.wimpy_weapon;
|
||||||
|
|
||||||
|
+INVENTORY.PERSISTENTPOWER;
|
||||||
|
+INVENTORY.INVBAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
states
|
||||||
|
{
|
||||||
|
spawn:
|
||||||
|
KSPR B -1;
|
||||||
|
stop;
|
||||||
|
|
||||||
|
ready:
|
||||||
|
KSPR A 1 { A_WeaponReady(WRF_ALL); A_WeaponBusy(false); }
|
||||||
|
goto readyend;
|
||||||
|
|
||||||
|
fire:
|
||||||
|
KSPR A 2 {
|
||||||
|
|
||||||
|
Actor spawnedThing;
|
||||||
|
bool success;
|
||||||
|
float zOffset = GunHeight() * 0.8;
|
||||||
|
FLineTraceData lineTraceData;
|
||||||
|
|
||||||
|
bool traceHit = LineTrace(
|
||||||
|
angle,
|
||||||
|
KIRI_SPRAYDISTANCE,
|
||||||
|
pitch,
|
||||||
|
flags : TRF_THRUACTORS,
|
||||||
|
offsetz : zOffset,
|
||||||
|
data : lineTraceData);
|
||||||
|
|
||||||
|
if(traceHit) {
|
||||||
|
|
||||||
|
if(lineTraceData.HitLine) {
|
||||||
|
|
||||||
|
console.printf("spray spray spray");
|
||||||
|
[success, spawnedThing] = A_SpawnItemEx(
|
||||||
|
"SprayerDecalSpawner",
|
||||||
|
xofs : 0, yofs : 0, zofs : zOffset);
|
||||||
|
|
||||||
|
if(success) {
|
||||||
|
spawnedThing.A_SetPitch(pitch);
|
||||||
|
spawnedThing.A_SetAngle(angle);
|
||||||
|
spawnedThing.master = invoker.owner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto waiting;
|
||||||
|
|
||||||
|
waiting:
|
||||||
|
KSPR A 5;
|
||||||
|
KSPR A 0 A_Refire("waiting");
|
||||||
|
goto ready;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SprayerDecalSpawner : Actor
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
+nogravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
states
|
||||||
|
{
|
||||||
|
spawn:
|
||||||
|
TNT1 A 0;
|
||||||
|
stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
int timeSinceLastSpray;
|
||||||
|
int thisSprayerId;
|
||||||
|
|
||||||
|
override void PostBeginPlay()
|
||||||
|
{
|
||||||
|
Super.PostBeginPlay();
|
||||||
|
console.printf("SPRAY");
|
||||||
|
A_SprayDecal("KiriTestDecal", KIRI_SPRAYDISTANCE);
|
||||||
|
|
||||||
|
// Figure out a new ID number.
|
||||||
|
ThinkerIterator iter = ThinkerIterator.Create("SprayerDecalSpawner");
|
||||||
|
SprayerDecalSpawner otherSpawner;
|
||||||
|
int maxId = 0;
|
||||||
|
while(otherSpawner = SprayerDecalSpawner(iter.Next())) {
|
||||||
|
|
||||||
|
if(otherSpawner == self) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep track of the highest ID.
|
||||||
|
if(otherSpawner.thisSprayerId > maxId) {
|
||||||
|
if(otherSpawner.master == master) {
|
||||||
|
maxId = otherSpawner.thisSprayerId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
thisSprayerId = maxId + 1;
|
||||||
|
|
||||||
|
// Clear old sprayers.
|
||||||
|
iter = ThinkerIterator.Create("SprayerDecalSpawner");
|
||||||
|
while(otherSpawner = SprayerDecalSpawner(iter.Next())) {
|
||||||
|
|
||||||
|
if(otherSpawner == self) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(otherSpawner.thisSprayerId < (thisSprayerId - 5)) {
|
||||||
|
if(otherSpawner.master == master) {
|
||||||
|
otherSpawner.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Tick()
|
||||||
|
{
|
||||||
|
timeSinceLastSpray++;
|
||||||
|
|
||||||
|
if(timeSinceLastSpray >= 35 * 60) {
|
||||||
|
A_SprayDecal("KiriTestDecal", KIRI_SPRAYDISTANCE);
|
||||||
|
timeSinceLastSpray = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user