
//
// Quake 2 game definition file (.fgd)
// for Worldcraft 1.6 and above
// Updated February 1998 (By autolycus)
// Updated November 30 2013 (By Amran. Corrected errors, added missing keys and in-editor model support)
// Updated August 14 2014 (By Amran. Added Wait and delay keys to lights)
//
// written by autolycus
// Revised by Amran
//

//Note, target and killtarget do not seem to work together entirely in standard Quake. With some entitys only one can be used, but not both.

//
// worldspawn
//

@SolidClass = worldspawn : "World entity"
[
	message(string) : "Text on entering the world"
	worldtype(choices) : "Ambience" : 0 =
	[
		0 : "Medieval"
		1 : "Runic (metal)"
		2 : "Present (base)"
	]
	sounds(integer) : "CD track to play" : 1
	light(integer) : "Default light level"
]


//
// base marker definitions
//

@baseclass = Appearflags
[
	spawnflags(Flags) =
	[
		256 : "Not in Easy" : 0
		512 : "Not in Normal" : 0
		1024 : "Not in Hard" : 0
		2048 : "Not in Deathmatch" : 0
	]
]

@baseclass = Targetname [ targetname(target_source) : "Name" ]
@baseclass = Target [ target(target_destination) : "Target" ]


//
// player starts, deathmatch, coop, teleport
//

@baseclass base(Appearflags) size(-16 -16 -32, 16 16 32) color(0 255 0) = PlayerClass []

@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_start.mdl") = info_player_start : "Player 1 start" []
@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_dmstart.mdl") = info_player_deathmatch : "Player deathmatch start" []
@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_startcoop.mdl") = info_player_coop : "Player cooperative start" []
@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_start.mdl") = info_player_start2 : "Player episode return point" []
@PointClass base(PlayerClass, Targetname) size(-16 -16 0, 16 16 64) studio("fgd/q1/entities/ent_teledest.mdl") = info_teleport_destination : "Teleport destination" []

@PointClass base(Appearflags) studio("fgd/q1/entities/ent_infonull.mdl") = info_null : "info_null (spotlight target)"
[
	targetname(target_source) : "Name" 
]
@PointClass base(info_null) studio("fgd/q1/entities/ent_intermission.mdl") = info_notnull : "info_notnull"[]


//
// CTF stuff
//

@PointClass size(-16 -16 -24, 16 16 32) base(Appearflags) studio("fgd/q1/flag.mdl") = item_flag_team1 : "CTF: Red Team Flag" []
@PointClass size(-16 -16 -24, 16 16 32) base(Appearflags) studio("fgd/q1/flag2.mdl") = item_flag_team2 : "CTF: Blue Team Flag" []
@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_team1.mdl") = info_player_team1 : "CTF: Red team base start" []
@PointClass base(PlayerClass) studio("fgd/q1/entities/ent_team2.mdl") = info_player_team2 : "CTF: Blue team base start" []

@PointClass base(Appearflags) size(-16 -16 -16, 16 16 16) studio("fgd/q1/entities/ent_team2.mdl") = info_intermission : "Intermission camera"
[
	mangle(string) : "Mangle (x y z)"
]


//
// items
//

@baseclass base(Appearflags, Targetname, Target) size(0 0 0, 32 32 32) color(80 0 200) = Ammo
[
	spawnflags(flags) = 
	[
		1 : "Large box" : 0
	]
]
@PointClass base(Ammo) studio("fgd/q1/b_batt0.mdl") = item_cells : "Thunderbolt ammo" []
@PointClass base(Ammo) studio("fgd/q1/b_rock0.mdl") = item_rockets : "Rockets" []
@PointClass base(Ammo) studio("fgd/q1/b_shell0.mdl") = item_shells : "Shells" []
@PointClass base(Ammo) studio("fgd/q1/b_nail0.mdl") = item_spikes : "Nailgun ammo" []

@PointClass base(Ammo) studio("fgd/q1/b_batt1.mdl") = item_cells_large_mc : "Thunderbolt ammo large" []
@PointClass base(Ammo) studio("fgd/q1/b_rock1.mdl") = item_rockets_large_mc : "Rockets large" []
@PointClass base(Ammo) studio("fgd/q1/b_shell1.mdl") = item_shells_large_mc : "Shells large" []
@PointClass base(Ammo) studio("fgd/q1/b_nail1.mdl") = item_spikes_large_mc : "Nailgun ammo large" []

