commit 0008313dd7efbc19d49e27d1363886fd3f177384 Author: Kiri Date: Sun Aug 27 14:32:18 2023 -0700 Initial everything. diff --git a/Sprite-0002.aseprite b/Sprite-0002.aseprite new file mode 100644 index 0000000..54ac2c0 Binary files /dev/null and b/Sprite-0002.aseprite differ diff --git a/zscript.zs b/zscript.zs new file mode 100644 index 0000000..6abcaac --- /dev/null +++ b/zscript.zs @@ -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); + } + +} +