initial commit
This commit is contained in:
31
scripts/server/undo.cs
Normal file
31
scripts/server/undo.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// Handles the undo stack for duplicator actions.
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
package NewDuplicator_Server
|
||||
{
|
||||
//Catch things falling off the end of the undo stack
|
||||
function QueueSO::push(%obj, %val)
|
||||
{
|
||||
%lastVal = %obj.val[(%obj.head + 1) % %obj.size];
|
||||
|
||||
if(getFieldCount(%lastVal) == 2)
|
||||
{
|
||||
%str = getField(%lastVal, 1);
|
||||
|
||||
if(
|
||||
%str $= "ND_PLANT"
|
||||
|| %str $= "ND_PAINT"
|
||||
|| %str $= "ND_WRENCH"
|
||||
){
|
||||
%qobj = getField(%lastVal, 0);
|
||||
if(isObject(%qobj)){
|
||||
%qobj.delete();
|
||||
}else{
|
||||
// talk("QueueSO::push(" @ %obj @ ", " @ %val @ ") - Nonexistent object " @ %qobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::push(%obj, %val);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user