@baseclass base(Appearflags, Targetname, Target) size(-16 -16 -24, 16 16 32) color(80 0 200) = Item[]
@PointClass base(Item) size(0 0 0, 32 32 16) studio("fgd/q1/b_bh25.mdl") = item_health : "Health pak" 
[
	spawnflags(flags) = 
	[
		1 : "Rotten" : 0
		2 : "Megahealth" : 0
	]
]

@PointClass base(item_health) size(0 0 0, 32 32 16) studio("fgd/q1/b_bh10.mdl") = item_health_rotten_mc : "Rotten health" []
@PointClass base(item_health) size(0 0 0, 32 32 32) studio("fgd/q1/b_bh100.mdl") = item_health_mega_mc : "Mega health" []

@PointClass base(Item) studio("fgd/q1/suit.mdl") = item_artifact_envirosuit : "Environmental protection suit" []
@PointClass base(Item) studio("fgd/q1/quaddama.mdl") = item_artifact_super_damage : "Quad damage" []
@PointClass base(Item) studio("fgd/q1/invulner.mdl") = item_artifact_invulnerability : "Pentagram of Protection" []
@PointClass base(Item) studio("fgd/q1/invisibl.mdl") = item_artifact_invisibility : "Ring of Shadows" []

@baseclass base(Appearflags, Targetname, Target) size(-16 -16 -24, 16 16 32) color(80 0 200) = Armor[]
@PointClass base(Armor) studio("fgd/q1/armor.mdl") = item_armorInv : "200% armor (Red)" []
@PointClass base(Armor) studio("fgd/q1/armor2.mdl") = item_armor2 : "150% armor (Yellow)" []
@PointClass base(Armor) studio("fgd/q1/armor3.mdl") = item_armor1 : "100% armor (Green)" []

@baseclass base(Appearflags, Targetname, Target) size(-16 -16 -24, 16 16 32) color(80 0 200) = Keys[]
@PointClass base(Keys) studio("fgd/q1/w_s_key.mdl") = item_key1 : "Silver key" []
@PointClass base(Keys) studio("fgd/q1/w_g_key.mdl") = item_key2 : "Gold key" []
@PointClass base(Keys) studio("fgd/q1/end1.mdl") = item_sigil : "Sigil" 
[
	spawnflags(Flags) =
	[
		1 : "Episode 1" : 1
		2 : "Episode 2" : 0
		4 : "Episode 3" : 0
		8 : "Episode 4" : 0
	]
]


//
// weapons
//

@baseclass base(Appearflags, Targetname, Target) size(-16 -16 0, 16 16 32) color(80 0 200) = Weapon []
@PointClass base(Weapon) studio("fgd/q1/g_shot.mdl") = weapon_supershotgun : "Super shotgun" []
@PointClass base(Weapon) studio("fgd/q1/g_nail.mdl") = weapon_nailgun : "Nailgun" []
@PointClass base(Weapon) studio("fgd/q1/g_nail2.mdl") = weapon_supernailgun : "Perforator" []
@PointClass base(Weapon) studio("fgd/q1/g_rock.mdl") = weapon_grenadelauncher : "Grenade launcher" []
@PointClass base(Weapon) studio("fgd/q1/g_rock2.mdl") = weapon_rocketlauncher : "Rocket launcher" []
@PointClass base(Weapon) studio("fgd/q1/g_light.mdl") = weapon_lightning : "Thunderbolt" []


//
// Enemies
//

