#Default structures stats
# waypoint_dummy_o used for ordos reinforcements
# dummy_spam_actor spawn actor on waypoint_dummy_o location
^Building:
	GrantRandomCondition: #used for different SFX
		Conditions: explode02, explode03
	Explodes@02: # light resonance after explosion
		Type: CenterPosition
		Weapon: buildingExplosions02
		EmptyWeapon: buildingExplosions02
		Chance: 30
		Offset:	1,0,1
		RequiresCondition: explode02
	Explodes@03: #SFX new_DerbisBigExplosion01 resonances
		Type: CenterPosition
		Weapon: buildingExplosions03
		EmptyWeapon: buildingExplosions03
		Chance: 30
		Offset:	1,2,1
		RequiresCondition: explode02 || explode03
	Explodes@sabotuerdemolition:
		RequiresCondition: being-demolished
		Type: CenterPosition
		Weapon: buildingBigExplosion
		EmptyWeapon: buildingBigExplosion
	ThrowsShrapnel:
		Weapons: derbisRock01, derbisRock02, derbisRock03, Debris4
		Pieces: 2, 5
		Range: 1c512, 4c0
	SpawnActorOnDeath@bigcrater: #spawn big crater after sabouteur demolition
		Actor: crater_big
		Offset: 0,1
		RequiresCondition: being-demolished
	AmbientSound@saboteurCharge:
		SoundFiles: explodeSaboteurEmperor02.wav
		RequiresCondition: being-demolished

^Bot_capture_protection: #old version not used anymore.
	GrantConditionOnBotOwner@BOTOWNER:
		Condition: bot-owned
		Bots: omnius, vidious, gladius
	CaptureManager:
		BeingCapturedCondition: sellme
	GrantCondition@botcapture:
		Condition: capture_protection
		RequiresCondition:  bot-owned && sellme
	KillsSelf@removeOnCaptureAttemp:
		RemoveInstead: false
		RequiresCondition: bot-owned && sellme
		GrantsCondition: capture_protection
	SpawnActorOnDeath@infantry1:
		Actor: light_inf
		Probability: 50
		Offset: 1,0
		RequiresCondition: capture_protection
	SpawnActorOnDeath@infantry2:
		Actor: light_inf
		Probability: 50
		Offset: 0,0
		RequiresCondition: capture_protection
	SpawnActorOnDeath@infantry3:
		Actor: light_inf
		Probability: 50
		Offset: 0,1
		RequiresCondition: capture_protection
	SpawnActorOnDeath@infantry4:
		Actor: light_inf
		Probability: 50
		Offset: 1,1
		RequiresCondition: capture_protection

^Dummy:
	EditorOnlyTooltip:
		Name: wpdummy
	AlwaysVisible:
	Interactable:
	Immobile:
		OccupiesSpace: false
	RenderSpritesEditorOnly:
		Image: waypoint
	WithSpriteBody:
	BodyOrientation:
		QuantizedFacings: 1
	OwnerLostAction:
		Action: Dispose

dummy_spam_actor:
	Inherits: ^Vehicle
	GrantConditionOnTerrain@TerrailTest
		Condition: on_land
		TerrainTypes: Rock, Concrete, Sand, SpiceSand, Spice, Dune, Rough, SpiceBlobs
	RenderSprites:
		Image: crate #just from testing
	Health:
		HP: 10
	ChangesHealth:
		Step: -5
		Delay: 3
		StartIfBelow: 110
		RequiresCondition: on_land
	SpawnActorOnDeath@infantry01
		Actor: ordos_light_drop
		Offset: 0,0
	SpawnActorOnDeath@infantry02
		Actor: ordos_light_drop_squadleader
		Offset: 0,0
	SpawnActorOnDeath@infantry03
		Actor: ordos_trooper_drop
		Offset: 0,0
	SpawnActorOnDeath@infantry04
		Actor: ordos_trooper_drop
		Offset: 0,0
	SpawnActorOnDeath@infantry05
		Actor: ordos_trooper_drop
		Offset: 0,0
