KevinBlast/marble/server/scripts/easterEgg.cs

61 lines
1.6 KiB
C#

//-----------------------------------------------------------------------------
// Kevin Blast Sources
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Easter Egg
//-----------------------------------------------------------------------------
datablock AudioProfile(GotEggSfx)
{
filename = "~/data/sound/gotEggVoice.wav";
description = AudioDefault3d;
preload = true;
};
datablock AudioProfile(GotThatEggAlready)
{
filename = "~/data/sound/gotpowerup.wav";
description = AudioDefault3d;
preload = true;
};
function EasterEgg::onPickup(%this,%obj,%user,%amount)
{
Parent::onPickup(%this,%obj,%user,%amount);
%user.client.onFoundEasterEgg(%amount);
return true;
}
function EasterEgg::saveState(%this,%obj,%state)
{
%state.object[%obj.getId()] = %obj.isHidden();
}
function EasterEgg::restoreState(%this,%obj,%state)
{
%obj.hide(%state.object[%obj.getId()]);
}
//-----------------------------------------------------------------------------
datablock ItemData(EasterEgg)
{
// Mission editor category
category = "Misc";
// it's dumb but there isn't a GenericInventoryItem class;
// and we want onPickup to fire.
className = "PowerUp";
// Basic Item properties
shapeFile = "~/data/shapes/items/easteregg.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
// Dynamic properties defined by the scripts
pickupName = "the Easter Egg!";
maxInventory = 1;
noRespawn = true;
noPickupMessage = true;
};