swwmgz_m/zscript/items/swwm_collectibles.zsc
Marisa the Magician 80db58b0d0 Bump zscript ver to 4.14.1, plus a whole lot of stuff.
- Try to get rid of all implicit casts from string to name, color or class.
 - Use FindClass where needed.
 - Used a map in a case where a dictionary was unneeded.
 - Use new bounce flags where needed.
 - Replace Legacy of Rust weapons/ammo.
2025-03-13 14:50:58 +01:00

289 lines
6.5 KiB
Text

// collectible items that may drop sometimes
Class SWWMCollectible : Inventory abstract
{
Mixin SWWMUseToPickup;
Mixin SWWMRotatingPickup;
Mixin SWWMUnrealStyleDrop;
meta int avail;
bool propagated;
meta Class<SWWMItemGesture> gesture;
meta String getline;
Property Availability : avail;
Property GestureWeapon : gesture;
Property GetLine : getline;
// minimum gametype requirements
enum EAvailability
{
AVAIL_None,
AVAIL_All,
AVAIL_Heretic,
AVAIL_Hexen
};
Default
{
Inventory.PickupSound "menu/buyinv";
Inventory.Amount 1;
Inventory.MaxAmount 1;
Inventory.PickupFlash 'SWWMCyanPickupFlash';
SWWMCollectible.Availability AVAIL_All;
+INVENTORY.UNTOSSABLE;
+INVENTORY.UNDROPPABLE;
+INVENTORY.UNCLEARABLE;
+INVENTORY.AUTOACTIVATE;
+INVENTORY.NEVERRESPAWN;
+FLOATBOB;
+DONTGIB;
FloatBobStrength 0.25;
}
bool ValidGame() const
{
if ( avail == AVAIL_None ) return false;
if ( avail == AVAIL_All ) return true;
if ( (avail == AVAIL_Heretic) && (gameinfo.gametype&GAME_Raven) ) return true;
if ( (avail == AVAIL_Hexen) && (gameinfo.gametype&GAME_Hexen) ) return true;
return false;
}
override bool ShouldSpawn()
{
// don't spawn in-game if on deathmatch or the wrong IWAD
if ( deathmatch || !ValidGame() ) return false;
return true;
}
override string PickupMessage()
{
if ( Stamina > 0 )
return StringTable.Localize(PickupMsg)..String.Format(" \cj(\cg¥\cf%d\cj)\c-",Stamina);
return Super.PickupMessage();
}
override bool Use( bool pickup )
{
if ( Owner.player && !propagated && (!pickup || CVar.GetCVar('swwm_collectanim',Owner.player).GetBool()) )
SWWMGesture.SetSpecialGesture(Owner.player.mo,gesture);
// clean up the flag
propagated = false;
return false;
}
override void AttachToOwner( Actor other )
{
Super.AttachToOwner(other);
// count how many we have, set progress accordingly
int nc = 0, cnc = 0;
foreach ( cls:AllActorClasses )
{
let c = (Class<SWWMCollectible>)(cls);
if ( !c || (c == 'SWWMCollectible') ) continue;
let def = GetDefaultByType(c);
// check that we can collect it in this IWAD
if ( !def.ValidGame() ) continue;
nc++;
}
for ( Inventory i=other.inv; i; i=i.inv )
{
if ( !(i is 'SWWMCollectible') ) continue;
cnc++;
}
SWWMUtility.AchievementProgress("allcoll",cnc,other.player);
// we're only attaching to the other players
if ( propagated ) return;
// give credit
if ( other.player && (Stamina > 0) )
{
if ( other.player == players[consoleplayer] ) SWWMScoreObj.SpawnAtActorBunch(Stamina,other);
SWWMCredits.Give(other.player,Stamina);
}
// send to all other players
for ( int i=0; i<MAXPLAYERS; i++ )
{
if ( !playeringame[i] || !players[i].mo || (i == other.PlayerNumber()) )
continue;
let c = SWWMCollectible(Spawn(GetClass(),pos));
c.propagated = true;
if ( !c.CallTryPickup(players[i].mo) )
c.Destroy();
}
}
States
{
Spawn:
XZW1 A -1;
Stop;
}
}
// The collectibles
Class GenericCube : SWWMCollectible
{
Default
{
Tag "$T_PERFECTLYGENERIC";
Inventory.PickupMessage "$T_PERFECTLYGENERIC";
SWWMCollectible.GestureWeapon 'GenericCubeGesture';
SWWMCollectible.GetLine "cubeget";
Stamina 1000;
}
}
Class AkariProject : SWWMCollectible
{
Default
{
Tag "$T_AKARIPROJECT";
Inventory.PickupMessage "$T_AKARIPROJECT";
SWWMCollectible.GestureWeapon 'AkariProjectGesture';
SWWMCollectible.GetLine "akariget";
Stamina 2000;
}
}
Class LoveSignalsCD : SWWMCollectible
{
Default
{
Tag "$T_LOVESIGNALS";
Inventory.PickupMessage "$T_LOVESIGNALS";
SWWMCollectible.GestureWeapon 'LoveSignalsCDGesture';
SWWMCollectible.GetLine "signalsget";
Stamina 3000;
}
}
Class NutatcoBar : SWWMCollectible
{
Default
{
Tag "$T_NUTATCO";
Inventory.PickupMessage "$T_NUTATCO";
SWWMCollectible.GestureWeapon 'NutatcoBarGesture';
SWWMCollectible.GetLine "nutatcoget";
Stamina 200;
}
}
Class FrispyCorn : SWWMCollectible
{
Default
{
Tag "$T_FRISPYCORN";
Inventory.PickupMessage "$T_FRISPYCORN";
SWWMCollectible.GestureWeapon 'FrispyCornGesture';
SWWMCollectible.GetLine "frispyget";
Stamina 400;
}
}
Class SayaBean : SWWMCollectible
{
Default
{
Tag "$T_SAYABEAN";
Inventory.PickupMessage "$T_SAYABEAN";
SWWMCollectible.GestureWeapon 'SayaBeanGesture';
SWWMCollectible.GetLine "sayaget";
Stamina 5000;
}
}
Class MothPlushy : SWWMCollectible
{
bool activated; // she knows where you are
bool present; // she's here (TBD 1.5)
int gigglecnt, uses;
override void DoEffect()
{
Super.DoEffect();
if ( gigglecnt > 0 )
{
gigglecnt--;
if ( gigglecnt == 30 )
A_StartSound("andira/appear",CHAN_VOICE,CHANF_UI|CHANF_NOSTOP|CHANF_OVERLAP,1.,0.);
if ( gigglecnt == 0 )
Console.MidPrint(smallfont,StringTable.Localize("$D_ANDIRA"),true);
}
}
Default
{
Tag "$T_MOTHPLUSH";
Inventory.PickupMessage "$T_MOTHPLUSH";
SWWMCollectible.GestureWeapon 'MothPlushyGesture';
SWWMCollectible.GetLine "mothget";
Stamina 7000;
}
}
// 1.3 Saya's Mug
Class SayasMug : SWWMCollectible
{
Default
{
Tag "$T_SAYASMUG";
Inventory.PickupMessage "$T_SAYASMUG";
SWWMCollectible.GestureWeapon 'SayasMugGesture';
SWWMCollectible.GetLine "mugget";
Stamina 1000;
}
}
// Heretic
Class DemoPlush : SWWMCollectible
{
Default
{
Tag "$T_DEMOPLUSH";
Inventory.PickupMessage "$T_DEMOPLUSH";
SWWMCollectible.Availability AVAIL_Heretic;
SWWMCollectible.GestureWeapon 'DemoPlushGesture';
SWWMCollectible.GetLine "demoget";
Stamina 6000;
}
}
// TBD 1.4 Blahaj
// Hexen
Class KirinSippy : SWWMCollectible
{
Default
{
Tag "$T_PEACH";
Inventory.PickupMessage "$T_PEACH";
SWWMCollectible.Availability AVAIL_Hexen;
SWWMCollectible.GestureWeapon 'KirinSippyGesture';
SWWMCollectible.GetLine "peachget";
Stamina 300;
}
}
Class MilkBreads : SWWMCollectible
{
Default
{
Tag "$T_MILKBREAD";
Inventory.PickupMessage "$T_MILKBREAD";
SWWMCollectible.Availability AVAIL_Hexen;
SWWMCollectible.GestureWeapon 'MilkBreadsGesture';
SWWMCollectible.GetLine "breadget";
Stamina 900;
}
}
Class KirinManga : SWWMCollectible
{
Default
{
Tag "$T_KIRINMANGA";
Inventory.PickupMessage "$T_KIRINMANGA";
SWWMCollectible.Availability AVAIL_Hexen;
SWWMCollectible.GestureWeapon 'KirinMangaGesture';
SWWMCollectible.GetLine "mangaget";
Stamina 1600;
}
}
Class KirinPlush : SWWMCollectible
{
Default
{
Tag "$T_KIRINPLUSH";
Inventory.PickupMessage "$T_KIRINPLUSH";
SWWMCollectible.Availability AVAIL_Hexen;
SWWMCollectible.GestureWeapon 'KirinPlushGesture';
SWWMCollectible.GetLine "kiringet";
Stamina 8000;
}
}