waypoint_dummy_o:
	Inherits: ^Dummy
	FreeActorWithDelivery:
		DeliveringActor: carryall.reinforce_with_sound
		Actor: dummy_spam_actor
		DeliveryRange: 5c0
		DeliveryOffset: 1,1

construction_yard:
	Health:
		HP: 46000
	Armor:
		Type: cy
	RevealsShroud:
		Range: 5c768
	Power:
		Amount: 50
	ThrowsShrapnel:
		Weapons: Debris, Debris2
		Pieces: 1, 3
		Range: 1c0, 2c0
	ThrowsShrapnel@longer:
		Weapons: Debris, Debris2, Debris3, Debris4
		Pieces: 5, 7
		Range: 3c0, 6c0
	ThrowsShrapnel@longest:
		Weapons:  Debris4, DerbisSiegetank
		Pieces: 0, 3
		Range: 6c0, 10c0
	Explodes@02
		RequiresCondition: explode02
	Explodes@03
		RequiresCondition: explode03


wind_trap:
	Buildable:
		BuildDuration: 208
		BuildDurationModifier: 100
	Selectable:
		Bounds: 64,64
	Valued:
		Cost: 225
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Health:
		HP: 35000
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	Power:
		Amount: 200
	RevealOnDeath:
		Radius: 3c768
	SpawnActorOnDeath@husktype01:
		Actor: windTrap.husk
		RequiresCondition: explode02
	SpawnActorOnDeath@huskType02:
		Actor: windTrap.husk_passable
		RequiresCondition: explode03

barracks:
	Buildable:
		BuildDuration: 325
	Valued:
		Cost: 400
	Health:
		HP: 41000
	Armor:
		Type: building
	RevealsShroud:
		Range: 3c768
	Power:
		Amount: -50
	GrantConditionOnProduction@ClusterdebrisExplosion
		Condition: producing
	ThrowsShrapnel@explosiveDerbis:
		Weapons: DeathHandClusterDebris
		Pieces: 0, 1
		Range: 1c0, 2c0
		RequiresCondition: producing

refinery:
	PlaceBuildingVariants:
		Actors: refinery_inverted
	Buildable:
		BuildDuration: 687
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Valued:
		Cost: 1500
	Health:
		HP: 42000
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 3c768
	StoresResources:
		Capacity: 2000
	FreeActorWithDelivery:
		Actor: harvester
		DeliveryOffset: 2,2
		DeliveringActor: carryall.reinforce
		Facing: 160
	CustomSellValue:
	Sellable:
		RequiresCondition: !build-incomplete && !being-demolished
		SellSounds: BUILD1.WAV
	Power:
		Amount: -75
	Explodes@big04:
		Type: CenterPosition
		Weapon: buildingExplosions04_big
		EmptyWeapon: buildingExplosions04_big
		Chance: 100
		Offset:	2,2,1
	ThrowsShrapnel:
		Weapons: Debris, Debris2, Debris3, Debris4, HarvesterSpiceExplosion
		Pieces: 7, 15
		Range: 2c0, 10c0
	GrantConditionOnFaction@Atreides: # conditions for Spawn actor
		Condition: atreides
		Factions: atreides, fremen
	GrantConditionOnFaction@Harkonnen:
		Condition: harkonnen
		Factions: harkonnen, corrino
	GrantConditionOnFaction@Ordos:
		Condition: ordos
		Factions: ordos, mercenary, smuggler
	SpawnActorOnDeath@ordosHusk:
		Actor: refinery_husk.ordos
		RequiresCondition: ordos
	SpawnActorOnDeath@atreidesHusk:
		Actor: refinery_husk.atreides
		RequiresCondition: atreides
	SpawnActorOnDeath@harkonnenHusk:
		Actor: refinery_husk.harkonnen
		RequiresCondition: harkonnen

