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

// This Object is used in Mission "Super Sonic Finish" - M036 - Mission_Zone09
// This Object is also used in its follow-up DLC Mission, "Extreme! Super Sonic Finish" - M104 - DLC_Zone06

// This is normally paired with the SuperSonic Object to make the Player start Super with a certain amount of rings,
// though it can work alone if needed (As S1 does in its LZ Mission)

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

// To be set from the Editor
private alias object.value0 : object.ringCount

// Player Aliases
private alias object.value0 : player.rings


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

event ObjectStartup
	temp0 = 0
	foreach (TypeName[SetRingCount], arrayPos0, ALL_ENTITIES)
		if temp0 == 0
			temp0 = object[arrayPos0].ringCount
		end if
	next
	
	if temp0 != 0
		player[0].rings = temp0
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Global/Items.gif")
	SpriteFrame(-8, -8, 16, 16, 1, 1)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
	SetVariableAlias(ALIAS_VAR_VAL0, "ringCount")
end event
