Initial everything.
This commit is contained in:
commit
0008313dd7
BIN
Sprite-0002.aseprite
Normal file
BIN
Sprite-0002.aseprite
Normal file
Binary file not shown.
149
zscript.zs
Normal file
149
zscript.zs
Normal file
@ -0,0 +1,149 @@
|
||||
version "4.10"
|
||||
|
||||
|
||||
const HDLD_KIRI_GRETCHENCOUNTER = "kgc";
|
||||
|
||||
class GretchenCounter : HDWeapon
|
||||
{
|
||||
default
|
||||
{
|
||||
+weapon.wimpy_weapon;
|
||||
+inventory.invbar;
|
||||
+hdweapon.droptranslation;
|
||||
+hdweapon.fitsinbackpack;
|
||||
hdweapon.barrelsize 0,0,0;
|
||||
weapon.selectionorder 1014;
|
||||
|
||||
scale 0.6;
|
||||
inventory.icon "SARGF1";
|
||||
inventory.pickupmessage "Picked up a Gretchen Counter.";
|
||||
inventory.pickupsound "derp/crawl";
|
||||
translation 0;
|
||||
tag "Gretchen Counter";
|
||||
|
||||
hdweapon.refid HDLD_KIRI_GRETCHENCOUNTER;
|
||||
}
|
||||
|
||||
float lastReading;
|
||||
|
||||
override double WeaponBulk()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
override bool AddSpareWeapon(actor newowner)
|
||||
{
|
||||
return AddSpareWeaponRegular(newowner);
|
||||
}
|
||||
|
||||
override hdweapon GetSpareWeapon(actor newowner,bool reverse,bool doselect)
|
||||
{
|
||||
return GetSpareWeaponRegular(newowner,reverse,doselect);
|
||||
}
|
||||
|
||||
states
|
||||
{
|
||||
spawn:
|
||||
SARG F -1;
|
||||
stop;
|
||||
|
||||
select0:
|
||||
SARG F 1;
|
||||
goto select0big;
|
||||
|
||||
deselect0:
|
||||
SARG F 1;
|
||||
goto deselect0big;
|
||||
|
||||
ready:
|
||||
SARG F 1 {
|
||||
UpdateDisplay();
|
||||
A_WeaponReady(WRF_NOFIRE | WRF_ALLOWUSER3); // USER3 = MagManager.
|
||||
}
|
||||
|
||||
goto readyend;
|
||||
|
||||
readyend:
|
||||
#### # 0 A_ReadyEnd();
|
||||
#### # 0 A_Jump(256,"ready");
|
||||
}
|
||||
|
||||
action float GetReadingForType(String type_name, float distance_scale)
|
||||
{
|
||||
ThinkerIterator iter = ThinkerIterator.Create(type_name);
|
||||
Actor mo;
|
||||
float totalReading = 0.0;
|
||||
while(mo = Actor(iter.Next()))
|
||||
{
|
||||
//shardCount++;
|
||||
float dist = Distance3D(mo);
|
||||
|
||||
// Convert to "meters" (with a minimum).
|
||||
if(dist < 32) {
|
||||
dist = 32;
|
||||
}
|
||||
|
||||
// Scale distance.
|
||||
dist *= distance_scale;
|
||||
|
||||
|
||||
console.printf("%s", type_name);
|
||||
totalReading += 1.0 / (dist * dist);
|
||||
}
|
||||
|
||||
return totalReading;
|
||||
}
|
||||
|
||||
action void UpdateDisplay()
|
||||
{
|
||||
// console.printf("kjsdcsjkdcnsdjkcnsdkjcnsdc");
|
||||
|
||||
// ThinkerIterator iter = ThinkerIterator.Create("BFGNecroShard");
|
||||
// Actor mo;
|
||||
// int shardCount = 0;
|
||||
// float totalReading = 0.0;
|
||||
// while(mo = BFGNecroShard(iter.Next()))
|
||||
// {
|
||||
// //shardCount++;
|
||||
// float dist = Distance3D(mo);
|
||||
|
||||
// // Convert to "meters" (with a minimum).
|
||||
// if(dist < 32) {
|
||||
// dist = 32;
|
||||
// }
|
||||
// dist /= 32.0;
|
||||
|
||||
// // // Arbitrary scaling.
|
||||
// // dist /= 16.0;
|
||||
|
||||
// totalReading += 1.0 / (dist * dist);
|
||||
// shardCount += 1;
|
||||
// }
|
||||
|
||||
float totalReading =
|
||||
GetReadingForType("BFGNecroShard", 1.0) +
|
||||
GetReadingForType("HDBarrel", 2.0);
|
||||
|
||||
invoker.lastReading = totalReading * 0.01 + invoker.lastReading * 0.99;
|
||||
|
||||
float pct_reading = invoker.lastReading * 2000.0;
|
||||
// if(pct_reading > 1.0) {
|
||||
// pct_reading = 1.0;
|
||||
// }
|
||||
|
||||
|
||||
String meter_str = "";
|
||||
float k;
|
||||
for(k = 0.0; k < 1.0; k += 0.02) {
|
||||
if(k < pct_reading) {
|
||||
meter_str = meter_str.."#";
|
||||
} else {
|
||||
meter_str = meter_str.."_";
|
||||
}
|
||||
}
|
||||
|
||||
console.printf("Shard count: [%s] %f", meter_str, pct_reading);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user