refinery_inverted:
	Inherits: refinery
	Buildable: 
		Prerequisites: wind_trap
		Queue: Building
		BuildPaletteOrder: 650
		Description: Refinery with docking from north side
	RenderSprites:
		Image: refinery_invert.ordos
		FactionImages:
			atreides: refinery_invert.atreidis
			fremen: refinery_invert.atreidis
			harkonnen: refinery_invert.harkonnen
			corrino: refinery_invert.harkonnen
	WithIdleOverlay@front:
		Sequence: idle-front
		RequiresCondition: !build-incomplete
	Selectable:
		Bounds: 96,64, 0,32
	WithIdleOverlay@top:
		Sequence: idle-top
		RequiresCondition: !build-incomplete
	Refinery:
		DockAngle: 128
		DockOffset: 0,1
		TickRate: 20
	Tooltip:
		Name: Spice Refinery Inverted
	D2kBuilding:
		Footprint: === =xx xx=
		Dimensions: 3,3
		LocalCenterOffset: 0,-512,0
	HitShape:
		Type: Rectangle
			TopLeft: -512, 0
			BottomRight: 1536, 1024
	HitShape@BOTTOM:
		Type: Rectangle
			TopLeft: -1536, 1024
			BottomRight: 512, 2048
	ProvidesPrerequisite:
		Prerequisite: refinery
	FreeActorWithDelivery:
		DeliveryOffset: 0,0

silo:
	Buildable:
		BuildDuration: 156
	Valued:
		Cost: 120
	Health:
		HP: 18000
	Armor:
		Type: building
	RevealsShroud:
		Range: 2c768
	StoresResources:
		Capacity: 2000
	Power:
		Amount: -15
	ThrowsShrapnel:
		Weapons: Debris, Debris2, Debris3, Debris4
		Pieces: 3, 5
		Range: 2c0, 5c0

light_factory:
	Buildable:
		Prerequisites: refinery
		BuildDuration: 400
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Valued:
		Cost: 700
	Health:
		HP: 42900
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 5c768
	Power:
		Amount: -100
	ThrowsShrapnel:
		Weapons: HMG, Debris2, derbisRock01, Debris4
		Pieces: 5, 7
		Range: 0c512, 3c0

heavy_factory:
	Buildable:
		BuildDuration: 750
	Valued:
		Cost: 1500
	Health:
		HP: 46500
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 4c768
	Power:
		Amount: -150
	GrantConditionOnProduction@ClusterdebrisExplosion
		Condition: producing
	ThrowsShrapnel:
		Weapons: Debris, Debris2, Debris3, Debris4
		Pieces: 10, 20
		Range: 1c0, 5c0
	ThrowsShrapnel@explosiveDerbis:
		Weapons: DeathHandClusterDebris
		Pieces: 0, 1
		Range: 1c0, 3c0
	ThrowsShrapnel@explosiveDerbiswhenproducing:
		Weapons: DeathHandClusterDebris
		Pieces: 1, 2
		Range: 1c0, 5c0
		RequiresCondition: producing

outpost:
	Buildable:
		BuildDuration: 420
	Valued:
		Cost: 1000
	Health:
		HP: 45500
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 10c0
		RequiresCondition: !disabled
	RevealsShroud@lowpower:
		Range: 4c0
		RequiresCondition: disabled
	Power:
		Amount: -125
	DetectCloaked:
		Range: 6c0
		RequiresCondition: !disabled

starport:
	Buildable:
		BuildDuration: 625
	Valued:
		Cost: 1500
	Health:
		HP: 45500
	Armor:
		Type: heavy
	RevealsShroud:
		Range: 3c768
	Power:
		Amount: -150
	-Explodes@02:
	Explodes@03: #different Sfx for starport/repair pad explosion
		Type: CenterPosition
		Weapon: buildingExplosions05
		EmptyWeapon: buildingExplosions05
		Chance: 80
	

wall:
	Buildable:
		BuildDuration: 100
	Valued:
		Cost: 100
	Health:
		HP: 20000
	Armor:
		Type: wall
	RevealsShroud:
		Range: 1c768