@baseclass base(Appearflags, Targetname, Target) color(220 0 0) = Monster 
[
	spawnflags(Flags) = 
	[
		1 : "Ambush" : 0
	]
]
@PointClass base(Monster) size(-16 -16 -24, 16 16 40) studio("fgd/q1/soldier.mdl") = monster_army : "Grunt" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 40) studio("fgd/q1/dog.mdl") = monster_dog : "Nasty Doggie" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 64) studio("fgd/q1/ogre.mdl") = monster_ogre : "Ogre" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 64) studio("fgd/q1/ogre.mdl") = monster_ogre_marksman : "Ogre marksman" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 40) studio("fgd/q1/knight.mdl") = monster_knight : "Knight" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 40) studio("fgd/q1/hknight.mdl") = monster_hell_knight : "Hell knight" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 40) studio("fgd/q1/wizard.mdl") = monster_wizard : "Scrag" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 64) studio("fgd/q1/demon.mdl") = monster_demon1 : "Fiend" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 64) studio("fgd/q1/shambler.mdl") = monster_shambler : "Shambler" []
@PointClass base(Monster) size(-128 -128 -24, 128 128 256) studio("fgd/q1/boss.mdl") = monster_boss : "Chthon" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 40) studio("fgd/q1/enforcer.mdl") = monster_enforcer : "Enforcer" []
@PointClass base(Monster) size(-32 -32 -24, 32 32 48) studio("fgd/q1/shalrath.mdl") = monster_shalrath : "Shalrath" []
@PointClass base(Monster) size(32 32 48) studio("fgd/q1/tarbaby.mdl") = monster_tarbaby : "Tarbaby" []
@PointClass base(Monster) size(32 32 48) studio("fgd/q1/fish.mdl") = monster_fish : "Rotfish" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 32) studio("fgd/q1/oldone.mdl") = monster_oldone : "Shub-Niggurath" []
@PointClass base(Monster) size(-16 -16 -24, 16 16 32) studio("fgd/q1/zombie.mdl") = monster_zombie : "Zombie" 
[
	spawnflags(Flags) = 
	[
		1 : "Crucified" : 0
		2 : "Ambush" : 0
	]
]

@PointClass base(monster_zombie) size(-16 -16 -24, 16 16 32) studio("fgd/q1/zombiecruc.mdl") = monster_zombie_crucified_mc : "Crucified Zombie" []


//
// lights
//

@baseclass = Light [
	light(integer) : "Brightness" : 200
	wait(integer) : "Wait (decay rate)"
	delay(integer) : "Delay (attenuation type)"
	style(Choices) : "Appearance" : 0 =
	[
		0 : "Normal"
		10: "Fluorescent flicker"
		2 : "Slow, strong pulse"
		11: "Slow pulse, noblack"
		5 : "Gentle pulse"
		1 : "Flicker A"
		6 : "Flicker B"
		3 : "Candle A"
		7 : "Candle B"
		8 : "Candle C"
		4 : "Fast strobe"
		9 : "Slow strobe"
	]
	spawnflags(Flags) =
	[
		1 : "Initially dark" : 0
	]
]
@PointClass base(Light, Targetname, Target) iconsprite("fgd/q1/entities/ent_light.spr") = light : "Invisible lightsource"[]
@PointClass base(Light, Targetname) iconsprite("fgd/q1/entities/ent_light.spr") = light_fluoro : "Fluorescent light"[]
@PointClass base(Light, Targetname) iconsprite("fgd/q1/entities/ent_light.spr") = light_fluorospark : "Sparking fluorescent light"[]
@PointClass base(Light, Targetname) iconsprite("fgd/q1/entities/ent_globe.spr") = light_globe : "Globe light" []
@PointClass base(Light, Targetname) size(-10 -10 -12, 12 12 18) studio("fgd/q1/flame2b.mdl") = light_flame_large_yellow : "Large yellow flame" []
@PointClass base(Light, Targetname) size(-10 -10 -12, 12 12 18) studio("fgd/q1/flame2.mdl") = light_flame_small_yellow : "Small yellow flame" []
@PointClass base(Light, Targetname) size(-10 -10 -12, 12 12 18) studio("fgd/q1/flame2.mdl") = light_flame_small_white : "Small white flame" []
@PointClass base(Light, Targetname) size(-10 -10 -20, 10 10 20) studio("fgd/q1/flame.mdl") = light_torch_small_walltorch : "Small walltorch" []


//
// misc
//

@PointClass base(Appearflags) studio("fgd/q1/entities/ent_air.mdl") = air_bubbles : "Air bubbles" []
@PointClass base(Appearflags, Targetname) size(-16 -16 -16, 16 16 16) studio("fgd/q1/entities/ent_lightning.mdl") = event_lightning : "Chthon's lightning" []
@PointClass base(Appearflags) studio("fgd/q1/entities/ent_fireball.mdl") = misc_fireball : "Small fireball"
[
	speed(integer) : "Speed" : 40
]
@PointClass base(Appearflags) size(0 0 0, 32 32 64) studio("fgd/q1/b_explob.mdl") = misc_explobox : "Large nuclear container" []
@PointClass base(Appearflags) size(0 0 0, 32 32 32) studio("fgd/q1/b_explo.mdl") = misc_explobox2 : "Small nuclear container" []

