 -- Import the lib use.
modimport("libs/env.lua")

-- Actions Initialization.
use "data/actions/init"

-- Component Initialization.
use "data/components/init"

PrefabFiles = {
	"xjj","xiaotai","datai","xinp","xjj_none","yaoshui",
}

Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/xjj.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/xjj.xml" ),

    Asset( "IMAGE", "images/selectscreen_portraits/xjj.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/xjj.xml" ),
	
    Asset( "IMAGE", "images/selectscreen_portraits/xjj_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/xjj_silho.xml" ),

    Asset( "IMAGE", "bigportraits/xjj.tex" ),
    Asset( "ATLAS", "bigportraits/xjj.xml" ),
	
	Asset( "IMAGE", "images/map_icons/xjj.tex" ),
	Asset( "ATLAS", "images/map_icons/xjj.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_xjj.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_xjj.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_ghost_xjj.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_ghost_xjj.xml" ),


}

GLOBAL.TUNING.XJJ = {}
GLOBAL.TUNING.XJJ.KEYTWO = GetModConfigData("key2") or 122




local function KaiDeng(inst)
if inst:HasTag("playerghost") then return end

inst.entity:AddLight()
	inst.Light:Enable(false)
				inst.Light:SetRadius(10)
    			inst.Light:SetFalloff(1)
    			inst.Light:SetIntensity(0.3)
    			inst.Light:SetColour(12/255,255/255,12/255)


if inst.transformed then
--if TheWorld.state.isnight or TheWorld:HasTag("cave") then
                
				inst.Light:Enable(true)
                inst.components.hunger:DoDelta(-20)
				inst.components.talker:Say("照明装备已打开。")
				--else
				--inst.components.talker:Say("光线很足，节约点儿电量~~")
				--inst.Light:Enable(false)
				
--end
 
else

inst.Light:Enable(false)
inst.components.talker:Say("光照设备已关闭。")
end
 
inst.transformed = not inst.transformed

-- inst.components.health:SetCurrentHealth(1)
-- inst.components.health:DoDelta(0)
return true
 
end
 
AddModRPCHandler("xjj", "KaiDeng", KaiDeng)





local RECIPETABS = GLOBAL.RECIPETABS


TECH = GLOBAL.TECH
local EQUIPSLOTS = GLOBAL.EQUIPSLOTS
local Player = GLOBAL.ThePlayer
--GetPlayer = GLOBAL.GetPlayer
local Recipe = GLOBAL.Recipe
local Ingredient = GLOBAL.Ingredient
local containers = require("containers")
local SpawnPrefab = GLOBAL.SpawnPrefab
local Vector3 = GLOBAL.Vector3
local resolvefilepath = GLOBAL.resolvefilepath
local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS


function load()
 local gears = GLOBAL.Recipe("gears", {Ingredient("xinp", 5), }, RECIPETABS.SCIENCE, {SCIENCE=0})
--gear.atlas = "images/inventoryimages/tisuiya.xml"
--gear.image = "tisuiya.tex"

 local yaoshui = GLOBAL.Recipe("yaoshui", {Ingredient("honey", 2),Ingredient("red_cap", 1), }, RECIPETABS.SURVIVAL, {SCIENCE=0})
 yaoshui.atlas = "images/inventoryimages/yaoshui.xml"
 yaoshui.image = "yaoshui.tex"

  local datai = GLOBAL.Recipe("datai", {Ingredient("transistor", 1),Ingredient("flint", 10), }, RECIPETABS.WAR, {SCIENCE=0})
 datai.atlas = "images/inventoryimages/datai.xml"
 datai.image = "datai.tex"

end
AddGamePostInit(load)




STRINGS.NAMES.XIAOTAI = "白之契约"
STRINGS.RECIPE_DESC.XIAOTAI = "2b小姐姐的小太刀"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.XIAOTAI = "轻便好用"

STRINGS.NAMES.DATAI = "白之约定"
STRINGS.RECIPE_DESC.DATAI = "重型刀器"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.DATAI = "威力惊人"

STRINGS.NAMES.XINP = "机器芯片"
STRINGS.RECIPE_DESC.XINP = "机器芯片"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.XINP = "修复武器还可以合成齿轮"

STRINGS.NAMES.YAOSHUI = "杀毒药剂"
STRINGS.RECIPE_DESC.YAOSHUI = "杀毒药剂"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.YAOSHUI = "强杀病毒！"

-- The character select screen lines
STRINGS.CHARACTER_TITLES.xjj = "2B小姐姐"
STRINGS.CHARACTER_NAMES.xjj = "尼尔2B"
STRINGS.CHARACTER_DESCRIPTIONS.xjj = "*胖次胖次很好看的小姐姐~ \n*可制作齿轮\n*自带武器白之契约"
STRINGS.CHARACTER_QUOTES.xjj = "\"这样子吗？\""

-- Custom speech strings
STRINGS.CHARACTERS.XJJ = require "speech_xjj"

-- The character's name as appears in-game 
STRINGS.NAMES.XJJ = "2B小姐姐"

-- The default responses of examining the character
STRINGS.CHARACTERS.GENERIC.DESCRIBE.XJJ = 
{
	GENERIC = "哇!尼尔姐姐",
	ATTACKER = "小姐姐打人啦",
	MURDERER = "小姐姐杀人啦!",
	REVIVER = "restart",
	GHOST = "快来救救小姐姐QWQ.",
}
-- Let the game know character is male, female, or robot
--table.insert(GLOBAL.CHARACTER_GENDERS.FAMALE, "xjj")

AddMinimapAtlas("images/map_icons/xjj.xml")

-- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL.
AddModCharacter("xjj", "FEMALE")

