Git Repos / fte_dogmode / qc / misc / target_autosave.qc
Last update to this file was on 2024-06-15 at 19:50.
Show target_autosave.qc
//==============================================================================
// target_autosave -- from Copper
//==============================================================================
//======================================================================
// forward declarations
//======================================================================
#ifdef SSQC
// target_autosave
void(entity client, string savename) target_autosave_save;
void() target_autosave_toggle; // not used? -- CEV
void() target_autosave_use;
void(entity e) target_autosave_init;
void() target_autosave;
#endif
//------------------------------------------------------------------------------
/*QUAKED target_autosave (1 .0 .5) (-8 -8 -8) (8 8 8)
Saves the game when triggered by a player. Never appears in multiplayer. the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb.
Keys:
"message" change save file name, defaults to 'auto'
*/
/*FGD
@Pointclass base(Target, Targetname, Appearflags) color(255 0 128) size(32 32 32) = target_autosave :
"Saves the game when triggered by a player. Never appears in multiplayer.
the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb."
[
message(string) : "Change save filename" : "auto"
]
*/
//----------------------------------------------------------------------
// class target_autosave: base_mapentity
// {
#ifdef SSQC
//--------------------------------------------------------------
// autosave -- was in client.qc
//--------------------------------------------------------------
void(entity client, string savename) target_autosave_save =
{
// autosavename = savename;
stuffcmd (client, "echo Autosaving...; wait; save ");
stuffcmd (client, savename);
stuffcmd (client, "\n");
};
//--------------------------------------------------------------
void() target_autosave_toggle =
{
local entity e = world;
local float printed = FALSE;
do
{
e = findfloat (e, classtype, CT_TARGET_AUTOSAVE);
if (!e)
break;
if (e.estate == STATE_ACTIVE)
{
e.estate = STATE_INACTIVE;
if (!printed)
{
bprint ("Autosaves disabled\n");
printed = TRUE;
}
}
else
{
e.estate = STATE_ACTIVE;
if (!printed)
{
bprint ("Autosaves reenabled\n");
printed = TRUE;
}
}
}
while (e != world);
};
//--------------------------------------------------------------
void() target_autosave_use =
{
if (self.estate != STATE_ACTIVE)
return;
if (self.enemy)
{
activator = self.enemy;
self.enemy = world;
}
if (activator.classtype != CT_PLAYER)
return;
// make sure an autosave fired from a player start doesn't
// happen too early
if (time < 2)
{
/*
if (serverflags & SVFL_RESPAWNING)
{
dprint("RESPAWNING flag set, skipping "
"autosave\n");
return;
}
*/
self.enemy = activator;
self.think = target_autosave_use;
self.nextthink = 2;
return;
}
// sound(activator, CHAN_VOICE, "misc/sav.wav", 0.3, ATTN_NORM);
target_autosave_save (activator, self.message);
};
//--------------------------------------------------------------
void(entity e) target_autosave_init =
{
e.classname = "target_autosave";
e.classtype = CT_TARGET_AUTOSAVE;
base_mapentity_init (e);
if (e.message == __NULL__ || e.message == "")
e.message = "auto";
// precache_sound2 ("misc/sav.wav");
e.use = target_autosave_use;
};
//--------------------------------------------------------------
void() target_autosave =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
if (deathmatch || coop)
{
remove (self);
return;
}
target_autosave_init (self);
};
#endif
// };
Return to the top of this page or return to the overview of this repo.
Log target_autosave.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-06-15 | Major update, committing as-is, will have bugs | cev | +4 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +44 | -29 |
2024-01-31 | Class based monster refactor & start projectiles | cev | +2 | -2 |
2024-01-09 | Continue OO / Class-based refactor | cev | +62 | -45 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +92 | -74 |
2023-12-02 | More refactoring & moving, begin adding mdls & snd | cev | +96 |
Return to the top of this page or return to the overview of this repo.