@PointClass base(Appearflags, Targetname) studio("fgd/q1/entities/ent_trapspike.mdl") = trap_spikeshooter : "Triggered shooter" 
[
	spawnflags(Flags) = 
	[
		1 : "Superspike" : 0
		2 : "Laser" : 0
	]
]
@PointClass base(trap_spikeshooter) studio("fgd/q1/entities/ent_trapshoot.mdl") = trap_shooter : "Continuous shooter"
[
	wait(integer) : "Time between shots" : 1
	nextthink(integer) : "Delay before first shot" : 1
]
@PointClass base(Appearflags, Targetname, Target) size(-8 -8 -8, 8 8 8) studio("fgd/q1/teleport.mdl") = misc_teleporttrain : "Spiked ball teleporter"[]


//
// ambient sounds
//

@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_drip : "Dripping sound" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_drone : "Engine/machinery sound" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_comp_hum : "Computer background sounds" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_flouro_buzz : "Fluorescent buzzing sound" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_light_buzz : "Buzzing sound from light" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_suck_wind : "Wind sound" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_swamp1 : "Frogs croaking" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_swamp2 : "Frogs croaking B" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = ambient_thunder : "Thunder sound" []
@PointClass base(Appearflags) iconsprite("fgd/q1/entities/ent_speaker.spr") = misc_noisemaker : "starts lots of sounds" []


// 
// moving things
//

@baseclass base(Appearflags, Targetname, Target) = Door
[
	speed(integer) : "Speed" : 100
	killtarget(target_source) : "Kill target"
	wait(choices) : "Delay before close" : 4 = 
	[
		-1 : "Stays open"
	]
	lip(integer) : "Lip"
	dmg(integer) : "Damage on crush" : 0
	health(integer) : "Health (shoot open)" : 0
]

@SolidClass base(Door) = func_door : "Basic door" 
[
	message(string) : "Message"
	sounds(choices) : "Sound" : 1 = 
	[
		0: "No sound"
		1: "Stone"
		2: "Base"
		3: "Stone chain"
		4: "Screechy metal"
	]
	spawnflags(flags) =
	[
		1 : "Starts open" : 0
		4 : "Don't link" : 0
		8 : "Gold Key required" : 0
        	16: "Silver Key required" : 0
        	32: "Toggle" : 0
	]
]

@SolidClass base(Door) = func_door_secret : "Triggered door" 
[
	sounds(choices) : "Sound" : 1 = 
	[
		1: "Medieval"
		2: "Metal"
		3: "Base"
	]
	t_width(integer) : "Override width"
	t_length(integer) : "Override length"
	spawnflags(flags) = 
	[
		1 : "Open once only" : 0
		2 : "Moves left first" : 0
		4 : "Moves down first" : 0
		8 : "Not shootable" : 0
        	16 : "Always shootable" : 0
	]
]

@SolidClass base(Appearflags, Targetname) = func_wall : "Moving wall" []

@SolidClass base(Appearflags, Target) = func_button : "Button" 
[
	speed(integer) : "Speed" : 5
	killtarget(target_source) : "Kill target"
	sounds(choices) : "Sound" : 1 = 
	[
		1: "Steam metal"
		2: "Wooden clunk"
		3: "Metallic clink"
		4: "In-out"
	]
	wait(choices) : "Delay before reset" : 3 =
	[
		-1: "Stays pressed"
	]
	delay(integer) : "Delay before trigger"
	lip(integer) : "Lip"
	health(integer) : "Health (shoot open)"
]

@SolidClass base(Appearflags, Targetname) = func_train : "Moving platform" 
[
	target(target_source) : "First stop target"
	speed(integer) : "Speed (units per second)" : 64
	sounds(choices) : "Sound" : 1 =
	[
		1: "Ratchet metal"
	]
	dmg(integer) : "Damage on crush" : 0
]

@PointClass base(Appearflags, Targetname) size(16 16 16) studio("fgd/q1/entities/ent_path.mdl") = path_corner : "Path corner"
[
	target(target_source) : "Next stop target"
]

@SolidClass base(Appearflags, Targetname) = func_plat : "Elevator" 
[
	speed(integer) : "Speed" : 150
	sounds(choices) : "Sound" : 1 =
	[
		1: "Base Fast"
		2: "Chain Slow"
	]
	spawnflags(Flags) =
	[
		1: "Low trigger" : 0
	]
	height(integer) : "Travel distance (can be negative)"
]

