local assets =
{
	Asset("ANIM", "anim/ast0.zip"),
    Asset("ATLAS", "images/inventoryimages/ast_2.xml"),
	
}
STRINGS.NAMES.AST_2 = "鸢一折纸任务终端"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.AST_2= " "
local function ontalk(inst)
inst.SoundEmitter:PlaySound("dontstarve/common/diviningrod_ping", "ping")
end
local function fn()
    local inst = CreateEntity()
	local probably = 1
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("ast0")
    inst.AnimState:SetBuild("ast0")
    inst.AnimState:PlayAnimation("idle")

    inst.entity:SetPristine()
---

---
    if not TheWorld.ismastersim then
        return inst
    end
	inst:AddTag("molebait")
    inst:AddComponent("inspectable")
	

	inst:AddComponent("talker")
    inst.components.talker.fontsize = 28
    inst.components.talker.font = TALKINGFONT
    inst.components.talker.colour = Vector3(.9, .4, .4)
    inst.components.talker.offset = Vector3(0, 0, 0)
    inst.components.talker.symbol = "swap_object"
	--调查

	inst.components.inspectable.getstatus = function(inst,viewer)
	local say = ""
	 if probably == 1 then
	  inst.components.talker:Say("接下来由这个终端记录你的活动，鸢一一曹，请点击终端以获得下一个任务。")
      probably = 2

	 elseif probably == 2 then
	  inst.components.talker:Say("既然你获得了这个终端，说明你已经拥有了研究台（请继续点击）") probably = 3
	
	 elseif probably == 3 then
	  inst.components.talker:Say("研究台的用途是生产研究点数和一些机器，通过使用你的思绪制作的研究点数可以加快AST对DST世界的分析 \n 那么，请你制作10个基础研究点数，然后点击本终端提交任务")
	     if viewer.components.inventory:Has("study_live", 10) and	
		 probably == 3 then 
		 probably = 4 
	 end
	 elseif probably == 4 then
	  inst.components.talker:Say("你所提交的点数，确实的收到了，确定DST与AST世界的适应率在35.5%以上。（请继续点击）")
      viewer.components.inventory:ConsumeByName("study_live", 10)	probably = 5 
	 elseif probably == 5 then
	  inst.components.talker:Say("那么下一步。。。稍等，日下部队长你有什么事情，我应该说过禁止入内了（手捂上通讯器的声音）") 
	  inst:DoTaskInTime(2, function()	inst.components.talker:Say("嘶嘶。。鸢一。。。静养。。。这种事情。。 \n 。long人。。赶出去！") end) 
	  viewer:DoTaskInTime(2, function()	inst.components.talker:Say("那个。。。") end)
	  inst:DoTaskInTime(4, function()	inst.components.talker:Say("好了，继续吧，鸢一一曹，接下来的任务请你去收集DST世界的某个植物样本（请点击继续）") probably = 6 end) 
	 elseif probably == 6 then
	  inst.components.talker:Say("那么需要采集的物品是，1单位噩梦花瓣以及1个食人花种子 \n 任务奖励为化学台，请好好努力")
	     if viewer.components.inventory:Has("petals_evil", 1) and 
		 viewer.components.inventory:Has("lureplantbulb", 1)  then
		 probably = 7 end
	 elseif probably == 7 then
	  inst.components.talker:Say("接收材料，确定是所要求的。准备发放奖励（请点击继续）")
      viewer.components.inventory:ConsumeByName("petals_evil", 1)
	  viewer.components.inventory:ConsumeByName("lureplantbulb", 1)
	  
	  probably = 8
	
	 elseif probably == 8 then
	  inst.components.talker:Say("拥有化学台之后，你可以制造一些简单的化学物品（请继续点击）") probably = 9
	  --viewer.components.inventory:GiveItem( SpawnPrefab("化学台")) probably = 10
	  
	 elseif probably == 9 then
	  inst.components.talker:Say("那么发布下一个任务：通过水泵获得10单位的水，然后递交给化学台 \n 将得到的产物提交给终端（请继续点击）") 
	     if viewer.components.inventory:Has("o2", 10) and 
	     viewer.components.inventory:Has("h2", 20)  then 
		 probably = 10 end
	  
	 elseif probably == 10 then
	  inst.components.talker:Say("检查物品，确定符合要求，开始上传") 
	  viewer:DoTaskInTime(2, function()	inst.components.talker:Say("是AI在说话？鸢一一曹请求与AST计划执行官通话") end)
	  inst:DoTaskInTime(3.5, function()	inst.components.talker:Say("呲————————拒绝请求") end)
	  inst:DoTaskInTime(5, function()	inst.components.talker:Say("由于精灵现界在AST总部，大量AST人员伤亡，暂时由AI4025为您服务进行交接（请点击继续）") end)
	  probably = 11
	
	 elseif probably == 11 then
	  inst.components.talker:Say("经过检测，确定DST世界的水质和主世界认知的水的成分没有太大区别，开始记录。cicicii（请继续点击）") probably = 12
	
	 elseif probably == 12 then
	  inst.components.talker:Say("按照预定流程发布下一个任务，对任务数据进行查找、、、 \n 根据上次提交的研究点数所攥写的报告按照协议发放给你（请继续点击）") probably = 13
	
	 elseif probably == 13 then
	  inst.components.talker:Say("任务编号wx2058，请制作15个基础研究点数提交给终端以便研究部门研究DST世界的生态系统") 
	 if viewer.components.inventory:Has("study_livel", 15) then probably = 14 end
	 elseif probably == 14 then
	  inst.components.talker:Say("这是什么东西。。。居然不是血肉模糊的。。咳咳，我们会报告给DEM社，继续你的工作吧（请继续点击）") probably = 15
	
	 elseif probably == 15 then
	  inst.components.talker:Say("目前你已经掌握了简单的机器使用，开放下一阶段机器：改造台，请将本机安置在地上 \n 注意这个过程是不可逆的，请寻找合适的位置")
	 end
	
	return say
	end
	--
	inst:AddComponent("tradable")
    inst:AddComponent("selfstacker")

	
    
    MakeHauntableLaunchAndSmash(inst)
	inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.imagename = "ast_2"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/ast_2.xml"
	inst:ListenForEvent("ontalk", ontalk)
--保存载入
local function onsave(inst, data)
    data.probably = probably
	end
local function onload (inst, data)
    if data ~= nil
     then
		probably = data.probably
		if data.probably == 15 then 
		inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
	end
	end end
	inst.OnSave = onsave
inst.OnLoad = onload
    return inst
end

return Prefab("ast_2", fn, assets)