medium_gun_turret:
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Buildable:
		Prerequisites: barracks
		BuildDuration: 300
		Description: Defensive structure.\n  Modest vs everthing\n weak vs Tanks\n detects cloaked units in 2 cell range
	Valued:
		Cost: 700
	Health:
		HP: 30000
	Armor:
		Type: wall
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: heavy
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 5c768
	Turreted:
		TurnSpeed: 24
		InitialFacing: 512
		RealignDelay: -1
	WithSpriteTurret:
		Recoils: false
	WithSpriteBarrel:
	Armament:
		Weapon: 110mm_Gun
		LocalOffset: 512,0,432
		MuzzleSequence: muzzle
		Recoil: 200
		RecoilRecovery: 25
	Power:
		Amount: -50
	DetectCloaked:
		Range: 3c0

large_gun_turret:
	Inherits@AUTOTARGET: ^AutoTargetAll
	Buildable:
		BuildDuration: 380
		Description: Defensive structure.\n  Strong vs Tanks, Aircraft\n  Weak vs infantry\n\n  Requires power to operate.
	Valued:
		Cost: 900
	Health:
		HP: 32000
	Armor:
		Type: wall
	RevealsShroud:
		Range: 6c768
	Armament:
		Weapon: MissleTowerNew
		LocalOffset: 256,384,768, 256,-384,768
	Turreted:
		TurnSpeed: 32
	Power:
		Amount: -70
	DetectCloaked:
		Range: 3c0

repair_pad:
	Buildable:
		Queue: Building
		Prerequisites: heavy_factory, ~techlevel.medium
		BuildDuration: 375
	Valued:
		Cost: 800
	Health:
		HP: 39000
	Armor:
		Type: wood
	RevealsShroud:
		Range: 3c768
	Power:
		Amount: -50
	-Explodes@02:
	Explodes@03: #different Sfx for starport/repair pad explosion
		Type: CenterPosition
		Weapon: buildingExplosions05
		EmptyWeapon: buildingExplosions05
		Chance: 80

high_tech_factory:
	Buildable:
		BuildDuration: 610
	Valued:
		Cost: 1150
	Health:
		HP: 45500
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 4c768
	Power:
		Amount: -125
	ProvidesPrerequisite@ordosprerequisite:
		Prerequisite: hightech.ordos
		Factions: ordos
	AirstrikePower:
		Icon: ornistrike
		Description: Air Strike
		Prerequisites: ~techlevel.superweapons, upgrade.hightech
		ChargeInterval: 7500
		SquadSize: 3
		SquadOffset: -1536, 1024, 0
		LongDesc: Ornithopters hit the target with bombs
		UnitType: ornithopter
		DisplayBeacon: True
		CameraActor: camera
		CameraRemoveDelay: 75
		ArrowSequence: arrow
		UseDirectionalTarget: True
		DirectionArrowAnimation: airstrike_direction
		CircleSequence: circles
		SupportPowerPaletteOrder: 10
	SpawnActorPower@OrdosReinforce:
		EffectImage: carryall.husk_on_land #dunno why this need to be
		EffectSequence:  #to fix missing sprite LINT warning
		Actor: waypoint_dummy_o
		Icon: carryall
		Prerequisites: ordos.reinforce
		ChargeInterval: 4500
		LifeTime: 100
		Description: Infantry Reinforcements
		LongDesc: Calls in a carryall to deploy Ordos elite squad\n at  target location.
		EndChargeSpeechNotification: Reinforce
		SupportPowerPaletteOrder: 50
		DisplayBeacon: True
		OrderName: ordos_reinforcements