@SolidClass base(Appearflags, Targetname, Target) = func_dm_only : "Deathmatch teleporter" []
@SolidClass base(Appearflags) = func_illusionary : "Solids can be walked through" []

@SolidClass base(Appearflags) = func_episodegate : "Episode Gate"
[
	spawnflags(Flags) =
	[
		1 : "Episode 1" : 1
		2 : "Episode 2" : 0
		4 : "Episode 3" : 0
		8 : "Episode 4" : 0
	]
]

@SolidClass base(Appearflags) = func_bossgate : "Boss gate" []


//
// triggers
//

@baseclass base(Appearflags, Targetname, Target) = Trigger //This is used for trigger once and trigger multiple
[
	//style(integer) : "Style" : 32 //Not sure what this is for
	killtarget(target_source) : "Kill target"
	sounds(choices) : "Sound" : 0 =
	[
		0 : "No sound"
		1 : "Secret sound"
		2 : "Beep beep"
		3 : "Large switch"
		//4 : "Set message to text string" //Not sure why this was here, sounds and messages seem to work fine together
	]
	delay(integer) : "Delay before trigger"
	message(string) : "Message"
	health(integer) : "Health (shoot trigger)"
	spawnflags(flags) =
	[
		1: "Entity only" : 0
	]
]

@SolidClass base(Appearflags) = trigger_changelevel : "Trigger: Change level"
[
	map(string) : "New map name"
	spawnflags(flags) =
	[
		1: "No Intermission" : 0
	]
]
@PointClass base(Appearflags, Targetname, Target) studio("fgd/q1/entities/ent_counter.mdl") = trigger_counter : "Trigger counter"
[
	killtarget(target_source) : "Kill target"
	delay(integer) : "Delay before trigger"
	message(string) : "Message"
	count(integer) : "Count before activation" : 2
	spawnflags(flags) =
	[
		1: "No Message" : 0
	]
]
@SolidClass base(Appearflags, Targetname) = trigger_hurt : "Trigger player hurt"
[
	dmg(integer) : "Damage" : 10
]
@SolidClass base(Appearflags, Targetname) = trigger_monsterjump : "Trigger monster jump"
[
	speed(integer) : "Jump Speed" : 40
	height(integer) : "Jump Height" : 128
]
@SolidClass base(Trigger) = trigger_multiple : "Trigger: Activate multiple"
[
	wait(integer) : "Delay before reset" : 10
]
@SolidClass base(Trigger) = trigger_once : "Trigger: Activate once" []
@SolidClass base(Appearflags, Targetname) = trigger_onlyregistered : "Trigger: Registered only" []
@SolidClass base(Appearflags, Targetname) = trigger_push : "Trigger player push"
[
	speed(integer) : "Speed of push" : 40
	spawnflags(flags) =
	[
		1: "Once Only" : 0
	]
]
@PointClass base(Appearflags, Targetname, Target) size(-8 -8 -8, 8 8 8) studio("fgd/q1/entities/ent_relay.mdl") = trigger_relay : "Trigger relay"
[
	killtarget(target_source) : "Kill target"
	delay(integer) : "Delay before trigger"
	message(string) : "Message"
]
@SolidClass base(Appearflags, Targetname, Target) = trigger_secret : "Trigger: Secret"
[
	killtarget(target_source) : "Kill target"
	sounds(choices) : "Sound" : 1 =
	[
		2 : "No Sound"
		1 : "Secret sound"
		3 : "Large switch"
	]
	delay(integer) : "Delay before trigger"
	message(string) : "Message"
	health(integer) : "Health (shoot trigger)"
	spawnflags(flags) =
	[
		1: "Entity only" : 0
	]
]
@SolidClass base(Appearflags, Targetname) = trigger_setskill : "Trigger set skill"
[
	message(choices) : "Skill to change to" : 1 =
	[
        	0 : "Easy"
        	1 : "Medium"
        	2 : "Hard"
        	3 : "Nightmare!"
	]
]
@SolidClass base(Appearflags, Targetname, Target) = trigger_teleport : "Trigger teleport"
[
	killtarget(target_source) : "Kill target"
	spawnflags(Flags) =
	[
		1 : "Player only" : 0
		2 : "Silent" : 0
	]
]

@PointClass base(Appearflags, Targetname) size(-16 -16 -16, 16 16 16) studio("fgd/q1/entities/ent_viewthing.mdl") = viewthing : "Debugging entity" []
