-- Foxes to use as NPCs, with example of use (as multicolored ones) for map 37
-- By Gregory_House, Jazz, Not Fox N.P.C. and Skye
-- To have these in your own level, just place them as map things via a map editor, then in Part 2 here give them the desired attributes (can be map-specific if you so desire, in that case use an if condition for your gamemap) through the MobjSpawn hook.


-- ###Part 1: Declarations###

rawset(_G, "adealership", {})

freeslot(
"MT_ALYCOL",
"SPR_ALYC",
"S_ALYSSC")

mobjinfo[MT_ALYCOL] = {
doomednum = 2701,
spawnstate = S_ALYSSC,
spawnhealth = 1000,
seestate = S_ALYSSC,
seesound = sfx_none,
reactiontime = 8,
attacksound = sfx_none,
painstate = S_NULL,
painchance = 1*FRACUNIT,
painsound = sfx_none,
meleestate = S_NULL,
missilestate = S_NULL,
deathstate = S_NULL,
xdeathstate = S_NULL,
deathsound = sfx_none,
speed = 10*FRACUNIT,
radius = 16*FRACUNIT,
height = 48*FRACUNIT,
dispoffset = 0,
mass = 100,
damage = 50*FRACUNIT,
activesound = sfx_none,
flags = MF_SOLID,
raisestate = S_NULL
}

states[S_ALYSSC] = {
        sprite = SPR_ALYC,
        frame = A,
        tics = -1,        
        var1 = 0,
        var2 = 0,
        nextstate = S_ALYSSC
}



-- ###Part 2: Hooks and related functions###

addHook("MobjThinker", function(mo) do
  if leveltime == 0
    local sector = #mo.subsector.sector
    if sector == 181
      mo.scale = 3*FRACUNIT
      mo.color = SKINCOLOR_CERULEAN
    elseif sector == 1756
      mo.scale = 2*FRACUNIT/3
	  mo.color = P_RandomRange(1, 62)
    else          
      mo.color = P_RandomRange(1, 62)	      
	end
  end
end
end,MT_ALYCOL)