research_centre:
	Buildable:
		BuildDuration: 650
	Valued:
		Cost: 1500
	Health:
		HP: 32500
	GrantConditionOnPrerequisite:
		Condition: ArmorUpgrade
		Prerequisites: upgrade.conyard
	Armor:
		Type: building
		RequiresCondition: ArmorUpgrade
	Armor@weakArmor:
		Type: buildingWeak
		RequiresCondition: !ArmorUpgrade
	RevealsShroud:
		Range: 4c768
	Power:
		Amount: -175

palace:
	Buildable:
		BuildDuration: 937
	Valued:
		Cost: 2000
	Health:
		HP: 35000
	Armor:
		Type: cy
	RevealsShroud:
		Range: 4c768
	Power:
		Amount: -200
	NukePower:
		LaunchSound: death_hand_launch_1.wav
		Cursor: nuke
		Icon: deathhand
		ChargeInterval: 8000
		MissileWeapon: deathhand
		MissileDelay: 18
		Description: Death Hand \n Excellent VS Infantry, light vehicles, Turrets ;n Weak vs Tanks, Buildings
		SpawnOffset: 32,816,0
		DetonationAltitude: 6c0
		RemoveMissileOnDetonation: True
		FlightVelocity: 384
		TrailInterval: 0
		TrailImage: large_trail
		TrailSequences: idle
		CameraRemoveDelay: 100
	ProduceActorPower@fremen:
		Actors: fremen, fremen, fremen, fremen
		Type: Fremen
		ChargeInterval: 2850
		ReadyAudio: Reinforce
		BlockedAudio: NoRoom
		OrderName: ProduceActorPower.Fremen
		SupportPowerPaletteOrder: 20
	ProduceActorPower@saboteur:
		Actors: saboteur
		Type: Saboteur
		ChargeInterval: 2500
		ReadyAudio: Reinforce
		BlockedAudio: NoRoom
		OrderName: ProduceActorPower.Saboteur
		SupportPowerPaletteOrder: 30
	Production@Atreides:
		Produces: Fremen
		RequiresCondition: atreides
	Production@Ordos:
		Produces: Saboteur
		RequiresCondition: ordos
	GrantConditionOnFaction@Atreides:
		Condition: atreides
		Factions: atreides, fremen
	GrantConditionOnFaction@Harkonnen:
		Condition: harkonnen
		Factions: harkonnen
	GrantConditionOnFaction@Ordos:
		Condition: ordos
		Factions: ordos, mercenary, smuggler

upgrade.conyard:
	Buildable:
		BuildDuration: 1500
		Prerequisites: construction_yard, outpost
		Description: Unlocks Large Concrete Slab, Rocket Turret \n UPGRADE BUILDING ARMOR!!! 
	Valued:
		Cost: 1000

upgrade.barracks:
	Buildable:
		BuildDuration: 1000
	Valued:
		Cost: 400

upgrade.light:
	Buildable:
		BuildDuration: 1200
	Valued:
		Cost: 600

upgrade.heavy:
	Buildable:
		BuildDuration: 1200
	Valued:
		Cost: 1000

upgrade.hightech:
	Buildable:
		BuildDuration: 1800
	Valued:
		Cost: 1500
	RenderSprites:
		Image: hightech.atreides

upgrade.hightechOrdos:
	AlwaysVisible:
	Interactable:
	ScriptTriggers:
	Tooltip:
		Name: High Tech Factory Upgrade
	Buildable:
		BuildPaletteOrder: 50
		Prerequisites: ~hightech.ordos, ~techlevel.superweapons
		Queue: Upgrade
		BuildLimit: 1
		BuildDuration: 1500
		BuildDurationModifier: 100
		Description: Unlocks the Ordos Reinforcements
	Valued:
		Cost: 1000
	RenderSprites:
		Image: hightech.ordos
	ProvidesPrerequisite@upgradename:
		Prerequisite: ordos.reinforce

sietch:
	-D2kBuilding:
	-AmbientSound@saboteurCharge:
	-Explodes@sabotuerdemolition:
	-SpawnActorOnDeath@bigcrater:
	Building:
		Footprint: xx xx
		Dimensions: 2,2
		TerrainTypes: Cliff