// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: 2P Vs Deleter Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// ========================
// Aliases
// ========================

private alias object.propertyValue : object.deleteCount


// ========================
// Events
// ========================

event ObjectUpdate
	// There's nothing here
end event


event ObjectDraw
	// The sequel to nothing here: nothing there
end event


event ObjectStartup
	foreach (TypeName[2P Vs Deleter], arrayPos0, ALL_ENTITIES)
		if options.vsMode == false
			// If not in 2P, then delete these multiplayer helper objects
			// (These objects are normally just platforms or etc, in place of lifts and other un-reusable objects)
			temp0 = 0
			arrayPos1 = arrayPos0
			while temp0 < object[arrayPos0].deleteCount
				arrayPos1++
				object[arrayPos1].type = TypeName[Blank Object]
				temp0++
			loop
		end if
	next
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite(0)

	if editor.showGizmos == true
		editor.drawingOverlay = true
		
		temp0 = 0
		arrayPos1 = object.entityPos
		while temp0 < object.deleteCount
			arrayPos1++
			DrawLine(object.xpos, object.ypos, object[arrayPos1].xpos, object[arrayPos1].ypos, 0xFF, 0xFF, 0x00)
			temp0++
		loop
		
		editor.drawingOverlay = false
	end if
end event


event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-8, -8, 16, 16, 168, 18) // "trigger" - #0
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "deleteCount")
end event
