Ϸʵ޸ļھ˵ͳDLCϷ100795棬ȥ޸·еDLC0001\ڷDLC棬ڵļĺѰδʽƳСDLC0001DLC0002޸ĲԺʮԣСǸϽԿɡ


һ.ȫ
.Ѫ10
.ԶѪ
.ʳＰѪ10
.üܹ﹥ˣﷴУ
.ʯʹã
.ԶԣҲõҵѧϰ
.ǲ
.ӻʱ
ʮ.ǲ»޾ڰ
ʮһ.ǹ
ʮ.ǿɶɺûʲô赲ɵ
ʮ.ܵø
ʮ.ƤʯٶȲ
ʮ.ٶ
ʮ.ȫƼȫﲻûͿȫƷ
ʮ.Ʒ
ʮ.ͼȫϷаCtrl+1
ʮ.Ӵ󵥸ѵ
ʮ.Ʒĸ
ʮһ.˫Ʒ60
ʮ.ͬʱЯɿ棩
ʮ.39
ʮ.쿲˹

ʮ.Ͽ亣
ʮ.ϳԷ亣Ʒ
ʮ.ͼԱʧߣ̫̫˯
ʮ.˹ħٻ
ʮ.˿˹Գ߲
ʮ.Τɹ

ʮһ.ȫƷʹãߡסħȡ·ñӡƷȫʹã
ʮ.޸װʹôʱ
ʮ.˺ֵӴ
ʮ.ھͲѪ100%˺ֵ
ʮ.߿;
ʮ.̣Զ100%

ʮ.һβɼ
ʮ.ٲɼݡ֦
ʮ.Զ̲ɼʰƷ
ʮ.ոߣһβɼֲܱ
ʮһ.ֺͨܲһβ10ܲ
ʮ.ñ
ʮ.һһһ俪һʯ
ʮ.3ľͷ
ʮ.׮
ʮ.׮
ʮ.ɿʱ50%ڳʯʯ
ʮ.ɿʱƽ
ʮ.޿ʯͷʯͷʧ

ʮ.ڲһε10ݴ
ʮһ.ֲݲʩ
ʮ.ڹһε10Ը
ʮ.ֹԲʩ
ʮ.ժֻ
ʮ.ժƲ
ʮ.һε10
ʮ.«έֲ«έ«έֲ
ʮ.ڼ̹ľһε10̹ľ
ʮ.ּ̹ľֲͣͣ
ʮ.ֲֻ
ʮһ.֦㽶
ʮ.ĢĢĢֲ
ʮ.̦޺̦޺̦޺ֲ
ʮ.ӫ䶴Ѩ
ʮ.Ѩӫ
ʮ.̲ݡ辡̹ľѨ̦޺«έʱ
ʮ.ݡ辡Ģ㽶̦޺«έҲ
ʮ.ŽǣţũֲѸٳ

ʮ.ũջƷ
ʮ.ũ1볤
ʮһ.ũҲ
ʮ.ũﲻʩ

ʮ.һն
ʮ.ʱ
ʮ.327
ʮ.ñ
ʮ.ʳƷ
ʮ.ȴϼɣ
ʮ.һն
ʮ.ľ981
ʮһ.9108
ʮ.ѡƷһ10

ʮ.ι߲˶
ʮ.ҰҲ
ʮ.Ӹñ
ʮ.ջ䲻
ʮ.10ɲ60ۣ
ʮ.ٲ
ʮ.ө治ˣ˿𡢰Ҳɿ
ʮ.ץ۷䡢ɱ˷䡢ө棨óɫԿȡ
ʮһ.ҵţţڵͼʾ
ʮ.ţٶ1
ʮ.ιţ߲޲
ʮ.ţҲɼţë
ʮ.ģţëñţȺ棬ţ幥ǣ
ʮ.ֳţţëСţ
ʮ.ֳӣӶӿɶѵ
ʮ.ֳ𼦣üֻµҲȦĻ𼦣
ʮ.ֳβִ
һ.ֳָ񵰵ò¸񵰵Ĵ

һһ.¹㣨ˢ㣩
һ.øʳͨ
һ.ֿɵ
һ.òڵ
һ.϶
һ.ܡ
һ.ܲ͵
һ.߳

һ.ǿҹӣHҹӹܣ
һһ.治þõʣ0%ʧɼã
һһһ.󹤵ʹ
һһ.Ƹľͷ辡ţȿȼȼ
һһ.ƿԵ50
һһ.Ϲϵʹã
һһ.ʯ˹ƣԶȼԶԶ
һһ.ʯͷӪ
һһ.磨ϡѨԶַ޺ڰ

һһ.Я
һһ.
һ.ûƽԶż̳ԽԶſƼ
һһ.ǽ;
һ.ǽԶѪ
һ.ǽ̣Լң޷ƻ
һ.ũ䡢
һ.ںϸǽ
һ.Χ쵺죩
һ.ʯֺ󣨽커Ǻӣ
һ.ذһ4
һ.15ֿƤ110飩
һ.۾ڵϺɰ
һһ.۾һ10Ϭţǡ¹
һ.ԿɲԡɲɷۣԻᷢ

һ.Զã1Զã
һ.
һ.Զסʹ
һ.װٻϷ
һ.һ֧20Σٷֱʹã
һ.ʹãĿԶصУ
һ.ҵۣڵͼʾ
һģ.˹أ䣩ܵÿ
һһ.˹أ䣩
һĶ.˹أ䣩981
һ.ʯʱӳ1
һ.񲻷ѪҪѪ޼30
һ.Ҳ˯˯񲻼
һ.˯ϯɲѪ
һ.װñӸʡ񴩿׻
һİ.ɫȡƷ١ΧӴ󡢲Ʒ
һľ.ɫħȴͲ
һ声.ڵҲʹɫħȴ͵ͺ
һһ.ͺɿأϱʯ
һ.ӳɫħȶסʱ
һ.ɫħ棨һסһƬ

һ.ȫԭֻޱרã
һ.ȫϵĸӣ8¿1ͨ15£
һ.ȫħ
һ.ȫ󡢲ǡԡɫ⡢ɢע
һ.ȫ˿˹ì˿˹ñ

һ.ʿȣʯǽڲݡȡůꡢԡ˲ơ102ٶȡ
һ.֮ììʱٻ׻ˣ
һһ.꣨ͽ˱ɻƽ
һ.ʱӷ۽ͯ꣩
һ.ȮףȮըһƬ
һ.߱ףָڵף
һ.֮⣨ʱҼյأͨɱ
һ.ħ֮˫ۣץ˲Ҽץƶǣ
һ.Ķдĵ˲֪Ѫ
һ.ǹóɫħԶ̵εˣʹ׸
һ.䲽ǹɫħ䡢Ҽӵ
һߣ.ħˣɵ˷ʷɱ
һһ.װ¶Ե˰Ҽ뾵У
һ߶.Ŀ꣬ԶصУ
һ.ǧﴸûȶ̹ʱ콵ʯı⣩
һ.ǹ˿˹ìΪǹԶͻ̲أҼɵˣ˻Ѫ
һ.Ƭְʱ𿪲˺Χˣ˵Ѫ
һ.Ƥְ99%˺ʱ˵ˣꡢԡܼ٣
һ.׽ȣװħȣСԶ̻׽

һ߰.ñƤñˣײٽʯͷ
һ߾.װ99%˺ֵ
һˣ.«έЯ«έϰҼɴ߹
һһ.ģСɱĿ
һ˶.ǣԻʹݣ
һ.Ի껨󣨴Χʳ˻۾ǣ
һ.԰ϵͳҹԶ򿿽ĵ˷ڵ
һ.̫ǿöΧγˣ˱
һ.ΧǽF11һȦʯΧǽΧǽɿţ5Զţҹ
һ.ѹС̼ӺżһȦѹǽżʧ
һ˰.ڴ䣨جȼֿڴ䣬ڵϷɳɱ˷乥ˣ
һ˾.ħȦF9ڵϻħȦκ￿ٰF9ȡ

һţ.ܹԶֻеҪ롰üһͬ޸ģ
һһ.ٻ飨ȸǶ
һŶ.ţװӰٻ˹ʿ
һ.ҵС飨ûٻһս
һ.˫ǣóֳﹷúֳﺣ꣩
һ.ڴӣ÷۱ֺӣ׽ӡС
һ.ڴܣֽֿڴܣԡսð֣ιܣ
һ.ţôʯţƷԶУɿ󡢿
һŰ.ҿţţҿţΪ㿱̽ʯ
һž.˹Ůѣ÷Ů֮һɱñ
.ӣȥӽӰ࣬һһȥ
һ.˽Ҿûҩ˽ҾװסñӣҪ֧ʣ
.ʹʹΪ֮УƷ
.ܣûɫֳܣսð֣ͣԭأιɲѪ
.ѣѿֳѣǿҼɰϵƷ
.ͳսǣXٻսǣ㣬5Ϊսǣ
.ǶӣTٻǶӣԵзɱʽըǮ

.ţţֶţ빫ţӮ𣬹ڻӶͽ
.֣ÿ⵽ڶ˵ķ
.ˣÿʱѰӮ
һ.޾񣨵·ƽַ׬ͽ
һһ.޽Զż̳500ƽѪֵ100㣩
һ.ԸأƽƤֵл»ƽ꣬ӵģ
һ.ǿţǿͨð֣֮ɱӣǿɵûƽ
һ.Ķͯʱй¶֣ʩƽ뿪ֱҹ
һ.𣨴½ϲڳ岿䣬ǽԴ֮ദأ
һ.ӰأҹĹдε֮Ǳ꣩
һ.ǶʯֽǶǶ׬Ҳɹۿ
һ.˶ħУӲͷ˶ħУÿ60һϮչɣ
һ.Ѫ壨ռ涴ɵࡢװ˿˹ñô£
.֮ɫ֮ΧоȺǰɣ

һ.棨ǳԷǣ
.Ǿ¹HOMEǱ¹ENDԭ
.LǱ»ٰLˣ
.磨UǱ磬ӹ֮٣˿ᱻˣٰUˣ
.Ұ֮ǣţճҺǣܱǳΪ䣩
.IǱС˻ʧȥĿٰ꣬Iˣ

.˹ˮꡢѩ
.˹㺮¶ȼлڣ
.Ƽָ밴Ҽ¸ʱΣ
.ľ䣨Ҷֱӿľɫľɰᶯ
һ.ͿѻħΪƷͿɫʣ
.ƶͰɾƷťͰ
.üҪƷӽȥ٣ҹȼϨ
.ﴫͻ̽Ҽ͵ص㣩
.ٿݣűԵҼͻؼң
.ñϷñڵʮֱ
.񻨣ȼӫ񻨣
.꣨Զſ10ƽӫΪ³꣩
.߶ţƬָ߶򣬴ˣӶɣ
ģ.ɫħȿ޸Ʒظʶȡȼϼͬ飩
һ.ҵСݣþ¹Сݣ˯Ҽ򿪿ⷿ㰴ťװָʳʡƷ
Ķ.ԶţľԶţԶأ
.񣨰ʯͷӪ𸽽Զ֣
.ԾRǿǰԾ
.ƣJǷ棬޴ĵ
.ģʽF8ԶѲ߲սٰF8ֶָƣ
.ͺգ˿еͺգιʳӣι񵰣
İ.㻨̳ʯֻ̳ӳ䣬ÿө棩
ľ.ԣûԣÿɲԣҶɱɫ
声.С͵ƣ֩С͵ƣڵԶȼȼգ̿ʳȡů
һ.ҵԶŶֹ̰񣬿ɻ˰գоѲ߲ǲ
.ʹÿˮ
.СС֣ǻðʳжݿȬ
.جβݣجβݣɲجȼϣһʳֵ¾ˣ
.ȻȪôƤȪɻָԣץ㣩
.СɽƬСɽɽ޿ɱܽ£
.¡ҹħֿ¡Я¡
.ǿ֢ߣInsertڵϻ꣬㽨졢ֲٰInsertʧ
.ƱòɡƱʱԶƱɼӹɴñ棬ɱ
.̱䣨̦޺̱䣬ƽÿ峿ֽ5ƿţֽ̣ɲԣ
һ.·ƣɫ·ƣҹԶϨ𣬿ֶء׻

.ʯҼװıʯǴ͵һ鱣ʯ
.裨װë10룩
.峵½Ͻͨߣ
.ñëñɷ裩
.涴涴԰ᵽص㣬磩
.֩PageUPٻ֩PageDownȡ
.ձˣҼǿԭصȴ
.վòϯֹվƱһվ
ߣ.ƣZٻϷУٰZأ

һ.ȫԶֲֻԶһٶ
߶.ֻܲˣڵԶ100㽶
.ˣ߰ڵԶ50ũ
.綯ӣûƽԶŵߵ
.綯䣨ûƽԶ俪ߵʯͷ
.綯ݲ棨òݲԶµĵƤ
.綯·ûƽԶµĿյƤ̳·
߰.ƤֵƤһ70Ƥ
߾.СңúСңӣ10볤ʵ
ˣ.úװ

һ.г÷ũƷ
˶.ʳࣩ꣨
.̷塢ôڵ̯
.ӻչУñӡӵӻ񻻻ƽ
.ղƷУ˷ղƷ׬ۣ
.ղƷڻгڻгѡղƷ
.ͳУ̵ѡûƽƷ
˰.ι֣·ƻƽιֲƱд󽱣
˾.ԶȡûľͷԶȡĻƽÿ3%Ϣ
ţ.ߵĶľ֣˹ǣûƽעȭս
һ.Сƹݣ굶Сƹݣ֡վơСһ£
Ŷ.Ұȭĳûȶ̹ҰȭĳׯʯͷӮ
.ϳ꣨ӡ桢ۣ
.ɿ󳡣ö๦ֲܹɿ󳡣׬ƽʯ
.Ӷôʯֱ׬ƽ𣬹еӶ
.ֳ÷䳲ֳС죬׬ƽ
.ʱгجλʱгʱժջ񡢿
Ű.ҵĹ֭꣨ҩֹ֭꣬Լ֭˿Ź
ž.гľ̿г̯λϰƷ30ˢһΣȫһ3ƽ
.СëƤ̸СҩסԺ
һ.֩루ʳƤֶ֩볡֩ׯPKӮ
.Ӫ԰ûֶ԰ֳС׬ƱǮ
.ɽɽ򣬻Сܸ桢̣
.ҵɿþҵɿ20ƽһΣչɳĿʯǮ׬Ǯע
.˾òֻ˾յᵽûƽ
.ľʲƷÿ峿Զƽ
.ըͣúɫըͣңըڵϰDelete
.ٱǮޣְٱǮޣÿ3ƽ㻨Ǯɱ͡׻ԣ
.ȼӪأB޶ȼӪأʩһӦȫٰB˷
һ.βֶ򳡣Ȧ60벻򵽣Ӯ50ƽ

һһ.ٷ񵰣Ϸ1СʱС
һ.񲻳Ѫιʳ
һ.ι
һ.ιʳ
һ.岻˺
һ.Ǵⲻ˹
һ.ˢˣ÷ˣ
һ.ˢˣ
һ.ø
.

һ.޸ĵֵ
.޸ĵ˹
.޸ĵ˹
.֩볲3֩
.ָ
.ȫ켰Ӵ徲ˣ
.治ʳ˻
.겻
.겻
.𹷲Ż
һ.Ȯ
.ľ˷
.Ȯֺ
.ѿյ
.ƬֺͰ
.ԴƤΧ
.÷Ұ
.÷ɱ˷
.Ƥ
ģ.¹ָ

һ.Ϸеһ1ʵ8޸Ϊ16ӣ
Ķ.޸İ졢ҹռһı
.ů֮10ȣ25ȣ
.ļֲﲻȼ
.ֲũﲻή
.ֹͣη磨Ϸη٣
.粻
İ.ͼߴ
ľ.ϷԶ
声.ֶ浵ϷаF5棩
һ.ٶϷаF6ٶȡ֮ǰ浵
.Զɾ
.ɫƷÿνϷƷͼʲͬɫ
.ĻEnterȱʶ
.صͼͼ꣨Mصͼͼٰ꣬Mָ
.ͼʾ̽򣨰Ctrl+2رյͼʾٰһν
.߿򣨰P߿ǿܵλã
.ðӽǣF7л30ӽǣٰһηأ
.޸ϷModsťModsťס⣩
.ˢѨʯשֶѨڣòӿڵѨڣ
һ.Ѩ
.Ҳ
.Ʒˤ
.ڷˢ
.ҵͻתͻڵͼʾ
.ɱСﲻܳͷС͵˹֣
.壨1ľͷ1ƽ壩

.ӳȼȼʱ
.ʹܶѵƷɶѵ
ߣ.ʹȼƷȼϣջٲõĵߣ
һ.Ʒ
߶.ƷƷ

.޸ǿЯƷЯ3ȣ
.޸ߵ䷽
.޸ʳףȫȷʳף
.ƷӢ






һ.ȫ

    ü±ϷĿ¼\data\scripts\playerprofile.luaļݣ

		return true -- mod character
	end

	return false

    滻Ϊ

		return true -- mod character
	end

	return true

    ɽȫϷ




.Ѫ10

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļ

    1.local wilson_health = 150滻Ϊlocal wilson_health = 1500

    2.WX78_MIN_HEALTH = 100,滻ΪWX78_MIN_HEALTH = 1000,

    3.WX78_MAX_HEALTH = 400,滻ΪWX78_MAX_HEALTH = 4000,

    4.ݣ

		WOLFGANG_HEALTH_MIGHTY = 300,
		WOLFGANG_HEALTH_NORMAL = 200,
		WOLFGANG_HEALTH_WIMPY = 150,

    滻Ϊ

		WOLFGANG_HEALTH_MIGHTY = 3000,
		WOLFGANG_HEALTH_NORMAL = 2000,
		WOLFGANG_HEALTH_WIMPY = 1500,

    5.WATHGRITHR_HEALTH = 200,滻ΪWATHGRITHR_HEALTH = 2000,

    6.WEBBER_HEALTH = 175,滻ΪWEBBER_HEALTH = 1750,

    ȫѪ10޸Ҳʹ׵;öͬ10




.ԶѪ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH)һвݣ

        inst.components.health:StartRegen(30, 10)

    ԶѪ30ΪѪ10Ϊ10ѪһΣе




.ʳＰѪ10

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

	    HEALING_TINY = 1,
	    HEALING_SMALL = 3,
	    HEALING_MEDSMALL = 8,
	    HEALING_MED = 20,
	    HEALING_MEDLARGE = 30,
	    HEALING_LARGE = 40,
	    HEALING_HUGE = 60,
	    HEALING_SUPERHUGE = 100,

    滻Ϊ

	    HEALING_TINY = 10,
	    HEALING_SMALL = 30,
	    HEALING_MEDSMALL = 80,
	    HEALING_MED = 200,
	    HEALING_MEDLARGE = 300,
	    HEALING_LARGE = 400,
	    HEALING_HUGE = 600,
	    HEALING_SUPERHUGE = 1000,

    ʳＰѪ10




.üܹ﹥ˣﷴУ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļݣ

        inst:AddComponent("grue")
        inst.components.grue:SetSounds("dontstarve/charlie/warn","dontstarve/charlie/attack")

    滻Ϊ

local function OnAttacked(inst, data)
    inst.components.health:DoDelta(inst.components.health.maxhealth)
    inst.components.sanity:DoDelta(inst.components.sanity.max)
    if data.attacker.components.health then
       data.attacker.components.health:DoDelta(-3000)
    end
end
    inst:ListenForEvent("attacked", OnAttacked)

    ܹʱѪԣﷴУںڰвᱻɱ׸ɱҵȱҲһҪ롰һͬ޸




.ʯʹã

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\resurrectionstone.luaļinst:Remove()һвݣ

        SpawnPrefab("resurrectionstone").Transform:SetPosition(inst.Transform:GetWorldPosition())

    Ǹٵµĸʯʹʯٴ




.ԶԣҲõҵѧϰ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

		SANITY_DAY_GAIN = 0,--100/(day_time*32),
		
		SANITY_NIGHT_LIGHT = -100/(night_time*20),
		SANITY_NIGHT_MID = -100/(night_time*20),
		SANITY_NIGHT_DARK = -100/(night_time*2),

    滻Ϊ

		SANITY_DAY_GAIN = 100/(day_time),

		SANITY_NIGHT_LIGHT = 100/(night_time),
		SANITY_NIGHT_MID = 100/(night_time),
		SANITY_NIGHT_DARK = 100/(night_time),

    ԶԣضҲ




.ǲ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļlocal calories_per_day = 75滻Ϊlocal calories_per_day = 0

    ɴÿ75ֵΪ




.ӻʱ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

	    FREEZING_KILL_TIME = 120,
	    STARVE_KILL_TIME = 120,

    滻Ϊ

	    FREEZING_KILL_TIME = 1200,
	    STARVE_KILL_TIME = 1200,

    ӻʱ10




ʮ.ǲ»޾ڰ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļݣ

        inst:AddComponent("grue")
        inst.components.grue:SetSounds("dontstarve/charlie/warn","dontstarve/charlie/attack")

    滻Ϊ

        --inst:AddComponent("grue")
        --inst.components.grue:SetSounds("dontstarve/charlie/warn","dontstarve/charlie/attack")
	inst.components.health.fire_damage_scale = 0

    ǲ»޾ڰ




ʮһ.ǹ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļlocal wilson_attack = 34滻Ϊlocal wilson_attack = 500

    ɽǹ34ߵ500ֿе




ʮ.ǿɶɺûʲô赲ɵ

    ü±ϷĿ¼\data\DLC0001\scripts\components\playeractionpicker.luaļ2passable = tile ~= GROUND.IMPASSABLE滻Ϊpassable = tile >= GROUND.IMPASSABLE

    ͨɫħȡʿȣ޸ļɣ͵ϣװɫħȡʿȺҼ㺣棩ܹˮϣµĹҲ޷赲עҪ滻2䣬ǧֻ滻1Ŷ




ʮ.ܵø

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

	    WILSON_WALK_SPEED = 4,
	    WILSON_RUN_SPEED = 6,

    滻Ϊ

	    WILSON_WALK_SPEED = 8,
	    WILSON_RUN_SPEED = 12,

    ܲٶ1




ʮ.ƤʯٶȲ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļ

    1.PIGGYBACK_SPEED_MULT = 0.9,滻ΪPIGGYBACK_SPEED_MULT = 1,

    2.ARMORMARBLE_SLOW = 0.7,滻ΪARMORMARBLE_SLOW = 1,

    ɱƤʯٶȲ




ʮ.ٶ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļCANE_SPEED_MULT = 1.25,滻ΪCANE_SPEED_MULT = 2.5,

    ɽٶ1




ʮ.ȫƼȫﲻûͿȫƷ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("builder")һвݣ

	inst.components.builder.science_bonus = 3
	inst.components.builder.magic_bonus = 3
	inst.components.builder.ancient_bonus = 4

    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wickerbottom.luaļinst.components.builder.science_bonus = 1滻Ϊ--inst.components.builder.science_bonus = 1

    ȫﲻûͿȫƷԶƷҲÿ̳Ϳ




ʮ.Ʒ

    ü±ϷĿ¼\data\DLC0001\scripts\actions.luaļBUILD = Action(),滻ΪBUILD = Action(0, true),

    ƷĶƷ




ʮ.ͼȫϷаCtrl+1

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("resurrectable")һвݣ

TheInput:AddKeyUpHandler(KEY_1, function()
    if TheInput:IsKeyDown(KEY_CTRL) then
       local map = TheSim:FindFirstEntityWithTag("minimap")
       local x,y,z = GetPlayer().Transform:GetWorldPosition()
       map.MiniMap:ShowArea(x, y, z, 10000)
    end
end)

    ϷаCtrl + 1ʹͼȫ




ʮ.Ӵ󵥸ѵ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ
		STACK_SIZE_LARGEITEM = 10,
		STACK_SIZE_MEDITEM = 20,
		STACK_SIZE_SMALLITEM = 40,

    滻Ϊ

		STACK_SIZE_LARGEITEM = 999,
		STACK_SIZE_MEDITEM = 999,
		STACK_SIZE_SMALLITEM = 999,

    ɼӴ󵥸ѵ999




ʮ.Ʒĸ

    ü±ϷĿ¼\data\DLC0001\scripts\components\inventory.luaļlocal MAXSLOTS = 15滻Ϊlocal MAXSLOTS = 25

    ɽƷĸ15ӵ25




ʮһ.˫Ʒ60

    1.ü±ϷĿ¼\data\DLC0001\scripts\components\inventory.luaļlocal MAXSLOTS = 15滻Ϊlocal MAXSLOTS = 60

    2.ü±ϷĿ¼\data\scripts\widgets\inventorybar.luaļself.bg:SetScale(1.15,1,1)滻Ϊself.bg:SetScale(1.86,1.85,1)

    3.ݣ

    local num_intersep = math.floor(num_slots / 5) + 1 
    local total_w = (num_slots + num_equip)*(W) + (num_slots + num_equip - 2 - num_intersep) *(SEP) + INTERSEP*num_intersep
    
    for k, v in ipairs(self.equipslotinfo) do
        local slot = EquipSlot(v.slot, v.atlas, v.image, self.owner)
        self.equip[v.slot] = self.toprow:AddChild(slot)
        local x = -total_w/2 + (num_slots)*(W)+num_intersep*(INTERSEP - SEP) + (num_slots-1)*SEP + INTERSEP + W*(k-1) + SEP*(k-1)
        slot:SetPosition(x,0,0)
        table.insert(eslot_order, slot)
        
		local item = self.owner.components.inventory:GetEquippedItem(v.slot)
		if item then
			slot:SetTile(ItemTile(item))
		end

    end    

    for k = 1,num_slots do
        local slot = InvSlot(k, HUD_ATLAS, "inv_slot.tex", self.owner, self.owner.components.inventory)
        self.inv[k] = self.toprow:AddChild(slot)
        local interseps = math.floor((k-1) / 5)
        local x = -total_w/2 + W/2 + interseps*(INTERSEP - SEP) + (k-1)*W + (k-1)*SEP
        slot:SetPosition(x,0,0)
        
		slot.top_align_tip = W*0.5 + YSEP

		local item = self.owner.components.inventory:GetItemInSlot(k)
		if item then
			slot:SetTile(ItemTile(item))
		end
        
    end

    滻Ϊ

    local num_intersep = math.floor(num_slots / 10) + 1 
    local total_w = (num_slots -30.85)*(W) + (num_slots -30.85 - 2 - num_intersep) *(SEP) + INTERSEP*num_intersep
    
    for k, v in ipairs(self.equipslotinfo) do
        local slot = EquipSlot(v.slot, v.atlas, v.image, self.owner)
        self.equip[v.slot] = self.toprow:AddChild(slot)
        local x = -total_w/2 + (num_slots*0+14.07)*(W)+num_intersep*(INTERSEP - SEP) + (num_slots-1)*SEP + INTERSEP + W*(k-1) + SEP*(k-1)
        slot:SetPosition(x+341,190,0)
        table.insert(eslot_order, slot)
        
		local item = self.owner.components.inventory:GetEquippedItem(v.slot)
		if item then
			slot:SetTile(ItemTile(item))
		end

    end    

    for k = 1,30 do
        local slot = InvSlot(k, HUD_ATLAS, "inv_slot.tex", self.owner, self.owner.components.inventory)
        self.inv[k] = self.toprow:AddChild(slot)
        local interseps = math.floor((k-1) / 10)
        local x = -total_w/2 + W/2 + interseps*(INTERSEP - SEP) + (k-1)*W + (k-1)*SEP
        slot:SetPosition(x,0,0)
        
		local item = self.owner.components.inventory:GetItemInSlot(k)
		if item then
			slot:SetTile(ItemTile(item))
		end
        
    end

    for k = 31,60 do
        local slot = InvSlot(k, HUD_ATLAS, "inv_slot.tex", self.owner, self.owner.components.inventory)
        self.inv[k] = self.toprow:AddChild(slot)
        local interseps = math.floor((k-1-30) / 10)
        local x = -total_w/2 + W/2 + interseps*(INTERSEP - SEP) + (k-1-30)*W + (k-1-30)*SEP
        slot:SetPosition(x,80,0)
        
		local item = self.owner.components.inventory:GetItemInSlot(k)
		if item then
			slot:SetTile(ItemTile(item))
		end
        
    end

    ɻ˫Ʒ60񣩣ע뽫Ϸãoptions - Settings - HUD sizeΪ0ʾСƷſʾ60Ŷ




ʮ.ͬʱЯɿ棩

    1.ͬʱЯͨü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luaļinst.components.inventoryitem.cangoincontainer = false滻Ϊinst.components.inventoryitem.cangoincontainer = true

    2.ͬʱЯСü±ϷĿ¼\data\DLC0001\scripts\prefabs\piggyback.luaļinst.components.inventoryitem.cangoincontainer = false滻Ϊinst.components.inventoryitem.cangoincontainer = true

    3.ͬʱЯ˹ü±ϷĿ¼\data\DLC0001\scripts\prefabs\krampus_sack.luaļinst.components.inventoryitem.cangoincontainer = false滻Ϊinst.components.inventoryitem.cangoincontainer = true

    4.ͬʱЯü±ϷĿ¼\data\DLC0001\scripts\prefabs\icepack.luaļinst.components.inventoryitem.cangoincontainer = false滻Ϊinst.components.inventoryitem.cangoincontainer = true

    ͬʱЯ




ʮ.39

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luaļ

    1.ݣ

for y = 0, 3 do
	table.insert(slotpos, Vector3(-162, -y*75 + 114 ,0))
	table.insert(slotpos, Vector3(-162 +75, -y*75 + 114 ,0))

    滻Ϊ

for y = 0, 12 do
	table.insert(slotpos, Vector3(-162, -y*75 + 435 ,0))
	table.insert(slotpos, Vector3(-162 +75, -y*75 + 435 ,0))
	table.insert(slotpos, Vector3(-162 +150, -y*75 + 435 ,0))

    2.ݣ

    inst.components.container.widgetanimbank = "ui_backpack_2x4"
    inst.components.container.widgetanimbuild = "ui_backpack_2x4"
    inst.components.container.widgetpos = Vector3(-5,-70,0)

    滻Ϊ

    --inst.components.container.widgetanimbank = "ui_backpack_2x4"
    --inst.components.container.widgetanimbuild = "ui_backpack_2x4"
    inst.components.container.widgetpos = Vector3(-25,-50,0)

    ͨ39




ʮ.쿲˹

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("piggyback", {Ingredient("pigskin", 4), Ingredient("silk", 6), Ingredient("rope", 2)}, RECIPETABS.SURVIVAL, TECH.SCIENCE_TWO)һвݣ

Recipe("krampus_sack", {Ingredient("cutgrass", 5),Ingredient("twigs", 5)}, RECIPETABS.SURVIVAL, TECH.NONE)

    ѡף£5ݡ5쿲˹Ҫ롰ͳСһͬ޸ģΪͳСѾп˹




ʮ.Ͽ亣

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\woodie.luaļinst.components.beaverness:DoDelta(3)滻Ϊinst.components.beaverness:DoDelta(0)

    Ͽ亣




ʮ.ϳԷ亣Ʒ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\woodie.luaļ

    1.inst.components.inventory:DropEverything()滻Ϊ--inst.components.inventory:DropEverything()


    2.inst.Light:SetColour(245/255,40/255,0/255)һвݣ

local function OnEat(inst, food)
    if food.prefab == "monstermeat" and not inst.components.beaverness:IsBeaver() then
       if not inst.components.beaverness.doing_transform then
          inst.components.beaverness:SetPercent(1)
       end
    end
end
    inst.components.eater:SetOnEatFn(OnEat)

    ϳԷ亣꣬ƷϣֻǿȱϼʹáҪɫʱ亣꣬򿳵ľͷԶߣ޷ԵҪ롰СС֡һͬ޸




ʮ.ͼԱʧߣ̫̫˯

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wickerbottom.luaļinst:AddTag("insomniac")滻Ϊ--inst:AddTag("insomniac")

    ̫̫Ҳ˯




ʮ.˹ħٻ

    1.ü±ϷĿ¼\data\scripts\prefabs\waxwelljournal.luaļreader.components.sanity:RecalculatePenalty()滻Ϊ--reader.components.sanity:RecalculatePenalty()


    2.ü±ϷĿ¼\data\scripts\prefabs\shadowwaxwell.luaļݣ

    inst:ListenForEvent("death", ondeath)

	inst:AddComponent("inventory")
    inst.components.inventory.dropondeath = false

    inst:AddComponent("sanityaura")
    inst.components.sanityaura.penalty = TUNING.SHADOWWAXWELL_SANITY_PENALTY

    滻Ϊ

    --inst:ListenForEvent("death", ondeath)

	inst:AddComponent("inventory")
    inst.components.inventory.dropondeath = false

    --inst:AddComponent("sanityaura")
    --inst.components.sanityaura.penalty = TUNING.SHADOWWAXWELL_SANITY_PENALTY

    ˹ħٻʱ




ʮ.˿˹Գ߲

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wathgrithr.luaļinst.components.eater:SetCarnivore(true)滻Ϊ--inst.components.eater:SetCarnivore(true)

    ú췢˿˹ֹԳ⣬ҲԳ߲




ʮ.Τɹ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\webber.luaļinst:AddTag("monster")滻Ϊ--inst:AddTag("monster")

    Τɹˡ˵ﲻ




ʮһ.ȫƷʹãߡסħȡ·ñӡƷȫʹã

    1.ü±ϷĿ¼\data\DLC0001\scripts\widgets\itemtile.luaļݣ

    if invitem.components.fueled then
        self:SetPercent(invitem.components.fueled:GetPercent())
    end

    if invitem.components.finiteuses then
        self:SetPercent(invitem.components.finiteuses:GetPercent())
    end


    if invitem.components.perishable then
        if self:HasSpoilage() then
            self:SetPerishPercent(invitem.components.perishable:GetPercent())
        else
            self:SetPercent(invitem.components.perishable:GetPercent())
        end
    end
    
    if invitem.components.armor then
        self:SetPercent(invitem.components.armor:GetPercent())
    end

    滻Ϊ

    --if invitem.components.fueled then
        --self:SetPercent(invitem.components.fueled:GetPercent())
    --end

    --if invitem.components.finiteuses then
        --self:SetPercent(invitem.components.finiteuses:GetPercent())
    --end


    if invitem.components.perishable then
        if self:HasSpoilage() then
            self:SetPerishPercent(invitem.components.perishable:GetPercent())
        else
            self:SetPercent(invitem.components.perishable:GetPercent())
        end
    end
    
    --if invitem.components.armor then
        --self:SetPercent(invitem.components.armor:GetPercent())
    --end


    2.ü±ϷĿ¼\data\scripts\components\finiteuses.luaļself:SetUses(self.current - (num or 1))滻Ϊself:SetUses(self.current - 0)


    3.ü±ϷĿ¼\data\DLC0001\scripts\components\fueled.luaļself.consuming = true滻Ϊself.consuming = false


    4.ü±ϷĿ¼\data\scripts\components\armor.luaļݣ

function Armor:SetCondition(amount)
    self.condition = amount

滻Ϊ

function Armor:SetCondition(amount)
    self.condition = self.maxcondition

    ȫƷʹáлѺʯͷӪȼգֱ˯µضϨ




ʮ.޸װʹôʱ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

ͷ	    AXE_USES = 100,
	    HAMMER_USES = 75,
	    SHOVEL_USES = 25,
ݲ	    PITCHFORK_USES = 25,
	    PICKAXE_USES = 33,
	    BUGNET_USES = 10,
ì	    SPEAR_USES = 150,
˿˹ì	    WATHGRITHR_SPEAR_USES = 200,
	    SPIKE_USES = 100,
	    FISHINGROD_USES = 9,
	    TRAP_USES = 8,
	    BOOMERANG_USES = 10,
Ӱ	    NIGHTSWORD_USES = 100,
ħ	    ICESTAFF_USES = 20,
ħ	    FIRESTAFF_USES = 20,
ħ	    TELESTAFF_USES = 5,
ɫħ		YELLOWSTAFF_USES = 20,
ɫħ		ORANGESTAFF_USES = 20,
ɫħ		GREENSTAFF_USES = 5,
ħ	    TORNADOSTAFF_USES = 15,
ȶ̹	    HAMBAT_USES = 100,
	    BATBAT_USES = 75,
๦ܹ߸ͷͳͷ	    MULTITOOL_AXE_PICKAXE_USES = 400,
ԶŶ̰	    RUINS_BAT_USES = 150,
ɫ	    REDAMULET_USES = 20,
ɫ	    BLUEAMULET_FUEL = total_day_time * 0.75,
ɫ	    PURPLEAMULET_FUEL = total_day_time * 0.4,
ɫ		YELLOWAMULET_FUEL = total_day_time,
ɫ		ORANGEAMULET_USES = 225,
ɫ		GREENAMULET_USES = 5,
	    PANFLUTE_USES = 10,
ţ	    HORN_USES = 10,
	    TRAP_TEETH_USES = 10,
		TENT_USES = 6,
˯С		SIESTA_CANOPY_USES = 6,
ɡ		UMBRELLA_USES = 20,
߰		SEWINGKIT_USES = 5,
		FERTILIZER_USES = 10,
		GLOMMERBELL_USES = 3,
	    TORCH_FUEL = night_time*1.25,
ҹ	    NIGHTSTICK_FUEL = night_time*6,
ñ	    MINERHAT_LIGHTTIME = (night_time+dusk_time)*2.6,
	    LANTERN_LIGHTTIME = (night_time+dusk_time)*2.6,
֩ñ	    SPIDERHAT_PERISHTIME = 4*seg_time,
	    ONEMANBAND_PERISHTIME = 6*seg_time,
ɡ	    GRASS_UMBRELLA_PERISHTIME = 2*total_day_time*perish_warp,
ɡ	    UMBRELLA_PERISHTIME = total_day_time*6,
۾ñ	    EYEBRELLA_PERISHTIME = total_day_time*9,
ñ		STRAWHAT_PERISHTIME = total_day_time*5,
ö		EARMUFF_PERISHTIME = total_day_time*5,
ñ		WINTERHAT_PERISHTIME = total_day_time*10,
ţëñ		BEEFALOHAT_PERISHTIME = total_day_time*10,
	TRUNKVEST_PERISHTIME = total_day_time*15,
䱳		REFLECTIVEVEST_PERISHTIME = total_day_time*8,
ĳ		HAWAIIANSHIRT_PERISHTIME = total_day_time*15,
Сɱ	SWEATERVEST_PERISHTIME = total_day_time*10,
		HUNGERBELT_PERISHTIME = total_day_time*8,
ܱ		BEARGERVEST_PERISHTIME = total_day_time*7,
		RAINCOAT_PERISHTIME = total_day_time*10,
ñ	WALRUSHAT_PERISHTIME = total_day_time*25,
ëñ	FEATHERHAT_PERISHTIME = total_day_time*8,
ñ		TOPHAT_PERISHTIME = total_day_time*8,
ñ		ICEHAT_PERISHTIME = total_day_time*4,
ñ		MOLEHAT_PERISHTIME = total_day_time*1.5,
ñ		RAINHAT_PERISHTIME = total_day_time*10,
ñ		CATCOONHAT_PERISHTIME = total_day_time*10,
ë	    FEATHER_FAN_USES = 15,

    Ӵÿе֣Ӹװʹôʱ䡣ţëñʹʱ10ͽBEEFALOHAT_PERISHTIME = total_day_time*10,滻ΪBEEFALOHAT_PERISHTIME = total_day_time*100,




ʮ.˺ֵӴ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

	    UNARMED_DAMAGE = 10,
Ӱ	    NIGHTSWORD_DAMAGE = wilson_attack*2,
	    BATBAT_DAMAGE = wilson_attack * 1.25,
ݽ	    BATBAT_DRAIN = wilson_attack * 0.2,
	    SPIKE_DAMAGE = wilson_attack*1.5,
ȶ̹	    HAMBAT_DAMAGE = wilson_attack*1.75,
ì	    SPEAR_DAMAGE = wilson_attack,
˿˹ì	    WATHGRITHR_SPEAR_DAMAGE = wilson_attack * 1.25,
ͷ	    AXE_DAMAGE = wilson_attack*.8,
	    PICK_DAMAGE = wilson_attack*.8,
	    BOOMERANG_DAMAGE = wilson_attack*.8,
	    TORCH_DAMAGE = wilson_attack*.5,
	    HAMMER_DAMAGE = wilson_attack*.5,
	    SHOVEL_DAMAGE = wilson_attack*.5,
ݲ	    PITCHFORK_DAMAGE = wilson_attack*.5,
	    BUGNET_DAMAGE = wilson_attack*.125,
	    FISHINGROD_DAMAGE = wilson_attack*.125,
ɡ	    UMBRELLA_DAMAGE = wilson_attack*.5,
	    CANE_DAMAGE = wilson_attack*.5,
๦ܹ	    MULTITOOL_DAMAGE = wilson_attack*.9,
ԶŶ̰	    RUINS_BAT_DAMAGE = wilson_attack * 1.75,
ҹ	    NIGHTSTICK_DAMAGE = wilson_attack*.85, -- Due to the damage being electric, it will get multiplied by 1.5 against any mob
	    PIPE_DART_DAMAGE = 100,
	    TRAP_TEETH_DAMAGE = 60,
ҩ		GUNPOWDER_DAMAGE = 200,
	    LIGHTER_DAMAGE = wilson_attack*.5,
۾	    EYETURRET_DAMAGE = 65,
	    TORNADO_DAMAGE = 7,

    Ӵÿ֣˺ֵϷе˺ֵ޸ĵֳ34ǹ罫Ӱ˺ֵ10ͽNIGHTSWORD_DAMAGE = wilson_attack*2,滻ΪNIGHTSWORD_DAMAGE = wilson_attack*20,




ʮ.ھͲѪ100%˺ֵ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļ

    1.ݿףARMORGRASS_ABSORPTION = .6,滻ΪARMORGRASS_ABSORPTION = 1,

    2.ľףARMORWOOD_ABSORPTION = .8,滻ΪARMORWOOD_ABSORPTION = 1,

    3.ʯףARMORMARBLE_ABSORPTION = .95,滻ΪARMORMARBLE_ABSORPTION = 1,

    4.ţףARMORSNURTLESHELL_ABSORPTION = 0.6,滻ΪARMORSNURTLESHELL_ABSORPTION = 1,

    5.ԶſףARMORRUINS_ABSORPTION = 0.9,滻ΪARMORRUINS_ABSORPTION = 1,

    6.ARMORSLURPER_ABSORPTION = 0.6,滻ΪARMORSLURPER_ABSORPTION = 1,

    7.ƤñARMOR_FOOTBALLHAT_ABSORPTION = .8,滻ΪARMOR_FOOTBALLHAT_ABSORPTION = 1,

    8.ѿףARMORDRAGONFLY_ABSORPTION = 0.7,滻ΪARMORDRAGONFLY_ABSORPTION = 1,

    9.˿˹ñARMOR_WATHGRITHRHAT_ABSORPTION = .8,滻ΪARMOR_WATHGRITHRHAT_ABSORPTION = 1,

    10.ԶڣARMOR_RUINSHAT_ABSORPTION = 0.9,滻ΪARMOR_RUINSHAT_ABSORPTION = 1,

    11.ţñARMOR_SLURTLEHAT_ABSORPTION = 0.9,滻ΪARMOR_SLURTLEHAT_ABSORPTION = 1,

    12.ñARMOR_BEEHAT_ABSORPTION = .8,滻ΪARMOR_BEEHAT_ABSORPTION = 1,

    13.ҹħףARMOR_SANITY_ABSORPTION = .95,滻ΪARMOR_SANITY_ABSORPTION = 1,

    ÿ100%˺ֵ




ʮ.߿;

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

ݿ	    ARMORGRASS = wilson_health*1.5,
ľ	    ARMORWOOD = wilson_health*3,
ʯ		ARMORMARBLE = wilson_health*7,
ţ		ARMORSNURTLESHELL = wilson_health*7,
Զſ		ARMORRUINS = wilson_health * 12,
		ARMORSLURPER = wilson_health * 4,
Ƥñ	    ARMOR_FOOTBALLHAT = wilson_health*3,
ѿ		ARMORDRAGONFLY = wilson_health * 9,
˿˹ñ		ARMOR_WATHGRITHRHAT = wilson_health * 5,
Զ		ARMOR_RUINSHAT = wilson_health*8,
ţñ		ARMOR_SLURTLEHAT = wilson_health*5,
ñ	    ARMOR_BEEHAT = wilson_health*5,
ҹħ		ARMOR_SANITY = wilson_health * 5,

    Ӵÿ֣߿;òݿ;10ARMORGRASS = wilson_health*1.5,滻ΪARMORGRASS = wilson_health*15,




ʮ.̣Զ100%

    ü±ϷĿ¼\data\scripts\components\armor.luaļݣ

function Armor:SetCondition(amount)
    self.condition = amount

    滻Ϊ

function Armor:SetCondition(amount)
    self.condition = self.maxcondition

    ÿ




ʮ.һβɼ

    ü±ϷĿ¼\data\DLC0001\scripts\components\pickable.luaļself.numtoharvest = number or 1滻Ϊself.numtoharvest = 5

    ȫɼƷһβɼ5ֿеҲɵ޸ĳƷһβɼ

    1.ݣü±ϷĿ¼\data\DLC0001\scripts\prefabs\grass.luaļinst.components.pickable:SetUp("cutgrass", TUNING.GRASS_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("cutgrass", TUNING.GRASS_REGROW_TIME, 5)

    2.֦ü±ϷĿ¼\data\DLC0001\scripts\prefabs\sapling.luaļinst.components.pickable:SetUp("twigs", TUNING.SAPLING_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("twigs", TUNING.SAPLING_REGROW_TIME, 5)

    3.Ģü±ϷĿ¼\data\DLC0001\scripts\prefabs\mushrooms.luaļinst.components.pickable:SetUp(data.pickloot, nil)滻Ϊinst.components.pickable:SetUp(data.pickloot, nil, 5)

    4.ܲü±ϷĿ¼\data\scripts\prefabs\carrot.luaļinst.components.pickable:SetUp("carrot", 10)滻Ϊinst.components.pickable:SetUp("carrot", 10, 5)

    5.«έü±ϷĿ¼\data\scripts\prefabs\reeds.luaļinst.components.pickable:SetUp("cutreeds", TUNING.REEDS_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("cutreeds", TUNING.REEDS_REGROW_TIME, 5)

    6.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļinst.components.pickable:SetUp("berries", TUNING.BERRY_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("berries", TUNING.BERRY_REGROW_TIME, 5)

    7.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\flower.luaļinst.components.pickable:SetUp("petals", 10)滻Ϊinst.components.pickable:SetUp("petals", 10, 5)

    8.ħü±ϷĿ¼\data\DLC0001\scripts\prefabs\flower_evil.luaļinst.components.pickable:SetUp("petals_evil", 10)滻Ϊinst.components.pickable:SetUp("petals_evil", 10, 5)

    9.Ѩü±ϷĿ¼\data\scripts\prefabs\flower_cave.luaļinst.components.pickable:SetUp("lightbulb", TUNING.FLOWER_CAVE_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("lightbulb", TUNING.FLOWER_CAVE_REGROW_TIME, 5)

    10.㽶ü±ϷĿ¼\data\scripts\prefabs\cave_banana_tree.luaļinst.components.pickable:SetUp("cave_banana", TUNING.CAVE_BANANA_GROW_TIME)滻Ϊinst.components.pickable:SetUp("cave_banana", TUNING.CAVE_BANANA_GROW_TIME, 5)

    11.ާࣺü±ϷĿ¼\data\scripts\prefabs\cave_fern.luaļinst.components.pickable:SetUp("foliage", 10)滻Ϊinst.components.pickable:SetUp("foliage", 10, 5)

    12.ľ̿ü±ϷĿ¼\data\DLC0001\scripts\prefabs\evergreens.luaļinst.components.lootdropper:SpawnLootPrefab("charcoal")滻Ϊݣ

    inst.components.lootdropper:SpawnLootPrefab("charcoal")
    inst.components.lootdropper:SpawnLootPrefab("charcoal")
    inst.components.lootdropper:SpawnLootPrefab("charcoal")
    inst.components.lootdropper:SpawnLootPrefab("charcoal")
    inst.components.lootdropper:SpawnLootPrefab("charcoal")

    13.ݣü±ϷĿ¼\data\scripts\prefabs\mandrake.luaļinst:AddComponent("pickable")һвinst.components.pickable:SetUp("mandrake", 10, 4)

    ɵ޸ĳƷһβɼ




ʮ.ٲɼݡ֦

    1.ݣü±ϷĿ¼\data\DLC0001\scripts\prefabs\grass.luaļinst:AddComponent("pickable")һвinst.components.pickable.quickpick = true

    2.֦ü±ϷĿ¼\data\DLC0001\scripts\prefabs\sapling.luaļinst:AddComponent("pickable")һвinst.components.pickable.quickpick = true

    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļinst:AddComponent("pickable")һвinst.components.pickable.quickpick = true




ʮ.Զ̲ɼʰƷ

    ü±ϷĿ¼\data\DLC0001\scripts\actions.luaļݣ

    PICK = Action(),
    PICKUP = Action(1),

    滻Ϊ

    PICK = Action(0, true, false, 20),
    PICKUP = Action(1, true, false, 20),

    ݡ辵ƷֱӲɼǲܹȥԼʱ




ʮ.ոߣһβɼֲܱ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\panflute.luaļ

    1.ݣ

local function HearPanFlute(inst, musician, instrument)
	if inst.components.sleeper then
	    inst.components.sleeper:AddSleepiness(10, TUNING.PANFLUTE_SLEEPTIME)
	end
end

    滻Ϊ

local function HearPanFlute(inst, musician, instrument)
    local pos = Vector3(inst.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
    for k,v in pairs(ents) do
        if v.components.pickable and v.prefab ~= "flower" then
           v.components.pickable:Pick(GetPlayer())
        end
        if v.components.crop then
           v.components.crop:Harvest(GetPlayer())
        end
    end
end


    2.ݣ

    inst.components.instrument.range = TUNING.PANFLUTE_SLEEPRANGE
    inst.components.instrument:SetOnHeardFn(HearPanFlute)
    
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.PLAY)
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.PANFLUTE_USES)
    inst.components.finiteuses:SetUses(TUNING.PANFLUTE_USES)
    inst.components.finiteuses:SetOnFinished( onfinished)
    inst.components.finiteuses:SetConsumption(ACTIONS.PLAY, 1)

    滻Ϊ

    inst.components.instrument:SetOnHeardFn(HearPanFlute)
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.PLAY)

    ɴһβɼֲܱ˻ũҲոԭд߹ȡħѡźã5«έ1ݡ1졣ݲң԰޸ļɡñݡ޸һ




ʮһ.ֺͨܲһβ10ܲ

    1.ü±ϷĿ¼\data\scripts\prefabs\seeds.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("carrot_planted").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\scripts\prefabs\carrot.luaļinst.components.pickable:SetUp("carrot", 10)滻Ϊinst.components.pickable:SetUp("carrot", 10, 10)

    ֺͨܲһβ10ڿյϰҼֲҲ˳




ʮ.ñ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\poop.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("mandrake").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ñݣһ




ʮ.һһһ俪һʯ

    1.ü±ϷĿ¼\data\scripts\prefabs\axe.luaļinst.components.tool:SetAction(ACTIONS.CHOP)滻Ϊinst.components.tool:SetAction(ACTIONS.CHOP, 15)

    2.ü±ϷĿ¼\data\scripts\prefabs\pickaxe.luaļinst.components.tool:SetAction(ACTIONS.MINE)滻Ϊinst.components.tool:SetAction(ACTIONS.MINE, 15)

    һһһ俪һʯ




ʮ.3ľͷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\evergreens.luaļ

    1.ݣ

                normal_loot = {"log", "log", "pinecone"},
                short_loot = {"log"},
                tall_loot = {"log", "log", "log", "pinecone", "pinecone"},

    滻Ϊ

                normal_loot = {"log", "log", "log", "log", "log", "log", "pinecone"},
                short_loot = {"log", "log", "log"},
                tall_loot = {"log", "log", "log", "log", "log", "log", "log", "log", "log", "pinecone", "pinecone"},


    2.ݣ

                normal_loot = {"log","log"},
                short_loot = {"log"},
                tall_loot = {"log", "log","log"},

    滻Ϊ

                normal_loot = {"log","log","log","log", "log", "log"},
                short_loot = {"log","log", "log"},
                tall_loot = {"log", "log","log","log","log","log", "log", "log", "log"},

    ɿ3ľͷ




ʮ.׮

    1.ͨ׮ü±ϷĿ¼\data\DLC0001\scripts\prefabs\evergreens.luaļinst.AnimState:PushAnimation(inst.anims.stump)һвinst:Remove()


    2.׮ü±ϷĿ¼\data\DLC0001\scripts\prefabs\deciduoustrees.luaļinst.AnimState:PushAnimation(inst.anims.stump)һвinst:Remove()

    ɿ׮ʡ׮ʱ䡣Ҫ롰׮һͬ޸




ʮ.׮

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\evergreens.luaļ

    1.ݣ

local function chop_down_tree(inst, chopper)
    inst:RemoveComponent("burnable")
    MakeSmallBurnable(inst)
    inst:RemoveComponent("propagator")
    MakeSmallPropagator(inst)
    inst:RemoveComponent("workable")

    滻Ϊ

    MakeLargeBurnable(inst)
    MakeLargePropagator(inst)


    2.ݣ

    RemovePhysicsColliders(inst)
    inst.AnimState:PushAnimation(inst.anims.stump)
	
	inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.DIG)
    inst.components.workable:SetOnFinishCallback(dig_up_stump)
    inst.components.workable:SetWorkLeft(1)
    
    inst:AddTag("stump")
    if inst.components.growable then
        inst.components.growable:StopGrowing()
    end

    滻Ϊ

    inst.AnimState:PushAnimation(inst.anims.stump)

    ׮ȡò׮Ҫ׮ˣյɡעճɿֻʣһŻҡҪ롰׮һͬ޸




ʮ.ɿʱ50%ڳʯʯ

    ü±ϷĿ¼\data\scripts\prefabs\rocks.luaļݣ

SetSharedLootTable( 'rock1',
{
    {'rocks',  1.00},
    {'rocks',  1.00},
    {'rocks',  1.00},
    {'nitre',  1.00},
    {'flint',  1.00},
    {'nitre',  0.25},
    {'flint',  0.60},
})

SetSharedLootTable( 'rock2',
{
    {'rocks',     	1.00},
    {'rocks',     	1.00},
    {'rocks',     	1.00},
    {'goldnugget',  1.00},
    {'flint',     	1.00},
    {'goldnugget',  0.25},
    {'flint',     	0.60},
})

SetSharedLootTable( 'rock_flintless',
{
    {'rocks',   1.0},
    {'rocks',   1.0},
    {'rocks',   1.0},
    {'rocks',  	1.0},
    {'rocks',   0.6},
})

SetSharedLootTable( 'rock_flintless_med',
{
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 0.4},
})


SetSharedLootTable( 'rock_flintless_low',
{
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 0.2},
})

    滻Ϊ

SetSharedLootTable( 'rock1',
{
    {'rocks',  1.00},
    {'rocks',  1.00},
    {'rocks',  1.00},
    {'nitre',  1.00},
    {'flint',  1.00},
    {'nitre',  0.25},
    {'flint',  0.60},
    {'bluegem',  0.50},
    {'redgem',  0.50},
    {'orangegem',  0.50},
    {'yellowgem',  0.50},
    {'greengem',  0.50},
    {'purplegem',  0.50},
    {'thulecite',  0.50},
})

SetSharedLootTable( 'rock2',
{
    {'rocks',     	1.00},
    {'rocks',     	1.00},
    {'rocks',     	1.00},
    {'goldnugget',  1.00},
    {'flint',     	1.00},
    {'goldnugget',  0.25},
    {'flint',     	0.60},
    {'bluegem',  0.50},
    {'redgem',  0.50},
    {'orangegem',  0.50},
    {'yellowgem',  0.50},
    {'greengem',  0.50},
    {'purplegem',  0.50},
    {'thulecite',  0.50},
})

SetSharedLootTable( 'rock_flintless',
{
    {'rocks',   1.0},
    {'rocks',   1.0},
    {'rocks',   1.0},
    {'rocks',  	1.0},
    {'rocks',   0.6},
    {'bluegem',  0.50},
    {'redgem',  0.50},
    {'orangegem',  0.50},
    {'yellowgem',  0.50},
    {'greengem',  0.50},
    {'purplegem',  0.50},
    {'thulecite',  0.50},
})

SetSharedLootTable( 'rock_flintless_med',
{
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 0.4},
    {'bluegem',  0.50},
    {'redgem',  0.50},
    {'orangegem',  0.50},
    {'yellowgem',  0.50},
    {'greengem',  0.50},
    {'purplegem',  0.50},
    {'thulecite',  0.50},
})


SetSharedLootTable( 'rock_flintless_low',
{
    {'rocks', 1.0},
    {'rocks', 1.0},
    {'rocks', 0.2},
    {'bluegem',  0.50},
    {'redgem',  0.50},
    {'orangegem',  0.50},
    {'yellowgem',  0.50},
    {'greengem',  0.50},
    {'purplegem',  0.50},
    {'thulecite',  0.50},
})

    ڲɿʱ50%ڳʯʯҲɽbluegemʯredgem챦ʯorangegemȱʯyellowgemƱʯgreengem̱ʯpurplegemϱʯthuleciteʯƷkoalefant_summer󣩡koalefant_winter󣩣0.50ĳָΪҪ




ʮ.ɿʱƽ

    ü±ϷĿ¼\data\scripts\prefabs\rocks.luaļ

    1.{'nitre',  0.25},һвݣ

    {'goldnugget',  1.00},
    {'goldnugget',  1.00},
    {'goldnugget',  1.00},

    2.{'goldnugget',  0.25},һвݣ

    {'goldnugget',  1.00},
    {'goldnugget',  1.00},
    {'goldnugget',  1.00},

    3.{'rocks',   0.6},һвݣ

    {'goldnugget',  1.00},
    {'goldnugget',  1.00},
    {'goldnugget',  1.00},

    4.{'rocks', 0.4},һвݣ

    {'goldnugget',  1.00},
    {'goldnugget',  1.00},
    {'goldnugget',  1.00},

    5.{'rocks', 0.2},һвݣ

    {'goldnugget',  1.00},
    {'goldnugget',  1.00},
    {'goldnugget',  1.00},

    ڲɿʱ3ƽ




ʮ.޿ʯͷʯͷʧ

    ü±ϷĿ¼\data\scripts\prefabs\rocks.luaļinst:Remove()滻Ϊinst.components.workable.workleft = 10

    ڿʱȵʯʯͷֲʧ޿ʯͷ




ʮ.ڲһε10ݴ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\grass.luaļinst:Remove()һвݣ

	inst.components.lootdropper:SetLoot({"dug_grass", "dug_grass", "dug_grass", "dug_grass", "dug_grass", "dug_grass", "dug_grass", "dug_grass", "dug_grass"})
	local pt = Point(inst.Transform:GetWorldPosition())
	inst.components.lootdropper:DropLoot(pt)

    ڲһε10ݴأݴֲݵ




ʮһ.ֲݲʩ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\grass.luaļ

    1.ݣ

local function ontransplantfn(inst)
	if inst.components.pickable then
		inst.components.pickable:MakeBarren()
	end
end

    滻Ϊ

local function ontransplantfn(inst)
	--if inst.components.pickable then
		--inst.components.pickable:MakeBarren()
	--end
end


    2.local function onpickedfn(inst)һвݣ

	inst.components.pickable.cycles_left = 20
 
    ֲݲʩ




ʮ.ڹһε10Ը

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļinst.components.lootdropper:SpawnLootPrefab("dug_"..bushname)һвݣ

	inst.components.lootdropper:SetLoot({"dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname, "dug_"..bushname})
	local pt = Point(inst.Transform:GetWorldPosition())
	inst.components.lootdropper:DropLoot(pt)

    ڹһε10ԸԸֹԵ




ʮ.ֹԲʩ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļ

    1.inst.components.pickable:MakeBarren()滻Ϊ--inst.components.pickable:MakeBarren()


    2.local function onpickedfn(inst, picker)һвinst.components.pickable.cycles_left = 5

    ֹԲʩʣɽҲʹԽή




ʮ.ժֻ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļinst:DoTaskInTime(3+math.random()*3, spawnperd)滻Ϊ--inst:DoTaskInTime(3+math.random()*3, spawnperd)

    ժٳĻ




ʮ.ժƲ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cactus.luaļݣ

        picker.components.combat:GetAttacked(inst, TUNING.CACTUS_DAMAGE)
        picker:PushEvent("thorns")

    滻Ϊ

        --picker.components.combat:GetAttacked(inst, TUNING.CACTUS_DAMAGE)
        --picker:PushEvent("thorns")

    ժƲ




ʮ.һε10

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\sapling.luaļinst:Remove()һвݣ

	inst.components.lootdropper:SetLoot({"dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling", "dug_sapling"})
	local pt = Point(inst.Transform:GetWorldPosition())
	inst.components.lootdropper:DropLoot(pt)

    һε10辵




ʮ.«έֲ«έ«έֲ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cutreeds.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("reeds").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\scripts\prefabs\reeds.luaļinst:AddComponent("inspectable")һвݣ

local function dig_up(inst, chopper)
    inst.components.lootdropper:SpawnLootPrefab("cutreeds")
    inst:Remove()
end
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.DIG)
    inst.components.workable:SetOnFinishCallback(dig_up)
    inst.components.workable:SetWorkLeft(1)
    inst:AddComponent("lootdropper")

    «έԱӲ«έ«έ«έʹ«έֲ




ʮ.ڼ̹ľһε10̹ľ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\marsh_bush.luaļinst:Remove()һвݣ

	inst.components.lootdropper:SetLoot({"dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush", "dug_marsh_bush"})
	local pt = Point(inst.Transform:GetWorldPosition())
	inst.components.lootdropper:DropLoot(pt)

    ڼ̹ľһε10̹ľ̹ľּ̹ľģɼ辣һᱻһ




ʮ.ּ̹ľֲͣͣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\marsh_bush.luaļ

    1.picker.components.combat:GetAttacked(inst, TUNING.MARSHBUSH_DAMAGE)滻Ϊ--picker.components.combat:GetAttacked(inst, TUNING.MARSHBUSH_DAMAGE)


    2.inst.components.pickable:SetUp("twigs", TUNING.MARSHBUSH_REGROW_TIME)滻Ϊinst.components.pickable:SetUp("butter", TUNING.MARSHBUSH_REGROW_TIME*.25,3)

    ֵļ̹ľ辶Ĳ3ͣ1쳤1ΣŶ̹ľһòͿ֣ʩʣĽԳ




ʮ.ֲֻ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\petals.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("flower").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ûֻʹɷֲ




ʮһ.֦㽶

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\twigs.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("cave_banana_tree").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ֦㽶




ʮ.ĢĢĢֲ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\mushrooms.luaļinst.AnimState:PlayAnimation(data.animname.."_cap")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab(data.animname.."_mushroom").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    úĢֺĢĢĢĢĢĢֲ




ʮ.̦޺̦޺̦޺ֲ

    ü±ϷĿ¼\data\scripts\prefabs\cutlichen.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("lichen").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ̦޺̦޺ʹ̦޺ֲҪ롰̱䣨̦޺̱䣬ƽÿ峿ֽ5ƿţֽ̣ɲԣһͬ޸




ʮ.ӫ䶴Ѩ

    ü±ϷĿ¼\data\scripts\prefabs\lightbulb.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("flower_cave_triple").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ӫ䶴Ѩ




ʮ.Ѩӫ

    ü±ϷĿ¼\data\scripts\prefabs\flower_cave.luaļinst:AddComponent("inspectable")һвݣ

local function dig_up(inst, chopper)
    inst.components.lootdropper:SpawnLootPrefab("lightbulb")
    inst:Remove()
end
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.DIG)
    inst.components.workable:SetOnFinishCallback(dig_up)
    inst.components.workable:SetWorkLeft(1)

    òӲѨӫʹѨԱƳ




ʮ.̲ݡ辡̹ľѨ̦޺«έʱ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļ

    1.ݣ

	    GRASS_REGROW_TIME = total_day_time*3,
	    SAPLING_REGROW_TIME = total_day_time*4,
	    MARSHBUSH_REGROW_TIME = total_day_time*4,
	    CACTUS_REGROW_TIME = total_day_time*4,
	    FLOWER_CAVE_REGROW_TIME = total_day_time*3,
	    LICHEN_REGROW_TIME = total_day_time*5,
	    
	    BERRY_REGROW_TIME = total_day_time*3,

    滻Ϊ

	    GRASS_REGROW_TIME = total_day_time*1,
	    SAPLING_REGROW_TIME = total_day_time*1,
	    MARSHBUSH_REGROW_TIME = total_day_time*1,
	    CACTUS_REGROW_TIME = total_day_time*1,
	    FLOWER_CAVE_REGROW_TIME = total_day_time*1,
	    LICHEN_REGROW_TIME = total_day_time*1,
	    
	    BERRY_REGROW_TIME = total_day_time*1,


    2.REEDS_REGROW_TIME = total_day_time*3,滻ΪREEDS_REGROW_TIME = total_day_time*1,

    Щֲ1쳤1




ʮ.ݡ辡Ģ㽶̦޺«έҲ

    ü±ϷĿ¼\data\DLC0001\scripts\standardcomponents.luaļinst.components.pickable:Pause()滻Ϊinst.components.pickable:Resume()

    ֲﶬҲע浵ѾǶ죬ֲѾֹͣôֻнֲ£Żڶ




ʮ.ŽǣţũֲѸٳ

    ü±ϷĿ¼\data\scripts\prefabs\horn.luaļ

    1.ݣ

local function onfinished(inst)
    inst:Remove()
end

    һвݣ

function growfn(inst, reader)
    local pos = Vector3(reader.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
    for k,v in pairs(ents) do
        if v.components.pickable then
           v.components.pickable:FinishGrowing()
        end
        if v.components.crop then
           v.components.crop:DoGrow(TUNING.TOTAL_DAY_TIME*3)
        end
        if v:HasTag("tree") and v.components.growable and not v:HasTag("stump") then
           v.components.growable:DoGrowth()
        end
    end
end

    2.ݣ

    inst.components.instrument.range = TUNING.HORN_RANGE
    inst.components.instrument:SetOnHeardFn(HearHorn)

    滻Ϊ

    inst.components.instrument.onheard = growfn

    ڲɼֲţǣʹֲ˲СҲԳɴţԭţ湦ʧЧ




ʮ.ũջƷ

    ü±ϷĿ¼\data\DLC0001\scripts\components\crop.luaļݣ

        harvester.components.inventory:GiveItem(product)

    滻Ϊ

        harvester.components.inventory:GiveItem(SpawnPrefab(self.product_prefab))
        harvester.components.inventory:GiveItem(SpawnPrefab(self.product_prefab))
        harvester.components.inventory:GiveItem(SpawnPrefab(self.product_prefab))

    һջ3Ʒջ٣͸ƶharvester.components.inventory:GiveItem(SpawnPrefab(self.product_prefab))




ʮ.ũ1볤

    1.ü±ϷĿ¼\data\scripts\prefabs\seeds.luaļinst.components.plantable.growtime = TUNING.SEEDS_GROW_TIME滻Ϊinst.components.plantable.growtime = TUNING.SEEDS_GROW_TIME*0


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\veggies.luaļinst.components.plantable.growtime = TUNING.SEEDS_GROW_TIME滻Ϊinst.components.plantable.growtime = TUNING.SEEDS_GROW_TIME*0

    ũ1볤




ʮһ.ũҲ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļMIN_CROP_GROW_TEMP = 5,滻ΪMIN_CROP_GROW_TEMP = -100,

    ũڶҲ




ʮ.ũﲻʩ

    ü±ϷĿ¼\data\DLC0001\scripts\components\grower.luaļself.cycles_left = self.cycles_left - 1滻Ϊself.cycles_left = self.cycles_left

    ũﲻʩ




ʮ.һն

    ü±ϷĿ¼\data\DLC0001\scripts\components\stewer.luaļݣ

harvester.components.inventory:GiveItem(loot, nil, Vector3(TheSim:GetScreenPos(self.inst.Transform:GetWorldPosition())))

    滻Ϊ

harvester.components.inventory:GiveItem(SpawnPrefab(self.product))
harvester.components.inventory:GiveItem(SpawnPrefab(self.product))
harvester.components.inventory:GiveItem(SpawnPrefab(self.product))

    һ3ն٣͸ƶharvester.components.inventory:GiveItem(SpawnPrefab(self.product))




ʮ.ʱ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļBASE_COOK_TIME = night_time*.3333,滻ΪBASE_COOK_TIME = seg_time*.01,

    ʹ˲




ʮ.327

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\icebox.luaļ

    1.for y = 2, 0, -1 do滻Ϊfor y = 8, 0, -1 do


    2.ݣ

    inst.components.container.widgetanimbank = "ui_chest_3x3"
    inst.components.container.widgetanimbuild = "ui_chest_3x3"
    inst.components.container.widgetpos = Vector3(0,200,0)

    滻Ϊ

    --inst.components.container.widgetanimbank = "ui_chest_3x3"
    --inst.components.container.widgetanimbuild = "ui_chest_3x3"
    inst.components.container.widgetpos = Vector3(0,100,0)

    ñ327




ʮ.ñ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļPERISH_FRIDGE_MULT = .5,滻ΪPERISH_FRIDGE_MULT = 0,

    ÷ʳñʡ0Ϊ-5ʹʵʳظʶ




ʮ.ʳƷ

    1.ͨʳƷü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luaļinst:AddComponent("inspectable")һвinst:AddTag("fridge")


    2.СʳƷü±ϷĿ¼\data\DLC0001\scripts\prefabs\piggyback.luaļinst:AddComponent("inspectable")һвinst:AddTag("fridge")


    3.˹ʳƷü±ϷĿ¼\data\DLC0001\scripts\prefabs\krampus_sack.luaļinst:AddComponent("inspectable")һвinst:AddTag("fridge")

    ñ߱书




ʮ.ȴϼɣ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

		DRY_FAST = total_day_time,
		DRY_MED = 2*total_day_time,

    滻Ϊ

		DRY_FAST = total_day_time*0,
		DRY_MED = 2*total_day_time*0,

    ȴϼ




ʮ.һն

    ü±ϷĿ¼\data\DLC0001\scripts\components\dryer.luaļݣ

harvester.components.inventory:GiveItem(loot, nil, Vector3(TheSim:GetScreenPos(self.inst.Transform:GetWorldPosition())))

    滻Ϊ

harvester.components.inventory:GiveItem(SpawnPrefab(self.product))
harvester.components.inventory:GiveItem(SpawnPrefab(self.product))
harvester.components.inventory:GiveItem(SpawnPrefab(self.product))

    13⣬ն٣͸ƶharvester.components.inventory:GiveItem(SpawnPrefab(self.product))




ʮ.ľ981

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\treasurechest.luaļ

    1.ݣ

for y = 2, 0, -1 do
	for x = 0, 2 do

    滻Ϊ

for y = 8, 0, -1 do
	for x = 0, 8 do


    2.ݣ

		inst.components.container.widgetanimbank = "ui_chest_3x3"
		inst.components.container.widgetanimbuild = "ui_chest_3x3"
		inst.components.container.widgetpos = Vector3(0,200,0)

    滻Ϊ

		--inst.components.container.widgetanimbank = "ui_chest_3x3"
		--inst.components.container.widgetanimbuild = "ui_chest_3x3"
		inst.components.container.widgetpos = Vector3(0,100,0)

    ľ981




ʮһ.9108

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\dragonfly_chest.luaļ

    1.ݣ

for y = 2.5, -0.5, -1 do
    for x = 0, 2 do

    滻Ϊ

for y = 8, 0, -1 do
    for x = 0, 11 do


    2.ݣ

    inst.components.container.widgetanimbank = "ui_chester_shadow_3x4"
    inst.components.container.widgetanimbuild = "ui_chester_shadow_3x4"	
    inst.components.container.widgetpos = Vector3(0,200,0)

    滻Ϊ

    --inst.components.container.widgetanimbank = "ui_chester_shadow_3x4"
    --inst.components.container.widgetanimbuild = "ui_chester_shadow_3x4"	
    inst.components.container.widgetpos = Vector3(-200,100,0)

    ʹ9108




ʮ.ѡƷһ10

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļݣ

Recipe("rope", {Ingredient("cutgrass", 3)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE)
Recipe("boards", {Ingredient("log", 4)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE)
Recipe("cutstone", {Ingredient("rocks", 3)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE)
Recipe("papyrus", {Ingredient("cutreeds", 4)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE)
Recipe("nightmarefuel", {Ingredient("petals_evil", 4)}, RECIPETABS.REFINE, TECH.MAGIC_TWO)
Recipe("purplegem", {Ingredient("redgem",1), Ingredient("bluegem", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO)

    滻Ϊ

Recipe("rope", {Ingredient("cutgrass", 3)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE,nil,nil,nil,10)
Recipe("boards", {Ingredient("log", 4)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE,nil,nil,nil,10)
Recipe("cutstone", {Ingredient("rocks", 3)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE,nil,nil,nil,10)
Recipe("papyrus", {Ingredient("cutreeds", 4)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE,nil,nil,nil,10)
Recipe("nightmarefuel", {Ingredient("petals_evil", 4)}, RECIPETABS.REFINE, TECH.MAGIC_TWO,nil,nil,nil,10)
Recipe("purplegem", {Ingredient("redgem",1), Ingredient("bluegem", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO,nil,nil,nil,10)

    þѡŰɫʯӡľ塢ʯשֽجȼϡϱʯһ10




ʮ.ι߲˶

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\birdcage.luaļlocal num_seeds = math.random(2)滻Ϊlocal num_seeds = 10

    ιһ߲˵10ӣֿ




ʮ.ҰҲ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\birds.luaļreturn not GetWorld().components.seasonmanager:IsWinter()滻Ϊreturn true

    ҰڶҲ




ʮ.Ӹñ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļPERISH_SUPERSLOW = 40*total_day_time*perish_warp,滻ΪPERISH_SUPERSLOW = 200*total_day_time*perish_warp,

    Ӹʱӻ5




ʮ.ջ䲻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\beebox.luaļinst.components.childspawner:ReleaseAllChildren(picker)滻Ϊ--inst.components.childspawner:ReleaseAllChildren(picker)

    ջ䲻




ʮ.10ɲ60ۣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\beebox.luaļ

    1.ݣ

    { amount=6, idle="honey3", hit="hit_honey3" },
    { amount=3, idle="honey2", hit="hit_honey2" },
    { amount=1, idle="honey1", hit="hit_honey1" },

    滻Ϊ

    { amount=60, idle="honey3", hit="hit_honey3" },
    { amount=30, idle="honey2", hit="hit_honey2" },
    { amount=10, idle="honey1", hit="hit_honey1" },


    2.inst.components.harvestable:SetUp("honey", 6, nil, onharvest, updatelevel)滻Ϊinst.components.harvestable:SetUp("honey", 60, nil, onharvest, updatelevel)

    ÷10ɼչܵʱ




ʮ.ٲ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\beebox.luaļ

    1.ݣ

	        inst.components.harvestable:SetGrowTime(TUNING.BEEBOX_HONEY_TIME)
	        inst.components.harvestable:StartGrowing()
	    end
	end
end

local function stopsleep(inst)
	if not inst:HasTag("burnt") then
	    if inst.components.harvestable then
	        inst.components.harvestable:SetGrowTime(nil)
	        inst.components.harvestable:StopGrowing()

    滻Ϊ

	        inst.components.harvestable:SetGrowTime(TUNING.BEEBOX_HONEY_TIME*.01)
	        inst.components.harvestable:StartGrowing()
	    end
	end
end

local function stopsleep(inst)
	if not inst:HasTag("burnt") then
	    if inst.components.harvestable then
	        inst.components.harvestable:SetGrowTime(TUNING.BEEBOX_HONEY_TIME*.01)
	        inst.components.harvestable:StartGrowing()


    2.inst:ListenForEvent( "dusktime", StopSpawningFn(inst), GetWorld())滻Ϊinst:ListenForEvent( "dusktime", StartSpawningFn(inst), GetWorld())

    ÷ٲۣһ




ʮ.ө治ˣ˿𡢰Ҳɿ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\fireflies.luaļݣ

        inst:AddTag("NOCLICK")
        if inst.lighton then
            fadeout(inst)
        end
        inst.lighton = false

    滻Ϊ

        if not inst.lighton then
            fadein(inst)
        end
        inst.lighton = true

    ө治




ʮ.ץ۷䡢ɱ˷䡢ө棨óɫԿȡ

    1.ץ۷䡢ɱ˷䣺ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bee.luaļinst.components.inventoryitem.canbepickedup = false滻Ϊinst.components.inventoryitem.canbepickedup = true


    2.ץü±ϷĿ¼\data\DLC0001\scripts\prefabs\butterfly.luaļinst.components.inventoryitem.canbepickedup = false滻Ϊinst.components.inventoryitem.canbepickedup = true


    3.ץө棺ü±ϷĿ¼\data\DLC0001\scripts\prefabs\fireflies.luaļ2inst.components.inventoryitem.canbepickedup = false滻Ϊinst.components.inventoryitem.canbepickedup = true

    ɿץ۷䡢ɱ˷䡢ө棬Ҳóɫȡ




ʮһ.ҵţţڵͼʾ

    ü±ϷĿ¼\data\scripts\prefabs\beefalo.luaļinst:AddComponent("inspectable")һвݣ

    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "beemine.png" )

    ڵͼϿţλãʾΪըͼ꣬Ϊ㲻֪ʲôʱᷢ




ʮ.ţٶ1

    ü±ϷĿ¼\data\scripts\prefabs\beefalo.luaļinst.components.periodicspawner:SetRandomTimes(40, 60)滻Ϊinst.components.periodicspawner:SetRandomTimes(20, 30)

    ţٶ1Լ2030һΡţĸб㣬ͲˣҪڼŶ




ʮ.ιţ߲޲

    ü±ϷĿ¼\data\scripts\prefabs\beefalo.luaļinst.components.eater:SetVegetarian()һвݣ

local function OnGetItemFromPlayer(inst, giver, item)
    if item.components.edible.foodtype == "VEGGIE" then
       SpawnPrefab("butter").Transform:SetPosition(inst.Transform:GetWorldPosition())	
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer

    ιţ޲߲޲ͣ൱ڼţ




ʮ.ţҲɼţë

    ü±ϷĿ¼\data\scripts\prefabs\beefaloļݣ

    inst.components.beard.canshavetest = function() if not inst.components.sleeper:IsAsleep() then return false, "AWAKEBEEFALO" end return true end

    滻Ϊ

    inst.components.beard.canshavetest = function() if not inst.components.sleeper:IsAsleep() then return true, "AWAKEBEEFALO" end return true end

    ţʱҲɼţë




ʮ.ģţëñţȺ棬ţ幥ǣ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

    local function beefalo_equip(inst, owner)
        onequip(inst, owner)
        owner:AddTag("beefalo")
    end
    local function beefalo_unequip(inst, owner)
        onunequip(inst, owner)
        owner:RemoveTag("beefalo")
    end
    local function beefalo()
        local inst = simple()
        inst.components.equippable:SetOnEquip( beefalo_equip )
        inst.components.equippable:SetOnUnequip( beefalo_unequip )

        inst:AddComponent("insulator")
        inst.components.insulator:SetInsulation(TUNING.INSULATION_LARGE)

        inst:AddComponent("waterproofer")
        inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
        
        inst:AddComponent("fueled")
        inst.components.fueled.fueltype = "USAGE"
        inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME)
        inst.components.fueled:SetDepletedFn(generic_perish)
        
        
        return inst
    end

    滻Ϊ

    local function beefalo_disable(inst)
        if inst.updatetask then
            inst.updatetask:Cancel()
            inst.updatetask = nil
        end
        local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
            owner.components.leader:RemoveFollowersByTag("beefalo")
    end
    local function beefalo_update(inst)
        local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
        if owner and owner.components.leader then
            local x,y,z = owner.Transform:GetWorldPosition()
            local ents = TheSim:FindEntities(x,y,z, TUNING.SPIDERHAT_RANGE, {"beefalo"})
            for k,v in pairs(ents) do
                if v.components.follower and not v.components.follower.leader and not owner.components.leader:IsFollower(v) and owner.components.leader.numfollowers < 50 then
                    owner.components.leader:AddFollower(v)
                end
            end
        end
    end
    local function beefalo_enable(inst)
        inst.updatetask = inst:DoPeriodicTask(0.5, beefalo_update, 1)
    end
    local function beefalo_equip(inst, owner)
        onequip(inst, owner)
        beefalo_enable(inst)
        owner:AddTag("beefalo")
    end
    local function beefalo_unequip(inst, owner)
        onunequip(inst, owner)
        beefalo_disable(inst)
        owner:RemoveTag("beefalo")
    end
    local function beefalo_perish(inst)
        beefalo_disable(inst)
        inst:Remove()
    end
    local function beefalo()
        local inst = simple()
        inst.components.equippable:SetOnEquip( beefalo_equip )
        inst.components.equippable:SetOnUnequip( beefalo_unequip )
        inst:AddComponent("insulator")
        inst.components.insulator.insulation = TUNING.INSULATION_LARGE
        inst:AddComponent("waterproofer")
        inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
        inst:AddComponent("fueled")
        inst.components.fueled.fueltype = "USAGE"
        inst.components.fueled:InitializeFuelLevel(TUNING.BEEFALOHAT_PERISHTIME)
        inst.components.fueled:SetDepletedFn(beefalo_perish)
        return inst
    end


    2.ü±ϷĿ¼\data\scripts\prefabs\beefalo.luaļreturn not guy:HasTag("beefalo") and滻Ϊreturn not guy:HasTag("beefalo") and not guy:HasTag("player") and


    3.return dude:HasTag("beefalo") and not dude:HasTag("player") and not dude.components.health:IsDead()滻Ϊreturn dude:HasTag("beefalo") and dude:HasTag("player") and not dude.components.health:IsDead()


    4.inst.components.locomotor.walkspeed = 1.5滻Ϊinst.components.locomotor.walkspeed = 3

    ɴţëñţȺ棬ɱţǲἯ巴Ҳţ·ٶȡϡţٶ1ιţ߲޲͡ţҲɼţë޸ģ޸ļɣͿűȡůţ⡢ͣӪԼţȺ




ʮ.ֳţţëСţ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\beefalowool.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("babybeefalo").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ţëСţ˹ԼţȺ




ʮ.ֳӣӶӿɶѵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rabbit.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("rabbithole").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM

    ӵӶӿɶѵ




ʮ.ֳ𼦣üֻµҲȦĻ𼦣

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\egg.luaļinst.components.cookable.product = "bird_egg_cooked"һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("perd").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\scripts\prefabs\perd.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("periodicspawner")
    inst.components.periodicspawner:SetPrefab("bird_egg")
    inst.components.periodicspawner:SetRandomTimes(360, 480)
    inst.components.periodicspawner:Start()


    3.ü±ϷĿ¼\data\scripts\brains\perdbrain.luaļݣ

        WhileNode(function() return clock and not clock:IsDay() end, "IsNight",
            DoAction(self.inst, GoHomeAction, "Go Home", true )),
        DoAction(self.inst, EatFoodAction, "Eat Food"),
        RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST, STOP_RUN_DIST),
        DoAction(self.inst, PickBerriesAction, "Pick Berries", true),
        Wander(self.inst, HomePos, MAX_WANDER_DIST),

    滻Ϊ

        DoAction(self.inst, EatFoodAction, "Eat Food"),
        RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST/2.5, STOP_RUN_DIST/3),

    üֻµҲȦĻ𼦣𼦲ܣڹҲʧһһ




ʮ.ֳβִ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\manrabbit_tail.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local names = {"koalefant_summer","koalefant_winter"}
    inst.name = names[math.random(#names)]
    SpawnPrefab(inst.name).Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    βִƷǶҲ




һ.ֳָ񵰵ò¸񵰵Ĵ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tallbirdegg.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("tallbird").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tallbird.luaļinst.components.combat:SetRange(TUNING.TALLBIRD_ATTACK_RANGE)滻Ϊinst.components.combat:SetRange(TUNING.TALLBIRD_ATTACK_RANGE*0)


    3.inst:AddComponent("inspectable")һвݣ

    inst:AddComponent("periodicspawner")
    inst.components.periodicspawner:SetPrefab("tallbirdegg")
    inst.components.periodicspawner:SetRandomTimes(80, 110)
    inst.components.periodicspawner:SetDensityInRange(20, 2)
    inst.components.periodicspawner:SetMinimumSpacing(8)
    inst.components.periodicspawner:Start()

    ָ񵰵ô񣬸޹Ϊ¸񵰣񵰿ɶѵ




һһ.¹㣨ˢ㣩

    1.ü±ϷĿ¼\data\scripts\prefabs\fishingrod.luaļinst.components.fishingrod:SetWaitTimes(4, 40)滻Ϊinst.components.fishingrod:SetWaitTimes(0, 0)


    2.ü±ϷĿ¼\data\scripts\components\fishable.luaļself.fishleft = self.fishleft - 1滻Ϊself.fishleft = self.fishleft

    ڳʱ¹㣬ˢ㡣Ϸԭ趨Ϊ10һʱŻ




һ.øʳͨ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\spoiledfood.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("pond").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    øʳͨ




һ.ֿɵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\froglegs.luaļinst.AnimState:PlayAnimation("idle")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("pond_cave").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ֿɵ




һ.òڵ

    ü±ϷĿ¼\data\scripts\prefabs\pond.luaļinst:AddComponent("inspectable")һвݣ

local function dig_up(inst, chopper)
    inst:Remove()
end
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.DIG)
    inst.components.workable:SetOnFinishCallback(dig_up)
    inst.components.workable:SetWorkLeft(1)

    òڵ




һ.϶

    ü±ϷĿ¼\data\scripts\prefabs\pond.luaļif snow_cover > thresh and not inst.frozen then滻Ϊif snow_cover > thresh and inst.frozen then

    ɶ϶ڶҲܵ




һ.ܡ

    ü±ϷĿ¼\data\scripts\prefabs\pond.luaļ

    1.inst.components.childspawner.childname = "mosquito"滻Ϊ--inst.components.childspawner.childname = "mosquito"


    2.inst.components.childspawner.childname = "frog"滻Ϊ--inst.components.childspawner.childname = "frog"

    óܡӣȻԵõش




һ.ܲ͵

    ü±ϷĿ¼\data\scripts\prefabs\frog.luaļinst.components.combat.onhitotherfn = function(inst, other, damage) inst.components.thief:StealItem(other) end滻Ϊ--inst.components.combat.onhitotherfn = function(inst, other, damage) inst.components.thief:StealItem(other) end

    ڹʱǲƷ




һ.߳

    ü±ϷĿ¼\data\scripts\prefabs\pond.luaļ2inst.planttype = "marsh_plant"滻Ϊinst.planttype = "mandrake"

    ó߳ݣһʱ᳤ֻһעһҪ滻2Ŷ




һ.ǿҹӣHҹӹܣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

local function lightson(inst)
    inst.components.machine.ison = true
    inst.Light:Enable(true)
end
local function lightsoff(inst)
    inst.components.machine.ison = false
    inst.Light:Enable(false)
end
    local light = inst.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:Enable(false)
    light:SetColour(0/255, 255/255, 0/255)
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = lightson
    inst.components.machine.turnofffn = lightsoff
TheInput:AddKeyUpHandler(KEY_H, function() if inst.components.machine:IsOn() then inst.components.machine:TurnOff() else inst.components.machine:TurnOn() end end )

    ϷаHҹӹܣҪ桢󹤵




һһ.治þõʣ0%ʧɼã

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\torch.luaļ

    1.inst:Remove()滻Ϊ--inst:Remove()


    2.inst.components.fueled:SetDepletedFn(function(inst) inst:Remove() end)滻Ϊ--inst.components.fueled:SetDepletedFn(function(inst) inst:Remove() end)

    ûõʣ0%ʧɼáǰ--Ĺܾǽþϵ




һһһ.󹤵ʹ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

            inst.components.fueled:StartConsuming()
            inst.SoundEmitter:PlaySound("dontstarve/common/minerhatAddFuel")

    滻Ϊ

            inst.components.fueled:StopConsuming()
            inst.SoundEmitter:PlaySound("dontstarve/common/minerhatAddFuel")

    ÿ󹤵ʹ




һһ.Ƹľͷ辡ţȿȼȼ

    ü±ϷĿ¼\data\scripts\prefabs\mininglantern.luaļinst.components.fueled.fueltype = "CAVE"滻Ϊ--inst.components.fueled.fueltype = "CAVE"

    ûȼʱľͷ辡ţȿȼȼϣӫ




һһ.ƿԵ50

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļ

    1.MED_LARGE_FUEL = seg_time * 3,滻ΪMED_LARGE_FUEL = total_day_time*50,


    2.LANTERN_LIGHTTIME = (night_time+dusk_time)*2.6,滻ΪLANTERN_LIGHTTIME = total_day_time*50,

    ʹƿԵ50졣Ȼ999ҲУֻҪ50Ϊ999




һһ.Ϲϵʹã

    ü±ϷĿ¼\data\scripts\prefabs\pumpkin_lantern.luaļ

    1.2inst.components.perishable:StopPerishing()滻Ϊ--inst.components.perishable:StopPerishing()


    2.ݣ

    inst:AddComponent("perishable")
    inst.components.perishable:SetPerishTime(30*TUNING.SEG_TIME)
    inst.components.perishable:SetOnPerishFn(onperish)
    inst.components.inventoryitem:SetOnDroppedFn(function(inst)
		inst.components.perishable:StartPerishing()

    滻Ϊ

    --inst:AddComponent("perishable")
    --inst.components.perishable:SetPerishTime(30*TUNING.SEG_TIME)
    --inst.components.perishable:SetOnPerishFn(onperish)
    inst.components.inventoryitem:SetOnDroppedFn(function(inst)
		--inst.components.perishable:StartPerishing()

    Ϲϵʹ




һһ.ʯ˹ƣԶȼԶԶ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\nitre.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("maxwelllight").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\scripts\prefabs\maxwelllight.luaļinst:AddComponent("inspectable")һвݣ

local function onhammered(inst, worker)
    SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
    SpawnPrefab("nitre").Transform:SetPosition(inst.Transform:GetWorldPosition())
    inst:Remove()
end

    inst:AddComponent("playerprox")
    inst.components.playerprox:SetDist(17, 27 )
    inst.components.playerprox:SetOnPlayerNear(function() if not inst.components.burnable:IsBurning() then inst.components.burnable:Ignite() end end)
    inst.components.playerprox:SetOnPlayerFar(extinguish)
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(1)
    inst.components.workable:SetOnFinishCallback(onhammered)


    3.ü±ϷĿ¼\data\scripts\prefabs\maxwelllight_flame.luaļݣ

    {anim="level1", sound="dontstarve/common/maxlight", radius=1, intensity=.75, falloff= 1, colour = {207/255,234/255,245/255}, soundintensity=.1},
    {anim="level2", sound="dontstarve/common/maxlight", radius=1.5, intensity=.8, falloff=.9, colour = {207/255,234/255,245/255}, soundintensity=.3},
    {anim="level3", sound="dontstarve/common/maxlight", radius=2, intensity=.8, falloff=.8, colour = {207/255,234/255,245/255}, soundintensity=.6},
    {anim="level4", sound="dontstarve/common/maxlight", radius=2.5, intensity=.9, falloff=.7, colour = {207/255,234/255,245/255}, soundintensity=1},
    {anim="level1", sound="dontstarve/common/maxlight", radius=2, intensity=.75, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.1},
    {anim="level2", sound="dontstarve/common/maxlight", radius=3, intensity=.8, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.3},
    {anim="level3", sound="dontstarve/common/maxlight", radius=4, intensity=.8, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.6},
    {anim="level4", sound="dontstarve/common/maxlight", radius=6, intensity=.9, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=1},

    滻Ϊ

    {anim="level1", sound="dontstarve/common/maxlight", radius=5, intensity=.75, falloff= 1, colour = {207/255,234/255,245/255}, soundintensity=.1},
    {anim="level2", sound="dontstarve/common/maxlight", radius=7.5, intensity=.8, falloff=.9, colour = {207/255,234/255,245/255}, soundintensity=.3},
    {anim="level3", sound="dontstarve/common/maxlight", radius=10, intensity=.8, falloff=.8, colour = {207/255,234/255,245/255}, soundintensity=.6},
    {anim="level4", sound="dontstarve/common/maxlight", radius=12.5, intensity=.9, falloff=.7, colour = {207/255,234/255,245/255}, soundintensity=1},
    {anim="level1", sound="dontstarve/common/maxlight", radius=10, intensity=.75, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.1},
    {anim="level2", sound="dontstarve/common/maxlight", radius=15, intensity=.8, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.3},
    {anim="level3", sound="dontstarve/common/maxlight", radius=20, intensity=.8, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=.6},
    {anim="level4", sound="dontstarve/common/maxlight", radius=30, intensity=.9, falloff=.4, colour = {207/255,234/255,245/255}, soundintensity=1},

    ʯ˹ƣԶȼԶԶ𣬲Ҫʱôһټɡinst.components.playerprox:SetDist(17, 27 )е17Ϊȼ룬27ΪԶϨ룬е




һһ.ʯͷӪ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\firepit.luaļif section == 0 then滻Ϊif section < 0 then

    ʯͷӪ𣬵˯µضϵͳǻὫϨȼϼֱֲ




һһ.磨ϡѨԶַ޺ڰ

    1.ü±ϷĿ¼\data\DLC0001\scripts\components\clock.luaļݣ

    self.dayColour =         Point(255/255, 230/255, 158/255)
    self.duskColour =        Point(100/255, 100/255, 100/255)
    self.nightColour =       Point(0/255,   0/255,   0/255)
    self.fullMoonColour =    Point(84/255,  122/255, 156/255)
    self.caveColour =        Point(0/255,   0/255,   0/255)
    self.dayNightVisionColour =         Point(200/255,  200/255, 200/255)
    self.duskNightVisionColour =        Point(120/255,  120/255, 120/255)
    self.nightNightVisionColour =       Point(200/255,  200/255, 200/255)
    self.fullMoonNightVisionColour =    Point(200/255,  200/255, 200/255)
    self.caveNightVisionColour =        Point(200/255,  200/255, 200/255)

    滻Ϊ

    self.dayColour =         Point(255/255, 230/255, 158/255)
    self.duskColour =        Point(255/255, 230/255, 158/255)
    self.nightColour =       Point(255/255, 230/255, 158/255)
    self.fullMoonColour =    Point(255/255, 230/255, 158/255)
    self.caveColour =        Point(255/255, 230/255, 158/255)
    self.dayNightVisionColour =         Point(255/255, 230/255, 158/255)
    self.duskNightVisionColour =        Point(255/255, 230/255, 158/255)
    self.nightNightVisionColour =       Point(255/255, 230/255, 158/255)
    self.fullMoonNightVisionColour =    Point(255/255, 230/255, 158/255)
    self.caveNightVisionColour =        Point(255/255, 230/255, 158/255)


    2.ü±ϷĿ¼\data\scripts\components\nightmareclock.luaļݣ

	self.calmColour = Point(0, 0, 0)
	self.warnColour = Point(0, 0, 0)
	self.nightmareColour = Point(0, 0, 0)
	self.dawnColour = Point(0, 0, 0)

    滻Ϊ

	self.calmColour = Point(255/255, 230/255, 158/255)
	self.warnColour = Point(255/255, 230/255, 158/255)
	self.nightmareColour = Point(255/255, 230/255, 158/255)
	self.dawnColour = Point(255/255, 230/255, 158/255)

    ӵһ磬ҪΪ




һһ.Я

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\scienceprototyper.luaļMakeObstaclePhysics(inst, .4)滻Ϊݣ

local function turnon(inst)
    inst.components.machine.ison = true
    inst:AddComponent("inventoryitem")
end
local function turnoff(inst)
    inst.components.machine.ison = false
    inst:RemoveComponent("inventoryitem")
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff
    inst:AddComponent("equippable")


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\magicprototyper.luaļMakeObstaclePhysics(inst, .4)滻Ϊݣ

local function turnon(inst)
    inst.components.machine.ison = true
    inst:AddComponent("inventoryitem")
end
local function turnoff(inst)
    inst.components.machine.ison = false
    inst:RemoveComponent("inventoryitem")
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff
    inst:AddComponent("equippable")

    ڻϰҼ̶ٰɴϡ̶ʱڵϣڻϰҼɹ̶ڵ




һһ.

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļ

    1.ݣ

Recipe("researchlab", {Ingredient("goldnugget", 1),Ingredient("log", 4),Ingredient("rocks", 4)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer")
Recipe("researchlab2", {Ingredient("boards", 4),Ingredient("cutstone", 2), Ingredient("transistor", 2)}, RECIPETABS.SCIENCE,  TECH.SCIENCE_ONE, "researchlab2_placer")

    滻Ϊ

Recipe("researchlab", {Ingredient("goldnugget", 1),Ingredient("log", 4),Ingredient("rocks", 4)}, RECIPETABS.SCIENCE, TECH.NONE, "researchlab_placer",1)
Recipe("researchlab2", {Ingredient("boards", 4),Ingredient("cutstone", 2), Ingredient("transistor", 2)}, RECIPETABS.SCIENCE,  TECH.SCIENCE_ONE, "researchlab2_placer",1)


    2.ݣ

Recipe("researchlab4", {Ingredient("rabbit", 4), Ingredient("boards", 4), Ingredient("tophat", 1)}, RECIPETABS.MAGIC, TECH.SCIENCE_ONE, "researchlab4_placer")
Recipe("researchlab3", {Ingredient("livinglog", 3), Ingredient("purplegem", 1), Ingredient("nightmarefuel", 7)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO, "researchlab3_placer")

    滻Ϊ

Recipe("researchlab4", {Ingredient("rabbit", 4), Ingredient("boards", 4), Ingredient("tophat", 1)}, RECIPETABS.MAGIC, TECH.SCIENCE_ONE, "researchlab4_placer",1)
Recipe("researchlab3", {Ingredient("livinglog", 3), Ingredient("purplegem", 1), Ingredient("nightmarefuel", 7)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO, "researchlab3_placer",1)

    ûŽ죬ʡռ




һ.ûƽԶż̳ԽԶſƼ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\goldnugget.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("ancient_altar").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ûƽԶż̳Զװȥ2




һһ.ǽ;

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ

		HAYWALL_HEALTH = 100,
		WOODWALL_HEALTH = 200,
		STONEWALL_HEALTH = 400,
		RUINSWALL_HEALTH = 800,

    滻Ϊ

		HAYWALL_HEALTH = 1000,
		WOODWALL_HEALTH = 2000,
		STONEWALL_HEALTH = 4000,
		RUINSWALL_HEALTH = 8000,

    ǽ;10




һ.ǽԶѪ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\walls.luaļif old_percent > 0 and new_percent <= 0 then clearobstacle(inst) endһвݣ

		if new_percent < 1 then inst.components.health:StartRegen(200, 1) end
		if new_percent >= 1 then inst.components.health:StopRegen() end

    ǽԶѪ2001Ϊÿ1200Ѫֿе




һ.ǽ̣Լң޷ƻ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\walls.luaļinst:AddTag("noauradamage")һвݣ

    inst.components.health:SetInvincible(true)

    ǽ




һ.ũ䡢

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļ

    1.ݣ

Recipe("slow_farmplot", {Ingredient("cutgrass", 8),Ingredient("poop", 4),Ingredient("log", 4)}, RECIPETABS.FARM,  TECH.SCIENCE_ONE, "slow_farmplot_placer")
Recipe("fast_farmplot", {Ingredient("cutgrass", 10),Ingredient("poop", 6),Ingredient("rocks", 4)}, RECIPETABS.FARM,  TECH.SCIENCE_TWO, "fast_farmplot_placer")

    滻Ϊ

Recipe("slow_farmplot", {Ingredient("cutgrass", 8),Ingredient("poop", 4),Ingredient("log", 4)}, RECIPETABS.FARM,  TECH.SCIENCE_ONE, "slow_farmplot_placer", 1)
Recipe("fast_farmplot", {Ingredient("cutgrass", 10),Ingredient("poop", 6),Ingredient("rocks", 4)}, RECIPETABS.FARM,  TECH.SCIENCE_TWO, "fast_farmplot_placer", 1)


    2.ݣ

Recipe("beebox", {Ingredient("boards", 2),Ingredient("honeycomb", 1),Ingredient("bee", 4)}, RECIPETABS.FARM, TECH.SCIENCE_ONE, "beebox_placer")
Recipe("meatrack", {Ingredient("twigs", 3),Ingredient("charcoal", 2), Ingredient("rope", 3)}, RECIPETABS.FARM, TECH.SCIENCE_ONE, "meatrack_placer")

    滻Ϊ

Recipe("beebox", {Ingredient("boards", 2),Ingredient("honeycomb", 1),Ingredient("bee", 4)}, RECIPETABS.FARM, TECH.SCIENCE_ONE, "beebox_placer", 1)
Recipe("meatrack", {Ingredient("twigs", 3),Ingredient("charcoal", 2), Ingredient("rope", 3)}, RECIPETABS.FARM, TECH.SCIENCE_ONE, "meatrack_placer", 1)

    ũ䡢ܽŽ죬ʡռ




һ.ںϸǽ

    ü±ϷĿ¼\data\DLC0001\scripts\components\builder.luaļݣ
	
	if tile == GROUND.IMPASSABLE then
		return false

    滻Ϊ

	if tile == GROUND.IMPASSABLE then
		return true

    ںϸǽȻҪ޸ġǿɶɺ޸ļɣܵŶעⲻҪںǽũļӲúܸ




һ.Χ쵺죩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\turfs.luaļreturn tiletype == GROUND.DIRT or inst.data.tile == "webbing"滻Ϊreturn tiletype >= GROUND.IMPASSABLE or inst.data.tile == "webbing"

    ںòݲڳ½أǰѾ޸ˡǿɶɺ͡ںϸǽ޸ļɣϲĵƤ棬һԼĵ




һ.ʯֺ󣨽커Ǻӣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\inv_rocks.luaļinst:AddComponent("inspectable")һвݣ

local function ondeploy(inst, pt, deployer)
    local ground = GetWorld()
    if ground then
       local original_tile_type = ground.Map:GetTileAtPoint(pt.x, pt.y, pt.z)
       local x, y = ground.Map:GetTileCoordsAtPoint(pt.x, pt.y, pt.z)
       if x and y then
          ground.Map:SetTile(x,y, GROUND.IMPASSABLE)
          ground.Map:RebuildLayer( original_tile_type, x, y )
          ground.Map:RebuildLayer( GROUND.IMPASSABLE, x, y )
       end
       local minimap = TheSim:FindFirstEntityWithTag("minimap")
       if minimap then
          minimap.MiniMap:RebuildLayer( original_tile_type, x, y )
          minimap.MiniMap:RebuildLayer( GROUND.IMPASSABLE, x, y )
       end
    end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = ondeploy
    inst.components.deployable.min_spacing = 0
    inst.components.deployable.placer = "gridplacer"

    ʯֺ󣬽커ǺӡԼĵ⣬Ҳʯ޸Ŷʯֹ󣬻ᱣߵͼ浵˳ٽϷˡҪ·




һ.ذһ10

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļݣ

Recipe("turf_road", {Ingredient("turf_rocky", 1), Ingredient("boards", 1)}, RECIPETABS.TOWN,  TECH.SCIENCE_TWO)
Recipe("turf_woodfloor", {Ingredient("boards", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO)
Recipe("turf_checkerfloor", {Ingredient("marble", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO)
Recipe("turf_carpetfloor", {Ingredient("boards", 1), Ingredient("beefalowool", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO)

    滻Ϊ

Recipe("turf_road", {Ingredient("turf_rocky", 1), Ingredient("boards", 1)}, RECIPETABS.TOWN,  TECH.SCIENCE_TWO,nil,nil,nil,10)
Recipe("turf_woodfloor", {Ingredient("boards", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO,nil,nil,nil,10)
Recipe("turf_checkerfloor", {Ingredient("marble", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO,nil,nil,nil,10)
Recipe("turf_carpetfloor", {Ingredient("boards", 1), Ingredient("beefalowool", 1)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO,nil,nil,nil,10)

    õذһ10ÿ10Ϊ֣Ըıһ




һ.15ֿƤ110飩

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("pottedfern", {Ingredient("foliage", 5), Ingredient("slurtle_shellpieces",1 )}, RECIPETABS.TOWN, TECH.SCIENCE_TWO, "pottedfern_placer", 0.9)һвݣ

Recipe("turf_rocky", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_forest", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_marsh", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_grass", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_savanna", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_dirt", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_cave", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_fungus", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_fungus_red", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_fungus_green", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_sinkhole", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_underrock", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_mud", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_deciduous", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)
Recipe("turf_desertdirt", {Ingredient("cutgrass", 1)}, RECIPETABS.TOWN, TECH.NONE,nil,nil,nil,10)

    ڽѡľӣ£15ֿƤ110




һ.۾ڵϺɰ

    ü±ϷĿ¼\data\scripts\prefabs\eyeturret.luaļ

    1.inst:AddComponent("inventoryitem")һвݣ

    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM


    2.ݣ

    inst.components.health:SetMaxHealth(TUNING.EYETURRET_HEALTH) 
    inst.components.health:StartRegen(TUNING.EYETURRET_REGEN, 1)
    
    inst:AddComponent("combat")
    inst.components.combat:SetRange(TUNING.EYETURRET_RANGE)
    inst.components.combat:SetDefaultDamage(TUNING.EYETURRET_DAMAGE)

    滻Ϊ

    inst.components.health:SetMaxHealth(TUNING.EYETURRET_HEALTH*10) 
    inst.components.health:StartRegen(TUNING.EYETURRET_REGEN*10, 1)
    inst:AddComponent("combat")
    inst.components.combat:SetRange(TUNING.EYETURRET_RANGE)
    inst.components.combat:SetDefaultDamage(TUNING.EYETURRET_DAMAGE*10)
local function turnon(inst)
    inst.components.machine.ison = true
    inst:Remove()
    SpawnPrefab("eyeturret_item").Transform:SetPosition(inst.Transform:GetWorldPosition())
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon

    ۾ڵϺܰˣ䰴Ҽɽٰɴߣ²ɡ⽫۾ֵѪЧʡ10ҿɶѵ




һһ.۾һ10Ϭţǡ¹

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("eyeturret_item", {Ingredient("deerclops_eyeball", 1), Ingredient("minotaurhorn", 1), Ingredient("thulecite", 5)}, RECIPETABS.ANCIENT, TECH.ANCIENT_FOUR, nil, nil, true)滻Ϊݣ

Recipe("eyeturret_item", {Ingredient("thulecite", 5)}, RECIPETABS.ANCIENT, TECH.ANCIENT_FOUR, nil, nil, nil,10)

    ԶѡԶż̳5ʯһ10۾ҪԶżͿ




һ.ԿɲԡɲɷۣԻᷢ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pottedfern.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddTag("flower")
    inst:AddComponent("sanityaura")
    inst.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
    inst:AddComponent("pickable")
    inst.components.pickable.picksound = "dontstarve/wilson/pickup_plants"
    inst.components.pickable:SetUp("honey", 30)
    local light = inst.entity:AddLight()
    light:SetFalloff(0.5)
    light:SetIntensity(.8)
    light:SetRadius(1.0)
    light:SetColour(146/255, 225/255, 146/255)
    light:Enable(true)

    ɿԿɲԡɲɷۣ30һΣз΢⣬ļҶһܰڽѡŴӣ£5Ҷӡ1ţƬ




һ.Զã1Զã

    ü±ϷĿ¼\data\scripts\prefabs\trap_teeth.luaļ inst.components.finiteuses:Use(1)һвݣ

    end
    if inst.components.mine then
       inst:DoTaskInTime(1, function() inst.components.mine:Reset() end )

    ڴ1Զá޸е1Ϊ֣üԶ




һ.

    ü±ϷĿ¼\data\scripts\prefabs\trap_teeth.luaļinst.components.deployable.min_spacing = .75滻Ϊinst.components.deployable.min_spacing = 0

    ڲʱûС




һ.Զסʹ

    ü±ϷĿ¼\data\scripts\prefabs\boomerang.luaļ

    1.owner.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_return")һвowner.components.inventory:Equip(inst)


    2.ݣ

    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.BOOMERANG_USES)
    inst.components.finiteuses:SetUses(TUNING.BOOMERANG_USES)

    inst.components.finiteuses:SetOnFinished(OnFinished)

    滻Ϊ

    --inst:AddComponent("finiteuses")
    --inst.components.finiteuses:SetMaxUses(TUNING.BOOMERANG_USES)
    --inst.components.finiteuses:SetUses(TUNING.BOOMERANG_USES)

    --inst.components.finiteuses:SetOnFinished(OnFinished)

    ûԶסʹ




һ.װٻϷ

    ü±ϷĿ¼\data\scripts\prefabs\boomerang.luaļinst:AddComponent("inspectable")һвݣ

local function cancreatelight(staff, caster, target, pos)
    local ground = GetWorld()
    if ground and pos then
       local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
       return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
    end
    return false
end
local function createlight(staff, target, pos)
    local names = {"crow","robin","robin_winter","frog","mosquito","bee","killerbee","butterfly","rabbit","babybeefalo"}
    local name = names[math.random(#names)]
    local prey = SpawnPrefab(name)
    prey.Transform:SetPosition(pos.x, pos.y, pos.z)
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false

    װںڿյϵҼٻ桢ܡӡСţ鲶԰




һ.һ֧20Σٷֱʹã

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\blowdart.luaļ

    1.ݣ

local function onhit(inst, attacker, target)
    local impactfx = SpawnPrefab("impact")
    if impactfx and attacker then
	    local follower = impactfx.entity:AddFollower()
	    follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 )
        impactfx:FacePoint(attacker.Transform:GetWorldPosition())
    end
    inst:Remove()
end

    滻Ϊ

local function onfinished(inst)
    inst:Remove()
end
local function onhit(inst, attacker, target)
    local impactfx = SpawnPrefab("impact")
    if impactfx and attacker then
       local follower = impactfx.entity:AddFollower()
       follower:FollowSymbol(target.GUID, target.components.combat.hiteffectsymbol, 0, 0, 0 )
       impactfx:FacePoint(attacker.Transform:GetWorldPosition())
    end
    if inst.components.finiteuses.current > 0 then
       if inst.prefab == "blowdart_walrus" then
          inst:Remove()
       else
          attacker.components.inventory:Equip(inst)
       end
    end
end


    2.inst:AddComponent("inspectable")һвݣ

    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetOnFinished( onfinished )
    inst.components.finiteuses:SetMaxUses(20)
    inst.components.finiteuses:SetUses(20)

    һ֧ʹ20Σÿλе˺ԶصУ޸220ΪҪʹôҪ롰ʹãĿԶصУһͬ޸




һ.ʹãĿԶصУ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\blowdart.luaļݣ

        impactfx:FacePoint(attacker.Transform:GetWorldPosition())
    end
    inst:Remove()

    滻Ϊ

        impactfx:FacePoint(attacker.Transform:GetWorldPosition())
    end
    if inst.prefab == "blowdart_walrus" then
       inst:Remove()
    else
       attacker.components.inventory:Equip(inst)
    end

    ôĿԶصУҪ롰һ֧20Σٷֱʹãһͬ޸




һ.ҵۣڵͼʾ

    ü±ϷĿ¼\data\scripts\prefabs\chester_eyebone.luaļinst:AddComponent("inspectable")һвݣ

    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "chester.png" )

    ڵͼϿ۵λãʾΪ˹أ˹غͼ˹ͼ꣬һ˹أһǹ




һģ.˹أ䣩ܵÿ

    ü±ϷĿ¼\data\scripts\prefabs\chester.luaļݣ

    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 7

    滻Ϊ

    inst.components.locomotor.walkspeed = 9
    inst.components.locomotor.runspeed = 21

    ˹˶ٶ3




һһ.˹أ䣩

    ü±ϷĿ¼\data\scripts\prefabs\chester.luaļinst:AddTag("noauradamage")һвinst.components.health:SetInvincible(true)

    ˹ز




һĶ.˹أ䣩981

    ü±ϷĿ¼\data\scripts\prefabs\chester.luaļ

    1.ݣ

for y = 2, 0, -1 do
    for x = 0, 2 do

    滻Ϊ

for y = 8, 0, -1 do
    for x = 0, 8 do


    2.ݣ

    inst.components.container.widgetanimbank = "ui_chest_3x3"
    inst.components.container.widgetanimbuild = "ui_chest_3x3"
    inst.components.container.widgetpos = Vector3(0,200,0)

    滻Ϊ

    --inst.components.container.widgetanimbank = "ui_chest_3x3"
    --inst.components.container.widgetanimbuild = "ui_chest_3x3"
    inst.components.container.widgetpos = Vector3(0,100,0)

    ˹أ䣩981




һ.ʯʱӳ1

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\heatrock.luaļݣ

	inst.components.temperature.inherentinsulation = TUNING.INSULATION_MED
	inst.components.temperature.inherentsummerinsulation = TUNING.INSULATION_MED

    滻Ϊ

	inst.components.temperature.inherentinsulation = TUNING.INSULATION_MED*2
	inst.components.temperature.inherentsummerinsulation = TUNING.INSULATION_MED*2

    ñʯʱӳ12ֵΪ֣еʱӳ




һ.񲻷ѪҪѪ޼30

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļEFFIGY_HEALTH_PENALTY = 30,滻ΪEFFIGY_HEALTH_PENALTY = 0,

    ɽ񲻷Ѫ޸Ϊ-30ɼѪ




һ.Ҳ˯˯񲻼

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tent.luaļ

    1.ɾݣ

	if GetClock():IsDay() then
		local tosay = "ANNOUNCE_NODAYSLEEP"
		if GetWorld():IsCave() then
			tosay = "ANNOUNCE_NODAYSLEEP_CAVE"
		end
		if sleeper.components.talker then
			sleeper.components.talker:Say(GetString(inst.prefab, tosay))
			return
		end
	end


    2.ɾݣ

		if GetClock():IsDay() then

			local tosay = "ANNOUNCE_NODAYSLEEP"
			if GetWorld():IsCave() then
				tosay = "ANNOUNCE_NODAYSLEEP_CAVE"
			end

			if sleeper.components.talker then				
				sleeper.components.talker:Say(GetString(inst.prefab, tosay))
				sleeper.components.health:SetInvincible(false)
				sleeper.components.playercontroller:Enable(true)
				return
			end
		end


    3.sleeper.components.hunger:DoDelta(-TUNING.CALORIES_HUGE, false, true)滻Ϊ--sleeper.components.hunger:DoDelta(-TUNING.CALORIES_HUGE, false, true)

    ɰҲ˯˯񲻼




һ.˯ϯɲѪ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bedroll_straw.luaļsleeper.sg:GoToState("wakeup")һвݣ

		if sleeper.components.health then
			sleeper.components.health:DoDelta(TUNING.HEALING_MED, false, "tent", true)
		end

    ˯ϯɲѪѪСëƤ̸Ǻ




һ.װñӸʡ񴩿׻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.components.equippable.equipslot = EQUIPSLOTS.BODY滻Ϊinst.components.equippable.equipslot = EQUIPSLOTS.HEAD

    ûװñӸͬʱ׻




һİ.ɫȡƷ١ΧӴ󡢲Ʒ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļ

    1.ȡƷ10inst.task = inst:DoPeriodicTask(TUNING.ORANGEAMULET_ICD, function() pickup(inst, owner) end)滻Ϊݣ

    inst.task = inst:DoPeriodicTask(TUNING.ORANGEAMULET_ICD*.1, function() pickup(inst, owner) end)


    2.ȡƷΧӴ5local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, TUNING.ORANGEAMULET_RANGE)滻Ϊݣ

    local ents = TheSim:FindEntities(pt.x, pt.y, pt.z, TUNING.ORANGEAMULET_RANGE*5)


    3.Ʒv.components.inventoryitem:IsHeld() then滻Ϊݣ

            v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart") and not v:HasTag("projectile") then

    óɫȡƷ١ΧӴ󣬲塢ƣҲʱʹԶ




һľ.ɫħȴͲ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļcaster.components.sanity:DoDelta(-TUNING.SANITY_HUGE)滻Ϊcaster.components.sanity:DoDelta(TUNING.SANITY_HUGE)

    ɫħȴͲ




һ声.ڵҲʹɫħȴ͵ͺ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļݣ

    if ground.topology.level_type == "cave" then
        TheCamera:Shake("FULL", 0.3, 0.02, .5, 40)
        ground.components.quaker:MiniQuake(3, 5, 1.5, teleportee)     
        return
    end

    滻Ϊ

    --if ground.topology.level_type == "cave" then
        --TheCamera:Shake("FULL", 0.3, 0.02, .5, 40)
        --ground.components.quaker:MiniQuake(3, 5, 1.5, teleportee)     
        --return
    --end

    ڵҲʹɫħȴ͵ͺģֻᴫ͵½Ĵͺģᴫ͵




һһ.ͺɿأϱʯ

    ü±ϷĿ¼\data\scripts\prefabs\telebase_gemsocket.luaļinst:AddComponent("inspectable")һвݣ

local function turnon(inst)
    inst.components.machine.ison = true
    OnGemGiven(inst)
end
local function turnoff(inst)
    inst.components.machine.ison = false
    OnGemGiven(inst)
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff

    ɶԿձʯ۰ҼԶϱʯʹÿδϱʯˡΪʯϵıʯߣҲˢϱʯ




һ.ӳɫħȶסʱ

    ü±ϷĿ¼\data\DLC0001\scripts\components\freezable.luaļself.wearofftime = 10滻Ϊself.wearofftime = 50000000

    ӳɫħȶסʱ浵˳Ϸֶⶳκ˼




һ.ɫħ棨һסһƬ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļݣ

local function onattack_blue(inst, attacker, target)

    if attacker and attacker.components.sanity then
        attacker.components.sanity:DoDelta(-TUNING.SANITY_SUPERTINY)
    end
    
    if target.components.freezable then
        target.components.freezable:AddColdness(1)
        target.components.freezable:SpawnShatterFX()
    end

    滻Ϊ

local function onattack_blue(inst, attacker, target)
    local pos = Vector3(target.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15)
    for k,v in pairs(ents) do
        if v.components.freezable and not v:HasTag("player") then
           v.components.freezable:AddColdness(10)
           v.components.freezable:SpawnShatterFX()
        end
    end

    ɫħȶסһƬˣ15Ϊ֣ͿԼӴס˵ķΧ




һ.ȫԭֻޱרã

    1.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("torch", {Ingredient("cutgrass", 2),Ingredient("twigs", 2)}, RECIPETABS.LIGHT, TECH.NONE)һвRecipe("lighter", {Ingredient("goldnugget", 1),Ingredient("nitre", 1)}, RECIPETABS.LIGHT, TECH.NONE)


    2.ü±ϷĿ¼\data\scripts\prefabs\lighter.luaļݣ

    inst:AddComponent("characterspecific")
    inst.components.characterspecific:SetOwner("willow")

    滻Ϊ

    --inst:AddComponent("characterspecific")
    --inst.components.characterspecific:SetOwner("willow")


    3.inst:DoTaskInTime(0, function() if not GetPlayer() or GetPlayer().prefab ~= "willow" then inst:Remove() end end)滻Ϊ--inst:DoTaskInTime(0, function() if not GetPlayer() or GetPlayer().prefab ~= "willow" then inst:Remove() end end)

    ѡŻ£1ƽ1ʯ




һ.ȫϵĸӣ8¿1ͨ15£

    1.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("razor", {Ingredient("twigs", 2), Ingredient("flint", 2)}, RECIPETABS.TOOLS,  TECH.SCIENCE_ONE)һвRecipe("Lucy", {Ingredient("twigs", 4), Ingredient("goldnugget", 4)}, RECIPETABS.TOOLS,  TECH.SCIENCE_ONE)


    2.ü±ϷĿ¼\data\scripts\prefabs\lucy.luaļݣ

    inst:AddComponent("sentientaxe")
    
    inst:AddComponent("characterspecific")
    inst.components.characterspecific:SetOwner("woodie")

    滻Ϊ

    --inst:AddComponent("sentientaxe")
    
    --inst:AddComponent("characterspecific")
    --inst.components.characterspecific:SetOwner("woodie")

    ڹѡŸӺ͸䣩£4辡4ƽϵĸ




һ.ȫħ

    1.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("batbat", {Ingredient("batwing", 5), Ingredient("livinglog", 2), Ingredient("purplegem", 1)}, RECIPETABS.MAGIC, TECH.MAGIC_THREE)һвݣ

Recipe("book_birds", {Ingredient("papyrus", 2), Ingredient("bird_egg", 2)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO)
Recipe("book_gardening", {Ingredient("papyrus", 2), Ingredient("seeds", 1), Ingredient("poop", 1)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO)
Recipe("book_sleep", {Ingredient("papyrus", 2), Ingredient("nightmarefuel", 2)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO)
Recipe("book_brimstone", {Ingredient("papyrus", 2), Ingredient("redgem", 1)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO)
Recipe("book_tentacles", {Ingredient("papyrus", 2), Ingredient("tentaclespots", 1)}, RECIPETABS.MAGIC, TECH.MAGIC_TWO)


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("temperature")һвinst:AddComponent("reader")


    3.ü±ϷĿ¼\data\scripts\prefabs\books.luaļݣ

        inst:AddComponent("characterspecific")
        inst.components.characterspecific:SetOwner("wickerbottom")

    滻Ϊ

        --inst:AddComponent("characterspecific")
        --inst.components.characterspecific:SetOwner("wickerbottom")

    ħѡźãħ




һ.ȫ󡢲ǡԡɫ⡢ɢע

    1.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("heatrock", {Ingredient("rocks", 10),Ingredient("pickaxe", 1),Ingredient("flint", 3)}, RECIPETABS.SURVIVAL, TECH.SCIENCE_TWO)һвݣ

Recipe("balloons_empty", {Ingredient("cutgrass", 1)}, RECIPETABS.SURVIVAL, TECH.NONE)


    2.ü±ϷĿ¼\data\DLC0001\scripts\actions.luaļact.doer.components.sanity:DoDelta(-TUNING.SANITY_TINY)滻Ϊact.doer.components.sanity:DoDelta(TUNING.SANITY_TINY)


    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\balloons_empty.luaļݣ

    inst:AddComponent("characterspecific")
    inst.components.characterspecific:SetOwner("wes")

    滻Ϊ

    --inst:AddComponent("characterspecific")
    --inst.components.characterspecific:SetOwner("wes")


    4.inst:DoTaskInTime(0, function() if not GetPlayer() or GetPlayer().prefab ~= "wes" then inst:Remove() end end)滻Ϊݣ

    --inst:DoTaskInTime(0, function() if not GetPlayer() or GetPlayer().prefab ~= "wes" then inst:Remove() end end)


    5.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\balloon.luaļinst.components.combat:DoAreaAttack(inst, 2)滻Ϊinst.components.combat:DoAreaAttack(inst, 8)


    6.inst.components.combat:SetDefaultDamage(5)滻Ϊݣ

    inst.components.combat.playerdamagepercent = 0
    inst.components.combat:SetDefaultDamage(500)
    local light = inst.entity:AddLight() 
    light:SetIntensity(.8)
    light:SetRadius(2)
    light:SetFalloff(.6)
    light:Enable(true)
    light:SetColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3])
    inst:AddTag("character")

    ȫǴ򣬿ѡף£1졣ٷԭֻwesУҹܺãҸһ




һ.ȫ˿˹ì˿˹ñ

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("trap_teeth", {Ingredient("log", 1),Ingredient("rope", 1),Ingredient("houndstooth", 1)}, RECIPETABS.WAR,  TECH.SCIENCE_TWO)һвݣ

Recipe("spear_wathgrithr", {Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient("goldnugget", 2)}, RECIPETABS.WAR, TECH.SCIENCE_ONE, nil, nil, nil, nil, true)
Recipe("wathgrithrhat", {Ingredient("goldnugget", 2), Ingredient("rocks", 2)}, RECIPETABS.WAR, TECH.SCIENCE_ONE, nil, nil, nil, nil, true)

    սѡѽ£2֦2ʯ2ƽ˿˹ì2ƽ2ʯͷ˿˹ñ




һ.ʿȣʯǽڲݡȡůꡢԡ˲ơ102ٶȡ

    ü±ϷĿ¼\data\scripts\prefabs\cane.luaļ

    1.local function onequip(inst, owner)һвݣ

    inst.Light:Enable(true)
    GetPlayer().components.temperature:SetTemp(20)
    GetPlayer():PushEvent("stopfreezing")
    GetPlayer():PushEvent("stopoverheating")
    GetPlayer().components.moisture:SetMoistureLevel(0)


    2.local function onunequip(inst, owner)һвݣ

    inst.Light:Enable(false)
    GetPlayer().components.temperature:SetTemp(nil)


    3.anim:PlayAnimation("idle")һвݣ

    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.CHOP, 15)
    inst.components.tool:SetAction(ACTIONS.MINE, 15)
    inst.components.tool:SetAction(ACTIONS.HAMMER,15)
    inst.components.tool:SetAction(ACTIONS.DIG)
    inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE)
    inst:AddComponent("blinkstaff")
    local light = inst.entity:AddLight()
    light:SetFalloff(0.4)
    light:SetIntensity(.7)
    light:SetRadius(2.5)
    light:SetColour(180/255, 195/255, 150/255)
    light:Enable(true)


    4.inst.components.weapon:SetDamage(TUNING.CANE_DAMAGE)滻Ϊinst.components.weapon:SetDamage(TUNING.CANE_DAMAGE*10)


    5.inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT滻Ϊݣ

    inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE

    ӵʿĶ๦ܡװʱڿյϵҼ˲ƣ˿խ֣ԩ·




һ.֮ììʱٻ׻ˣ

    ü±ϷĿ¼\data\scripts\prefabs\spear.luaļ

    1.local function onequip(inst, owner)һвݣ

    if owner.components.playerlightningtarget then
       owner:AddTag("nolightning")
       owner:RemoveComponent("playerlightningtarget")
    end


    2.local function onunequip(inst, owner)һвݣ

    if owner:HasTag("nolightning") then
       owner:RemoveTag("nolightning")
       owner:AddComponent("playerlightningtarget")
    end


    3.inst:AddComponent("weapon")滻Ϊݣ

local function onattack(inst, attacker, target)
    inst:StartThread(function()
        for k = 1, 5 do
            local pos = target:GetPosition()
            GetSeasonManager():DoLightningStrike(pos)
            target.components.health:DoDelta(-100)
            Sleep(0.3)
        end
    end)
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetRange(20, 25)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetProjectile("bishop_charge")

    ìڹʱٻ5磬׻ˣŸĵˡΪ֮ì̫ͣԶԼĻʹãҲǧҪڴͬʱʹ




һһ.꣨ͽ˱ɻƽ

    ü±ϷĿ¼\data\scripts\prefabs\fishingrod.luaļݣ

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.FISHINGROD_DAMAGE)
    inst.components.weapon.attackwear = 4

    滻Ϊ

local function onattack(inst, attacker, target)
    SpawnPrefab("ruins_statue_mage").Transform:SetPosition(target.Transform:GetWorldPosition())
    SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition())
    target:Remove()
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(12, 15)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetProjectile("bishop_charge")

    Զ빥ʱѵ˱ɻƽôɵñʯʯѡף£2辡2˿




һ.ʱӷ۽ͯ꣩

    ü±ϷĿ¼\data\scripts\prefabs\honey.luaļinst:AddComponent("inspectable")һвݣ

local function onhit(inst, attacker, target)
    inst:Remove()
    SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition())
    target.Transform:SetScale(0.7, 0.7, 0.7)
    if target.components.health then
       target.components.health.currenthealth = 1
       target.components.health.maxhealth = 1
    end
    if target.components.combat then
       target.components.combat:SetDefaultDamage(0)
       target.components.combat.target = nil
    end
    if target.components.locomotor then
       target.components.locomotor.runspeed = 1
       target.components.locomotor.walkspeed = 1
    end
end
local function onthrown(inst, data)
    inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(20, 25)
    inst:AddComponent("equippable")
    inst.components.equippable.equipstack = true
    inst:AddComponent("projectile")
    inst.components.projectile:SetSpeed(60)
    inst.components.projectile:SetOnHitFn(onhit)
    inst:ListenForEvent("onthrown", onthrown)

    ӷ۽޺ͯͱСֵΪ1ûй߻ΪۿװҲԷۣ۶ǰҼ




һ.ȮףȮըһƬ

    ü±ϷĿ¼\data\scripts\prefabs\houndstooth.luaļinst:AddComponent("inspectable")һвݣ

local function onhit(inst, attacker, target)
    SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition())
    SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition())
    local pos = Vector3(target.Transform:GetWorldPosition())
    GetClock():DoLightningLighting()
    GetPlayer().components.playercontroller:ShakeCamera(target, "FULL", 0.7, 0.02, .5, 40)
    inst.components.combat:DoAreaAttack(target, 8)
    inst:Remove()
end
local function onthrown(inst, data)
    inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(3000)
    inst.components.weapon:SetRange(15, 18)
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(3000)
    inst.components.combat.playerdamagepercent = 0
    inst:AddComponent("equippable")
    inst.components.equippable.equipstack = true
    inst:AddComponent("projectile")
    inst.components.projectile:SetSpeed(60)
    inst.components.projectile:SetOnHitFn(onhit)
    inst:ListenForEvent("onthrown", onthrown)

    װȮʱһȺӳԶԵ˰ըһƬȮײ˵




һ.߱ףָڵף

    ü±ϷĿ¼\data\scripts\prefabs\compass.luaļinst:AddComponent("inventoryitem")һв

    inst.components.inventoryitem:SetOnDroppedFn(function()
        inst:RemoveTag("startkill")
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst.components.inventoryitem:SetOnPickupFn(function()
        inst:RemoveTag("startkill")
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst.components.inventoryitem:SetOnPutInInventoryFn(function()
        inst:RemoveTag("startkill")
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
local function OnDeploy (inst, pt)
    inst:AddTag("startkill")
    inst.Physics:Teleport(pt:Get())
    inst.task = inst:DoPeriodicTask(0.1, function(inst)
        local target = FindEntity(inst, 2, function(guy) 
            return guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") and not guy:HasTag("smallbird") and not guy:HasTag("chester")
        end )
        if target then
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
           SpawnPrefab("explode_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
           local pos = Vector3(inst.Transform:GetWorldPosition())
           GetClock():DoLightningLighting()
           GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40)
           target.components.health:DoDelta(-3000)
           inst:Remove()
        end
    end )
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst.components.deployable.min_spacing = 2
    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = 999
local function onsave(inst, data)
    if inst:HasTag("startkill") then
        data.startkill = true
    end
end
local function onload(inst, data)
  if data and data.startkill then
    inst:AddTag("startkill")
    inst.task = inst:DoPeriodicTask(0.1, function(inst)
        local target = FindEntity(inst, 2, function(guy) 
            return guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") and not guy:HasTag("smallbird") and not guy:HasTag("chester")
        end )
        if target then
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
           SpawnPrefab("explode_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
           local pos = Vector3(inst.Transform:GetWorldPosition())
           GetClock():DoLightningLighting()
           GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40)
           target.components.health:DoDelta(-3000)
           inst:Remove()
        end
    end )
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ָҼڿյϣ˲Ϻᱬըǡ񡢹䲻ᴥָѡף£1ƽ1ֽ




һ.֮⣨ʱҼյأͨɱ

    ü±ϷĿ¼\data\scripts\prefabs\mininglantern.luaļinst:AddComponent("inspectable")һвݣ

local function cancreatelight(staff, caster, target, pos)
    local fuelpercent = inst.components.fueled:GetPercent()
    if fuelpercent > 0.5 then
       return true
    else
       return false
    end
end
local function createlight(staff, target, pos)
    local SHAKE_DIST = 40
    local player = GetClosestInstWithTag("player", inst, SHAKE_DIST)
    if player then
       player.components.playercontroller:ShakeCamera(inst, "VERTICAL", 1, 0.03, 2, SHAKE_DIST)
    end
    inst:DoTaskInTime(0, function() 
        inst.components.combat:DoAreaAttack(inst, 30)
    end)
    GetClock():DoLightningLighting()
    inst.components.fueled.currentfuel = 50
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(3000)
    inst.components.combat.playerdamagepercent = 0

    ʱҼյأͨɱעȼϳ50%ʱͷ֮⣬ͷźȼϽӽľͷҪӫӫװеưҼԼ3ż




һ.ħ֮˫ۣץ˲Ҽץƶǣ

    ü±ϷĿ¼\data\scripts\prefabs\tentaclespike.luaļݣ

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.SPIKE_DAMAGE)
    
    -------
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.SPIKE_USES)
    inst.components.finiteuses:SetUses(TUNING.SPIKE_USES)
    
    inst.components.finiteuses:SetOnFinished( onfinished )

    滻Ϊ

local function onattack(inst, owner, target)
    local pt = owner:GetPosition()
    if target.components.health then
       target.Transform:SetPosition(pt.x+1, pt.y, pt.z)
    end
    inst:DoTaskInTime(0.1, function() 
        target.components.health:DoDelta(-3000)
    end)
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(20, 25)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetProjectile("bishop_charge")
    inst:AddComponent("blinkstaff")

    װʱԵ˵ץԿյصҼץƶǣʹȿɱ˵ˣֿЧܡץá𼦡ȻܵĶҲʵŶĴֻ




һ.Ķдĵ˲֪Ѫ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\blowdart.luaļinst.components.weapon:SetDamage(TUNING.PIPE_DART_DAMAGE)һвݣ

local function pipeonhit(inst, attacker, target)
    target.components.health:StartRegen(-100, 1)
    target.components.combat.target = nil
    target.AnimState:SetMultColour(255/255,0/255,0/255,1)
    attacker.components.inventory:Equip(inst)
end
    inst.components.weapon:SetRange(20, 25)
    inst.components.projectile:SetOnHitFn(pipeonhit)

    дĵ˱ɺɫÿ100Ѫֱеĵ˲ᷴǡΪʹãԶص




һ.ǹóɫħԶ̵εˣʹ׸

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļinst.components.blinkstaff.onblinkfn = onblink滻Ϊݣ

local function onattack_orange(inst, owner, target)
    if target.brain then
       target.brain:Stop()
    end
    if target.components.combat then
       target.components.combat:SetTarget(nil)
    end
    if target.components.locomotor then
       target.components.locomotor:Stop()
    end
    target.AnimState:SetMultColour(125/255,125/255,125/255,1)
    SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(10)
    inst.components.weapon:SetRange(20, 25)
    inst.components.weapon:SetOnAttack(onattack_orange)
    inst.components.weapon:SetProjectile("bishop_charge")

    װɫħʱԵ˰Σʧȥж㴦áԺӡܵȱȽĵ˺áɫħԶѡԶż̳£2جȼϡ1ȡ2ɫʯ죬ʱҪԶż̳




һ.䲽ǹɫħ䡢Ҽӵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļݣ

local function yellow()
    local inst = commonfn("yellow")
    inst.fxcolour = {223/255, 208/255, 69/255}
    inst.castsound = "dontstarve/common/staffteleport"

    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false

    inst:AddComponent("reticule")
    inst.components.reticule.targetfn = function() 
        return Vector3(GetPlayer().entity:LocalToWorldSpace(5,0,0))
    end
    inst.components.reticule.ease = true

    inst.components.finiteuses:SetMaxUses(TUNING.YELLOWSTAFF_USES)
    inst.components.finiteuses:SetUses(TUNING.YELLOWSTAFF_USES)
    inst:AddTag("nopunch")

    return inst
end

    滻Ϊ

local function yellow()
    local inst = commonfn("yellow")
    inst.fxcolour = {223/255, 208/255, 69/255}
    inst.castsound = "dontstarve/common/staffteleport"
local function canattack(inst, target)
    if GetPlayer().components.inventory:Has("stinger", 1) and TheInput:IsMouseDown(MOUSEBUTTON_RIGHT) then
       inst.components.weapon:LaunchProjectile(inst, target)
    end
    if GetPlayer().components.inventory:Has("stinger", 1) then
       return true
    end
end
local function onattack_yellow(inst, owner, target)
    owner.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
    SpawnPrefab("die_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
    TheCamera:Shake("FULL", 0.2, 0.02, .5, 40)
    owner.components.inventory:ConsumeByName("stinger", 1)
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(100)
    inst.components.weapon:SetRange(25, 30)
    inst.components.weapon:SetOnAttack(onattack_yellow)
    inst.components.weapon:SetCanAttack(canattack)
    inst.components.weapon:SetProjectile("fire_projectile")
    inst.components.finiteuses:SetMaxUses(TUNING.YELLOWSTAFF_USES*1000)
    inst.components.finiteuses:SetUses(TUNING.YELLOWSTAFF_USES*1000)
    return inst
end

    װɫħʱԵ˰䣬Ҽ䣬ûзʱ޷ҪŰסҼɨ䣬ʱʱעһ»жӵɫħԶѡԶż̳£4جȼϡ2ľͷ2ɫʯ죬ʱҪԶż̳ɫħԭСǹȡ




һߣ.ħˣɵ˷ʷɱ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļlocal inst = commonfn("green")һвݣ

local function onattack_green(inst, owner, target)
    if target.prefab == "bee" or target.prefab == "killerbee" or target.prefab == "flies" or target.prefab == "mosquito" or target.prefab == "frog" or target.prefab == "beefalo" or target.prefab == "lightninggoat" or target.prefab == "pigman" or target.prefab == "pigguard" or target.prefab == "bunnyman" or target.prefab == "merm" or target.prefab == "spider_hider" or target.prefab == "spider_spitter" or target.prefab == "spider" or target.prefab == "spider_warrior" or target.prefab == "spiderqueen" or target.prefab == "spider_dropper" or target.prefab == "hound" or target.prefab == "firehound" or target.prefab == "icehound" or target.prefab == "leif" or target.prefab == "leif_sparse" or target.prefab == "walrus" or target.prefab == "little_walrus" or target.prefab == "smallbird" or target.prefab == "teenbird" or target.prefab == "tallbird" or target.prefab == "koalefant_summer" or target.prefab == "koalefant_winter" or target.prefab == "penguin" or target.prefab == "slurtle" or target.prefab == "snurtle" or target.prefab == "bat" or target.prefab == "rocky" or target.prefab == "monkey" or target.prefab == "buzzard" or target.prefab == "catcoon" or target.prefab == "knight" or target.prefab == "bishop" or target.prefab == "rook" or target.prefab == "crawlinghorror" or target.prefab == "terrorbeak" or target.prefab == "deerclops" or target.prefab == "minotaur" or target.prefab == "worm" or target.prefab == "abigail" or target.prefab == "ghost" or target.prefab == "krampus" or target.prefab == "moose" or target.prefab == "dragonfly" or target.prefab == "warg" or target.prefab == "bearger" then
       local copy = SpawnPrefab(target.prefab)
       copy.Transform:SetPosition(target.Transform:GetWorldPosition())
       copy.AnimState:SetMultColour(0/255,0/255,0/255,0.5)
       if copy:HasTag("monster") then copy:RemoveTag("monster") end
       copy.task = copy:DoPeriodicTask(1, function() copy.components.combat.target = target end)
       target:ListenForEvent("death", function()
           if not copy.components.health:IsDead() then
              copy:Remove()
           end
       end )
       copy:DoTaskInTime(60, function() 
           if not copy.components.health:IsDead() then
              copy:Remove()
           end
       end )
    else
       local copy = SpawnPrefab("leif")
       copy.Transform:SetPosition(target.Transform:GetWorldPosition())
       copy.AnimState:SetMultColour(0/255,0/255,0/255,0.5)
       copy.Transform:SetScale(0.5, 0.5, 0.5)
       copy:RemoveTag("monster")
       copy.components.combat:SetAttackPeriod(1)
       copy.task = copy:DoPeriodicTask(1, function() copy.components.combat.target = target end)
       target:ListenForEvent("death", function()
           if not copy.components.health:IsDead() then
              copy:Remove()
           end
       end )
       copy:DoTaskInTime(60, function() 
           if not copy.components.health:IsDead() then
              copy:Remove()
           end
       end )
    end
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(30, 35)
    inst.components.weapon:SetOnAttack(onattack_green)
    inst.components.weapon:SetProjectile("bishop_charge")

    װħʱˣɵ˵ķʷɱжǿ䷴ʷжǿֻսɡʷ60룬ȥʱʷҲʧС޸ļɴɷ




һһ.װ¶Ե˰Ҽ뾵У

    ü±ϷĿ¼\data\scripts\prefabs\nightmare_timepiece.luaļinst:AddComponent("inspectable")һвݣ

local function onequip(inst, owner) 
    owner.components.inventory:SetOverflow(inst)
    inst.components.container:Open(owner)
end
local function onunequip(inst, owner) 
    owner.components.inventory:SetOverflow(nil)
    inst.components.container:Close(owner)
end
local function itemtest(inst, item, slot)
    if item:HasTag("catched") then
       return true
    end
    return false
end
local slotpos = {}
for y = 0, 9 do
    table.insert(slotpos, Vector3(-162, -y*75 + 170 ,0))
end
local function cancatchmonster(inst, caster, target)
    if target then
       return target.components.locomotor and target.components.health and not target.components.health:IsDead() and not target:HasTag("smallbird") and not target:HasTag("chester")
    end
    return true
end
local function catchmonster(staff, target, pos)
    if not inst.components.container:IsFull() then
       if target.components.stackable then target:RemoveComponent("stackable") end
       if target.components.inventoryitem then target:RemoveComponent("inventoryitem") end
       target:AddComponent("inventoryitem")
       target.components.inventoryitem.nobounce = true
       target.components.inventoryitem.canbepickedup = true
       target.components.inventoryitem:ChangeImageName("beard_monster")
       target.components.health.canmurder = true
       target:AddTag("catched")
       target.components.inventoryitem:SetOnDroppedFn(function(target)
          target:RemoveComponent("inventoryitem")
          target:RemoveTag("catched")
          if target.brain then target.brain:Start() end
          if target.sg then target.sg:Start() end
       end )
       target.components.inventoryitem:SetOnPutInInventoryFn(function(target)
          if target.sg then target.sg:GoToState("idle") end
          if target.SoundEmitter then target.SoundEmitter:KillAllSounds() end
       end )
       inst.components.container:GiveItem(target)
    end
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(catchmonster)
    inst.components.spellcaster:SetSpellTestFn(cancatchmonster)
    inst.components.spellcaster.canuseontargets = true
    inst.components.spellcaster.canusefrominventory = false

    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )

    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(18,50,0)
    inst.components.container.side_widget = true
    inst.components.container.itemtestfn = itemtest
    inst.components.container.acceptsstacks = false

    װʱԵ˰Ҽ뾵УұߵĸУʾΪսӣɱͶԸеĵ˰ҼսƷͷó˷ڵϡĸȫ޷µĵˣԽ˷Ʒڴ浵˳ǰ봦ãɱͷţȫĵˣ󣬵˽ȫųԶѡԶż̳£2ʯ2جȼ죬ʱҪԶż̳




һ߶.Ŀ꣬ԶصУ

    ü±ϷĿ¼\data\scripts\prefabs\trap.luaļinst:AddComponent("inspectable")һвݣ

local colours=
{
    {198/255,43/255,43/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {233/255,208/255,69/255},
    {109/255,50/255,163/255},
    {222/255,126/255,39/255},
}
local function OnDeploy (inst, pt)
    local ball = SpawnPrefab("trap")
    ball.Transform:SetPosition(pt.x, pt.y, pt.z)
    ball.AnimState:SetBank("bulb")
    ball.AnimState:SetBuild("bulb")
    ball.AnimState:PlayAnimation("idle")
    ball.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    ball:ClearStateGraph()
    RemovePhysicsColliders(ball)
    ball.components.inventoryitem:ChangeImageName("lightbulb")
    ball.colour_idx = math.random(#colours)
    ball.AnimState:SetMultColour(colours[ball.colour_idx][1],colours[ball.colour_idx][2],colours[ball.colour_idx][3],1)
    ball:RemoveComponent("finiteuses")
    ball:RemoveComponent("trap")
    ball:RemoveComponent("deployable")
    ball:RemoveTag("trap")
    ball:AddComponent("weapon")
    ball.components.weapon:SetDamage(30)
    ball.components.weapon:SetRange(20, 25)
    ball:AddComponent("equippable")
    ball.components.equippable.equipslot = EQUIPSLOTS.HANDS
    ball.components.equippable:SetOnEquip(function(ball)
        ball.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
    end )
    ball:AddComponent("projectile")
    ball.components.projectile:SetSpeed(25)
    ball.components.projectile:SetOnHitFn(function(ball, owner, target)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
        local target0 = FindEntity(owner, 25, function(guy) 
            if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
               return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster")
            end
        end )
        if target0 then
           ball.components.projectile:Throw(owner, target0)
        else
           owner.components.inventory:Equip(ball)
        end
    end )
    ball.components.projectile:SetOnMissFn(function(ball, owner)
        owner.components.inventory:Equip(ball)
    end )
    ball:ListenForEvent("onthrown", function(ball)
        local pt = ball:GetPosition()
        ball.Transform:SetPosition(pt.x, 2, pt.z)
        ball.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")
    end )
    ball:AddComponent("workable")
    ball.components.workable:SetWorkAction(ACTIONS.HAMMER)
    ball.components.workable:SetWorkLeft(3)
    ball.components.workable:SetOnFinishCallback(function(ball)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(ball.Transform:GetWorldPosition())
        ball:Remove()
    end )
    ball:AddTag("projectile")
    ball:AddTag("balls")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("balls") then
       data.balls = true
    end
    data.colour_idx = inst.colour_idx
end
local function onload(inst, data)
  if data and data.balls then
    inst.AnimState:SetBank("bulb")
    inst.AnimState:SetBuild("bulb")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    inst:ClearStateGraph()
    RemovePhysicsColliders(inst)
    inst.components.inventoryitem:ChangeImageName("lightbulb")
    inst:RemoveComponent("finiteuses")
    inst:RemoveComponent("trap")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("trap")
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(30)
    inst.components.weapon:SetRange(20, 25)
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
    inst.components.equippable:SetOnEquip(function(inst)
        inst.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
    end )
    inst:AddComponent("projectile")
    inst.components.projectile:SetSpeed(25)
    inst.components.projectile:SetOnHitFn(function(inst, owner, target)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
        local target0 = FindEntity(owner, 25, function(guy) 
            if guy.components.combat and guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
               return guy.components.combat.target == owner or owner.components.combat.target == guy or guy:HasTag("monster")
            end
        end )
        if target0 then
           inst.components.projectile:Throw(owner, target0)
        else
           owner.components.inventory:Equip(inst)
        end
    end )
    inst.components.projectile:SetOnMissFn(function(inst, owner)
        owner.components.inventory:Equip(inst)
    end )
    inst:ListenForEvent("onthrown", function(inst)
        local pt = inst:GetPosition()
        inst.Transform:SetPosition(pt.x, 2, pt.z)
        inst.SoundEmitter:PlaySound("dontstarve/wilson/boomerang_throw")
    end )
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst:Remove()
    end )
    inst:AddTag("projectile")
    inst:AddTag("balls")
  end
  if data and data.colour_idx then
     inst.colour_idx = math.min(#colours, data.colour_idx)
     inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɫװԵ˰ӳеˣ˺ԶصУڡҪʱôҵɡѡף£2֦6




һ.ǧﴸûȶ̹ʱ콵ʯı⣩

    ü±ϷĿ¼\data\scripts\prefabs\hambat.luaļinst:AddComponent("weapon")滻Ϊݣ

local function onattack(inst, owner, target)
    local pt = target:GetPosition()
    local boulder = SpawnPrefab("thulecite")
    RemovePhysicsColliders(boulder)
    boulder.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    boulder.Transform:SetScale(3,3,3)
    boulder:RemoveComponent("inventoryitem")
    boulder.Transform:SetPosition(pt.x, 10, pt.z)
    boulder.falling = boulder:DoPeriodicTask(.01, function() boulder.Physics:SetMotorVelOverride(0,-55,0) end)
    boulder:DoTaskInTime(0.1, function()
        if boulder.falling then boulder.falling:Cancel() boulder.falling = nil end
        GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
        GetPlayer().components.playercontroller:ShakeCamera(boulder, "FULL", 0.5, 0.05, 2, 40)
        SpawnPrefab("collapse_big").Transform:SetPosition(boulder.Transform:GetWorldPosition())
        target:AddTag("NOCLICK")
        MakeInventoryPhysics(target)
        target.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
        target.AnimState:SetLayer( LAYER_BACKGROUND )
        target.AnimState:SetSortOrder( 1 )
        target.AnimState:SetPercent("hit", math.random())
        if target.brain then target:SetBrain(nil) end
        if target.components.locomotor then target.components.locomotor:Stop() end
        if target.components.combat then target.components.combat:SetTarget(nil) end
        if target.components.health then target.components.health:SetInvincible(false) end
        target:DoTaskInTime(5, function() target.components.health:Kill() end )
        local pos = Vector3(boulder.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,0,pos.z, 5)
        for k,v in pairs(ents) do
            if v.components.workable and v.components.workable.workleft > 0 and not v.components.inventoryitem then
               v.components.workable:Destroy(boulder)
            end
        end
        boulder:DoTaskInTime(0.5, function()
            GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop")
            SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(boulder.Transform:GetWorldPosition())
            boulder:Remove()
        end )
    end )
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetRange(20, 25)
    inst.components.weapon:SetOnAttack(onattack)

    ûȶ̹ʱ콵ʯı⣬ٸĽʯͷֲ˽5ȶ̹սѡѽ£1Ƥ2֦2




һ.ǹ˿˹ìΪǹԶͻ̲أҼɵˣ˻Ѫ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\spear_wathgrithr.luaļ

    1.local function onequip(inst, owner)һвݣ

    inst.fire = SpawnPrefab( "campfirefire" )
    local follower = inst.fire.entity:AddFollower()
    follower:FollowSymbol( owner.GUID, "swap_object", 20, -88, 1 )
    inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
    inst.fire.Transform:SetScale(0.8, 0.8, 0.8)
    inst.fire:RemoveComponent("heater")
    inst.fire.persists = false


    2.local function onunequip(inst, owner)һвݣ

    inst.fire:Remove()
    inst.fire = nil


    3.ݣ

    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(TUNING.WATHGRITHR_SPEAR_DAMAGE)
    
    -------
    
    inst:AddComponent("finiteuses")
    inst.components.finiteuses:SetMaxUses(TUNING.WATHGRITHR_SPEAR_USES)
    inst.components.finiteuses:SetUses(TUNING.WATHGRITHR_SPEAR_USES)
    
    inst.components.finiteuses:SetOnFinished( onfinished )

    滻Ϊ

local function canattack(inst, target)
    if TheInput:IsMouseDown(MOUSEBUTTON_RIGHT) then
       GetPlayer().AnimState:PlayAnimation("atk")
       SpawnPrefab("groundpoundring_fx").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition())
       SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition())
       GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
       local pt01 = GetPlayer():GetPosition()
       local pt02 = target:GetPosition()
       target.Transform:SetPosition((pt02.x-pt01.x)*0.5+pt02.x, 0, (pt02.z-pt01.z)*0.5+pt02.z)
       local blood = SpawnPrefab("splash")
       blood.Transform:SetPosition(target.Transform:GetWorldPosition())
       blood.AnimState:SetMultColour(255/255,0/255,0/255,1)
       blood.Transform:SetScale(2, 2, 2)
       if target.components.locomotor then target.components.locomotor:Stop() end
       if target.components.combat then target.components.combat:SetTarget(GetPlayer()) end
       if target.components.health then
          target.components.health:DoDelta(-100)
          if target.components.health:GetPercent() < 0.3 then
             target.AnimState:SetMultColour(255/255,0/255,0/255,1)
          end
       end
    end
    return true
end
local function onattack(inst, attacker, target)
    local pt1 = attacker:GetPosition()
    local pt2 = target:GetPosition()
    GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
    attacker:DoTaskInTime(0.01, function()
        attacker.Transform:SetPosition(pt2.x, pt2.y, pt2.z)
        SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition())
        SpawnPrefab("groundpoundring_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
        if target.components.locomotor then target.components.locomotor:Stop() end
        attacker:StartThread(function()
            for k = 1, 3 do
                local blood = SpawnPrefab("splash")
                blood.Transform:SetPosition(pt2.x, 1.5, pt2.z)
                blood.AnimState:SetMultColour(255/255,0/255,0/255,1)
                blood.Transform:SetScale(2, 2, 2)
                Sleep(.1)
            end
        end )
        if target.components.health and target.components.health:GetPercent() < 0.3 then
           target.AnimState:SetMultColour(255/255,0/255,0/255,1)
        end
    end )
    attacker:DoTaskInTime(0.3, function()
        attacker.Transform:SetPosition(pt1.x, pt1.y, pt1.z)
    end )
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(300)
    inst.components.weapon:SetRange(15, 20)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetCanAttack(canattack)

    ˿˹ìΪǹװǹˣסԶͻ̵ˣкѸٳԭλ˻ĻᡣҼˣɽɣסҼɨһȺˣɷֹΧʹðǹʱ˻Ѫ漫ңǶͯס۾ʹá˿˹ì޸ġȫ˿˹ì˿˹ñ




һ.Ƭְʱ𿪲˺Χˣ˵Ѫ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\dragon_scales.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local bigaxe = SpawnPrefab("dragon_scales")
    bigaxe.Transform:SetPosition(pt.x, pt.y, pt.z)
    bigaxe.AnimState:SetBank("Lucy_axe")
    bigaxe.AnimState:SetBuild("Lucy_axe")
    bigaxe.AnimState:PlayAnimation("idle")
    bigaxe.components.inventoryitem:ChangeImageName("lucy")
    bigaxe:AddComponent("named")
    bigaxe.components.named:SetName("Poleaxe")
    bigaxe:RemoveComponent("stackable")
    bigaxe:RemoveComponent("deployable")
    bigaxe:AddComponent("equippable")
    bigaxe.components.equippable.equipslot = EQUIPSLOTS.HANDS
    bigaxe.components.equippable:SetOnEquip(function(bigaxe, owner)
        owner.AnimState:OverrideSymbol("swap_object", "swap_lucy_axe", "swap_lucy_axe")
        owner.AnimState:Show("ARM_carry")
        owner.AnimState:Hide("ARM_normal")
        bigaxe.fire = SpawnPrefab( "campfirefire" )
        local follower = bigaxe.fire.entity:AddFollower()
        follower:FollowSymbol( owner.GUID, "swap_object", -2, -135, 1 )
        bigaxe.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
        bigaxe.fire:RemoveComponent("heater")
        bigaxe.fire.persists = false
    end )
    bigaxe.components.equippable:SetOnUnequip(function(bigaxe, owner)
        owner.AnimState:Hide("ARM_carry") 
        owner.AnimState:Show("ARM_normal") 
        bigaxe.fire:Remove()
        bigaxe.fire = nil
    end )
    bigaxe:AddComponent("weapon")
    bigaxe.components.weapon:SetDamage(500)
    bigaxe.components.weapon:SetOnAttack(function(bigaxe, attacker, target)
        GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
        SpawnPrefab("groundpoundring_fx").Transform:SetPosition(attacker.Transform:GetWorldPosition())
        GetPlayer().components.playercontroller:ShakeCamera(attacker, "FULL", 0.5, 0.05, 2, 40)
        if target.components.locomotor then target.components.locomotor:Stop() end
        if target.components.health:GetPercent() < 0.3 then
           target.AnimState:SetMultColour(255/255,0/255,0/255,1)
        end
        attacker.components.health:DoDelta(150)
        attacker:StartThread(function()
            for k = 1, 3 do
                local blood = SpawnPrefab("splash")
                blood.Transform:SetPosition(target.Transform:GetWorldPosition())
                blood.AnimState:SetMultColour(255/255,0/255,0/255,1)
                blood.Transform:SetScale(2, 2, 2)
                Sleep(.1)
            end
        end )
        target:AddTag("nomove")
        target:DoTaskInTime(0.4, function() target:RemoveTag("nomove") end )
        local pos = Vector3(attacker.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 8)
        for k,v in pairs(ents) do
            if v.components.health and v.components.combat and not v.components.health:IsDead() and not v:HasTag("nomove") then
               if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") then
                  SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
                  v.components.health:DoDelta(-300)
                  local pt01 = attacker:GetPosition()
                  local pt02 = v:GetPosition()
                  v.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
                  if v.components.locomotor then v.components.locomotor:Stop() end
                  if v.components.health:GetPercent() < 0.3 then
                     v.AnimState:SetMultColour(255/255,0/255,0/255,1)
                  end
               end
            end
        end
    end )
    bigaxe:AddComponent("tool")
    bigaxe.components.tool:SetAction(ACTIONS.CHOP, 15)
    bigaxe:AddTag("bigaxes")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("bigaxes") then
       data.bigaxes = true
    end
end
local function onload(inst, data)
  if data and data.bigaxes then
    inst.AnimState:SetBank("Lucy_axe")
    inst.AnimState:SetBuild("Lucy_axe")
    inst.AnimState:PlayAnimation("idle")
    inst.components.inventoryitem:ChangeImageName("lucy")
    inst:AddComponent("named")
    inst.components.named:SetName("Poleaxe")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("deployable")
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
    inst.components.equippable:SetOnEquip(function(inst, owner)
        owner.AnimState:OverrideSymbol("swap_object", "swap_lucy_axe", "swap_lucy_axe")
        owner.AnimState:Show("ARM_carry")
        owner.AnimState:Hide("ARM_normal")
        inst.fire = SpawnPrefab( "campfirefire" )
        local follower = inst.fire.entity:AddFollower()
        follower:FollowSymbol( owner.GUID, "swap_object", -2, -135, 1 )
        inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
        inst.fire:RemoveComponent("heater")
        inst.fire.persists = false
    end )
    inst.components.equippable:SetOnUnequip(function(inst, owner)
        owner.AnimState:Hide("ARM_carry") 
        owner.AnimState:Show("ARM_normal") 
        inst.fire:Remove()
        inst.fire = nil
    end )
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(500)
    inst.components.weapon:SetOnAttack(function(inst, attacker, target)
        GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
        SpawnPrefab("groundpoundring_fx").Transform:SetPosition(attacker.Transform:GetWorldPosition())
        GetPlayer().components.playercontroller:ShakeCamera(attacker, "FULL", 0.5, 0.05, 2, 40)
        if target.components.locomotor then target.components.locomotor:Stop() end
        if target.components.health:GetPercent() < 0.3 then
           target.AnimState:SetMultColour(255/255,0/255,0/255,1)
        end
        attacker.components.health:DoDelta(150)
        attacker:StartThread(function()
            for k = 1, 3 do
                local blood = SpawnPrefab("splash")
                blood.Transform:SetPosition(target.Transform:GetWorldPosition())
                blood.AnimState:SetMultColour(255/255,0/255,0/255,1)
                blood.Transform:SetScale(2, 2, 2)
                Sleep(.1)
            end
        end )
        target:AddTag("nomove")
        target:DoTaskInTime(0.4, function() target:RemoveTag("nomove") end )
        local pos = Vector3(attacker.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 8)
        for k,v in pairs(ents) do
            if v.components.health and v.components.combat and not v.components.health:IsDead() and not v:HasTag("nomove") then
               if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") then
                  SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
                  v.components.health:DoDelta(-300)
                  local pt01 = attacker:GetPosition()
                  local pt02 = v:GetPosition()
                  v.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
                  if v.components.locomotor then v.components.locomotor:Stop() end
                  if v.components.health:GetPercent() < 0.3 then
                     v.AnimState:SetMultColour(255/255,0/255,0/255,1)
                  end
               end
            end
        end
    end )
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.CHOP, 15)
    inst:AddTag("bigaxes")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ƬְװʱԶȡ˵Ѫֵͬʱ𿪲˺Χĵˣ򹥻㱻ΧŹĻᡣҲһɿһáƬѻãҲڡͳС9-11ƽ𹺵




һ.Ƥְ99%˺ʱ˵ˣꡢԡܼ٣

    ü±ϷĿ¼\data\scripts\prefabs\pigskin.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local helmet = SpawnPrefab("pigskin")
    helmet.Transform:SetPosition(pt.x, pt.y, pt.z)
    helmet.AnimState:SetBank("wathgrithrhat")
    helmet.AnimState:SetBuild("hat_wathgrithr")
    helmet.AnimState:PlayAnimation("anim")
    helmet.components.inventoryitem:ChangeImageName("wathgrithrhat")
    helmet:RemoveComponent("stackable")
    helmet:RemoveComponent("tradable")
    helmet:RemoveComponent("edible")
    helmet:RemoveComponent("burnable")
    helmet:RemoveComponent("propagator")
    helmet:RemoveComponent("deployable")
    helmet:AddComponent("equippable")
    helmet.components.equippable.equipslot = EQUIPSLOTS.HEAD
    helmet.components.equippable.walkspeedmult = 2.5
    helmet.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32
    helmet.components.equippable:SetOnEquip(function(helmet, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HAT_HAIR")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        if owner == GetPlayer() then
           owner.AnimState:Hide("HEAD")
           owner.AnimState:Show("HEAD_HAIR")
           owner.components.temperature:SetTemp(20)
           owner:PushEvent("stopfreezing")
           owner:PushEvent("stopoverheating")
           owner.components.moisture:SetMoistureLevel(0)
           helmet.fire = SpawnPrefab( "campfirefire" )
           local follower = helmet.fire.entity:AddFollower()
           follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 )
           helmet.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
           helmet.fire.Transform:SetScale(1.3, 1.3, 1.3)
           helmet.fire:RemoveComponent("heater")
           helmet.fire.persists = false
           helmet.helmetfn = function(attacked, data)
               if data and data.attacker and data.attacker.components.health then
                  SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition())
                  data.attacker.components.health:DoDelta(-300)
                  local pt01 = owner:GetPosition()
                  local pt02 = data.attacker:GetPosition()
                  data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
                  if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end
                  if data.attacker.components.health:GetPercent() < 0.3 then
                     data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1)
                  end
               end 
           end
           helmet:ListenForEvent("attacked", helmet.helmetfn, owner)
           owner:AddTag("goodsavages")
        end
    end )
    helmet.components.equippable:SetOnUnequip(function(helmet, owner)
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
        if owner == GetPlayer() then
           owner.AnimState:Show("HEAD")
           owner.AnimState:Hide("HEAD_HAIR")
           owner.components.temperature:SetTemp(nil)
           helmet.fire:Remove()
           helmet.fire = nil
           helmet:RemoveEventCallback("attacked", helmet.helmetfn, owner)
           owner:RemoveTag("goodsavages")
        end

    end )
    helmet:AddComponent("armor")
    helmet.components.armor:InitCondition(20000, 0.99)
    helmet:AddComponent("waterproofer")
    helmet.components.waterproofer:SetEffectiveness(1)
    helmet:AddTag("helmets")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("helmets") then
       data.helmets = true
    end
end
local function onload(inst, data)
  if data and data.helmets then
    inst.AnimState:SetBank("wathgrithrhat")
    inst.AnimState:SetBuild("hat_wathgrithr")
    inst.AnimState:PlayAnimation("anim")
    inst.components.inventoryitem:ChangeImageName("wathgrithrhat")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
    inst.components.equippable.walkspeedmult = 2.5
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32
    inst.components.equippable:SetOnEquip(function(inst, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HAT_HAIR")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        if owner == GetPlayer() then
           owner.AnimState:Hide("HEAD")
           owner.AnimState:Show("HEAD_HAIR")
           owner.components.temperature:SetTemp(20)
           owner:PushEvent("stopfreezing")
           owner:PushEvent("stopoverheating")
           owner.components.moisture:SetMoistureLevel(0)
           inst.fire = SpawnPrefab( "campfirefire" )
           local follower = inst.fire.entity:AddFollower()
           follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 )
           inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
           inst.fire.Transform:SetScale(1.3, 1.3, 1.3)
           inst.fire:RemoveComponent("heater")
           inst.fire.persists = false
           inst.helmetfn = function(attacked, data)
               if data and data.attacker and data.attacker.components.health then
                  SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition())
                  data.attacker.components.health:DoDelta(-300)
                  local pt01 = owner:GetPosition()
                  local pt02 = data.attacker:GetPosition()
                  data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
                  if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end
                  if data.attacker.components.health:GetPercent() < 0.3 then
                     data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1)
                  end
               end 
           end
           inst:ListenForEvent("attacked", inst.helmetfn, owner)
           owner:AddTag("goodsavages")
        end
    end )
    inst.components.equippable:SetOnUnequip(function(inst, owner)
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
        if owner == GetPlayer() then
           owner.AnimState:Show("HEAD")
           owner.AnimState:Hide("HEAD_HAIR")
           owner.components.temperature:SetTemp(nil)
           inst.fire:Remove()
           inst.fire = nil
           inst:RemoveEventCallback("attacked", inst.helmetfn, owner)
           owner:RemoveTag("goodsavages")
        end

    end )
    inst:AddComponent("armor")
    inst.components.armor:InitCondition(20000, 0.99)
    inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(1)
    inst:AddTag("helmets")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    Ƥְ99%˺˹ʱᱻ⵽ˣÿһѪյٱϢꡢԣʹܼ٣롰ǹƼаսʤʱѪ塱㡣Ҫ롰Ƥ桱һͬ޸




һ.׽ȣװħȣСԶ̻׽

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff_tornado.luaļinst:AddComponent("inspectable")һвݣ

local function canattack(inst, target)
    if target.prefab == "bee" or target.prefab == "killerbee" or target.prefab == "crow" or target.prefab == "robin" or target.prefab == "robin_winter" or target.prefab == "butterfly" or target.prefab == "mole" or target.prefab == "mosquito" or target.prefab == "rabbit" then
       return true
    end
    return false
end
local function onattack(inst, attacker, target)
    if target.prefab == "bee" then
       local prey = SpawnPrefab("bee")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "killerbee" then
       local prey = SpawnPrefab("killerbee")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "crow" then
       local prey = SpawnPrefab("crow")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "robin" then
       local prey = SpawnPrefab("robin")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "robin_winter" then
       local prey = SpawnPrefab("robin_winter")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "butterfly" then
       local prey = SpawnPrefab("butterfly")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "mole" then
       local prey = SpawnPrefab("mole")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "mosquito" then
       local prey = SpawnPrefab("mosquito")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    if target.prefab == "rabbit" then
       local prey = SpawnPrefab("rabbit")
       GetPlayer().components.inventory:GiveItem(prey)
    end
    target:Remove()
end
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(25, 30)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetCanAttack(canattack)
    inst.components.weapon:SetProjectile("bishop_charge")

    ɽħΪ׽ȣװ׽ȣСԶ׽ǡɻ׽С۷䡢ɱ˷䡢񡢺ӡӡħҼٻĹܱħսѡ£10¹Ѽë1ǡ1




һ߰.ñƤñˣײٽʯͷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

    local function football()
        local inst = simple()
		inst:AddComponent("armor")

        inst:AddComponent("waterproofer")
        inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
		
        inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, TUNING.ARMOR_FOOTBALLHAT_ABSORPTION)
		return inst
    end

    滻Ϊ

local function football_equip(inst, owner)
    onequip(inst, owner)
    if owner == GetPlayer() then
       owner.Transform:SetScale(3, 3, 3)
       owner.components.combat:SetDefaultDamage(500)
       owner.Physics:SetCollisionCallback(function(owner, other)
           if other and other.components.workable and other.components.workable.workleft > 0 then
              other.components.workable:Destroy(owner)
           end
       end)
    end
end
local function football_unequip(inst, owner)
    onunequip(inst, owner)
    if owner == GetPlayer() then
       owner.Transform:SetScale(1, 1, 1)
       owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
       owner.Physics:SetCollisionCallback( nil )
    end
end
local function football()
    local inst = simple()
    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, 0.95)
    inst:AddComponent("waterproofer")
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
    inst.components.equippable:SetOnEquip( football_equip )
    inst.components.equippable:SetOnUnequip( football_unequip )
    return inst
end

    ɴƤñˣֹﵽ500㣨ְCtrl + סF95%˺ֻ5%ѪײٽʯͷƤñսѡѽ£1ӡ1Ƥ죬ʱ뿿




һ߾.װ99%˺ֵ

    1.ͨףü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99)


    2.Сףü±ϷĿ¼\data\DLC0001\scripts\prefabs\piggyback.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99)


    3.˹ףü±ϷĿ¼\data\DLC0001\scripts\prefabs\krampus_sack.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99)


    4.ףü±ϷĿ¼\data\DLC0001\scripts\prefabs\icepack.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("armor")
    inst.components.armor:InitCondition(TUNING.ARMORMARBLE, 0.99)


    5.̣ü±ϷĿ¼\data\scripts\components\armor.luaļݣ

function Armor:SetCondition(amount)
    self.condition = amount

    滻Ϊ

function Armor:SetCondition(amount)
    self.condition = self.maxcondition

    װӵп׷ã99%˺ֵʹŶ




һˣ.«έЯ«έϰҼɴ߹

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cutreeds.luaļinst:AddComponent("inventoryitem")һвݣ

    inst:AddTag("flute")
local function HearPanFlute(inst, musician, instrument)
    if inst.components.sleeper then
       inst.components.sleeper:AddSleepiness(10, TUNING.PANFLUTE_SLEEPTIME*1)
    end
end
    inst:AddComponent("tool")
    inst.components.tool:SetAction(ACTIONS.PLAY)
    inst:AddComponent("instrument")
    inst.components.instrument.range = TUNING.PANFLUTE_SLEEPRANGE*2
    inst.components.instrument:SetOnHeardFn(HearPanFlute)

    Я«έϰҼɴһƬ*1Ϊʱ20룬60*3ɡ*2Ϊ߷Χ3060*4




һһ.ģСɱĿ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\sweatervest.luaļݣ

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body")
    inst.components.fueled:StartConsuming()
end

local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    inst.components.fueled:StopConsuming()
end

    滻Ϊ

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body")
    inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2
    owner:Hide()
    local shadow = GetPlayer().entity:AddDynamicShadow()
    shadow:SetSize( 0, 0 )
end
local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
    owner:Show()
    local shadow = GetPlayer().entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
end

    ɴСɱԹˣҲ㣬ӶֱӹŶСɱڴѡñ£8Ȯ6˿




һ˶.ǣԻʹݣ

    ü±ϷĿ¼\data\scripts\prefabs\butter.luaļinst.components.edible.hungervalue = TUNING.CALORIES_MEDһвݣ

    local function proc(inst, eater)
        eater.components.health:SetInvincible(true)
        inst:AddTag("forcefield")
        local fx = SpawnPrefab("forcefieldfx")
        fx.entity:SetParent(eater.entity)
        fx.Transform:SetPosition(0, 0.2, 0)
        local fx_hitanim = function()
            fx.AnimState:PlayAnimation("hit")
            fx.AnimState:PushAnimation("idle_loop")
        end
        fx:ListenForEvent("blocked", fx_hitanim, eater)
        inst.active = true
        eater:DoTaskInTime(60, function()
            fx:RemoveEventCallback("blocked", fx_hitanim, eater)
            fx.kill_fx(fx)
            if inst:IsValid() then
                eater.components.health:SetInvincible(false)
                inst:RemoveTag("forcefield")
                eater:DoTaskInTime(5, function() inst.active = false end)
            end
        end)
    end
local function oneaten(inst, eater)
	proc(inst, eater)
end
       	inst.components.edible:SetOnEatenFn(oneaten)

    ɳԻͺ60߻һݣ޷˵ǡͿԿɱ䣬Ҳñ޸ļɵġּ̹ľ͡õ




һ.Ի껨󣨴Χʳ˻۾ǣ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

		inst:AddComponent("perishable")
		inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
		inst.components.perishable:StartPerishing()
		inst.components.perishable:SetOnPerishFn(generic_perish)
        inst.components.equippable:SetOnEquip( opentop_onequip )

    滻Ϊ

local function flower_equip(inst, owner)
    opentop_onequip(inst, owner)
    inst:AddComponent("minionspawner")
    inst.components.minionspawner.miniontype = "eyeplant"
    inst.components.minionspawner.maxminions = 27
    inst.components.minionspawner.minionspawntime = {min = 0.01, max = 0.01}
    inst.components.minionspawner.numminions = 10
    inst.components.minionspawner.shouldspawn = true
    inst.components.minionspawner:StartNextSpawn()
end
local function flower_unequip(inst, owner)
    onunequip(inst, owner)
    inst.components.minionspawner.shouldspawn = false
    inst.components.minionspawner:KillAllMinions()
    inst:RemoveComponent("minionspawner")
end
    inst.components.equippable:SetOnEquip( flower_equip )
    inst.components.equippable:SetOnUnequip( flower_unequip )


    2.ü±ϷĿ¼\data\scripts\prefabs\eyeplant.luaļݣ

            return (guy:HasTag("character") or guy:HasTag("monster") or guy:HasTag("animal") or guy:HasTag("prey") or guy:HasTag("eyeplant") or guy:HasTag("lureplant")) and not checkmaster(guy, inst)

    滻Ϊ

            return (guy:HasTag("character") or guy:HasTag("monster") or guy:HasTag("animal") or guy:HasTag("prey") or guy:HasTag("eyeplant") or guy:HasTag("lureplant")) and not guy:HasTag("player") and not checkmaster(guy, inst)

    ɴΧʳ˻۾ǣʳ˻۾˴һֻһժ»ʳ˻۾ʧ




һ.԰ϵͳҹԶ򿿽ĵ˷ڵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\nightlight.luaļinst:AddComponent("inspectable")һвݣ

local function onattack(inst)
    local pos = Vector3(inst.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
    for k,v in pairs(ents) do
        if v.components.health and v.components.combat and not v.components.health:IsDead() then
           if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") then
              inst.components.weapon:LaunchProjectile(inst, v)
              v.components.health:DoDelta(-5000)
              inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
              SpawnPrefab("collapse_small").Transform:SetPosition(v.Transform:GetWorldPosition())
              SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
              GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40)
              inst.components.fueled:InitializeFuelLevel(1000)
           end
        end
    end
end
local function turnon(inst)
    inst.components.machine.ison = true
    inst.task = inst:DoPeriodicTask(.5, function() onattack(inst) end)
    inst.components.burnable:IsBurning()
    inst.components.fueled:InitializeFuelLevel(1000)
    end
local function turnoff(inst)
    inst.components.machine.ison = false
    if inst.task then inst.task:Cancel() inst.task = nil end
    inst.components.burnable:Extinguish()
    inst.components.fueled:InitializeFuelLevel(0)
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetProjectile("eye_charge")

    ɶ԰ҹưҼ԰ϵͳԶ򿿽ĵ˷ڵṥͬ飩ٰҼرաڻظ޾κεˡӰħѡźã£8ƽ2جȼϡ1챦ʯ




һ.̫ǿöΧγˣ˱

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

    local function earmuffs()
        local inst = simple()
        inst:AddComponent("insulator")
        inst.components.insulator.insulation = TUNING.INSULATION_SMALL
        inst.components.equippable:SetOnEquip( opentop_onequip )
        inst:AddComponent("fueled")
        inst.components.fueled.fueltype = "USAGE"
        inst.components.fueled:InitializeFuelLevel(TUNING.EARMUFF_PERISHTIME)
        inst.components.fueled:SetDepletedFn(generic_perish)
		inst.AnimState:SetRayTestOnBB(true)
		return inst
    end

    滻Ϊ

local colours=
{
    {198/255,43/255,43/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {233/255,208/255,69/255},
    {109/255,50/255,163/255},
    {222/255,126/255,39/255},
}
local function pickup(inst, owner)
    inst.colour_idx = math.random(#colours)
    local light = inst.entity:AddLight() 
    light:SetIntensity(.8)
    light:SetRadius(3)
    light:SetFalloff(1)
    light:Enable(true)
    light:SetColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3])
    local pt = Vector3(owner.Transform:GetWorldPosition())
    local result_offset = FindValidPositionByFan(math.random()*2*PI, 10, 75, function(offset)
          local x,y,z = (pt + offset):Get()
          local ents = TheSim:FindEntities(x,y,z , 1)
          return not next(ents) 
    end)
    local ents2 = TheSim:FindEntities(pt.x,pt.y,pt.z, 8)
    for k,v in pairs(ents2) do
        if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") and not v:HasTag("smallbird") and not v:HasTag("chester") and not v:HasTag("wall") and not v:HasTag("structure") then
           v.Transform:SetPosition((pt + result_offset):Get())
        end
    end
end
local function earmuffs_onequip(inst, owner)
    inst.task = inst:DoPeriodicTask(.033, function() pickup(inst, owner) end)
    GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic")
    opentop_onequip(inst, owner)
end
local function earmuffs_onunequip(inst, owner)
    if inst.task then inst.task:Cancel() inst.task = nil end
    GetPlayer().SoundEmitter:KillSound("beavermusic")
    onunequip(inst, owner)
    inst.Light:Enable(false)
end
local function earmuffs()
    local inst = simple()
    inst:AddComponent("insulator")
    inst.components.insulator.insulation = TUNING.INSULATION_SMALL
    inst.components.equippable:SetOnEquip( earmuffs_onequip )
    inst.components.equippable:SetOnUnequip( earmuffs_onunequip )
    inst.AnimState:SetRayTestOnBB(true)
    return inst
end

    ڴöʱΧγˣ˿ᱻɱ˷ѡ͵񵰺ˡöڴѡñ£2ӡ1֦




һ.ΧǽF11һȦʯΧǽΧǽɿţ5Զţҹ

    1.ü±ϷĿ¼\data\scripts\prefabs\marblepillar.luaļinst:AddComponent("inspectable")һвݣ

local function GetStatus(inst, viewer)
    local pt = inst:GetPosition()
    inst:Remove()
    inst:DoTaskInTime(5, function() 
        SpawnPrefab("marblepillar").Transform:SetPosition(pt.x, pt.y, pt.z)
        inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end)
end
local function LightsOn(inst)
    inst.Light:Enable(true)
end
local function LightsOff(inst)
    inst.Light:Enable(false)
end
    local light = inst.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:Enable(false)
    light:SetColour(180/255, 195/255, 50/255)
    inst.components.inspectable.getstatus = GetStatus
    inst:ListenForEvent( "daytime", function() LightsOff(inst) end, GetWorld())
    inst:ListenForEvent( "dusktime", function() LightsOn(inst) end, GetWorld())


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_F11, function()
    local player = GetPlayer()
    local pt = Vector3(player.Transform:GetWorldPosition())
        for k = 1, 75 do
            local theta = 1 * 2 * PI
            local radius = 18
            local result_offset = FindValidPositionByFan(theta, radius, 75, function(offset)
                local x,y,z = (pt + offset):Get()
                local ents = TheSim:FindEntities(x,y,z , 1)
                return not next(ents) 
            end)
            if result_offset then
                local tentacle = SpawnPrefab("marblepillar")
                tentacle.Transform:SetPosition((pt + result_offset):Get())
                GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            end
            inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        end
end)
TheInput:AddKeyUpHandler(KEY_F12, function()
    local player = GetPlayer()
    local range = 30
    local pos = Vector3(player.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v.prefab == "marblepillar" then
           v:Remove()
        end
    end
    inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
end)

    ڿĿյϰF11һȦʯΧǽF12ȥΧǽɿţ5ԶţҹԶϵͳլΧǽȦﶼˡעⲻҪŸΧǽôʯ




һ.ѹС̼ӺżһȦѹǽżʧ

    1.ü±ϷĿ¼\data\scripts\prefabs\basalt.luaļinst:AddComponent("inspectable")һвݣ

local function OnExplode(inst, target)
    if target and not target:HasTag("smallbird") and not target:HasTag("chester") then
       SpawnPrefab("lightning_rod_fx").Transform:SetPosition(inst.Transform:GetWorldPosition())
       SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
       inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
       target.components.health:DoDelta(-3000)
    end
    inst:DoTaskInTime(.1, function() inst.components.mine:Reset() end )
end
	inst:AddComponent("mine")
	inst.components.mine:SetRadius(4)
	inst.components.mine:SetAlignment("player")
	inst.components.mine:SetOnExplodeFn(OnExplode)
	inst.components.mine:Reset()


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("catcher")һвݣ

TheInput:AddKeyUpHandler(KEY_KP_PLUS, function()
    local player = GetPlayer()
    local pt = Vector3(player.Transform:GetWorldPosition())
        for k = 1, 50 do
            local theta = 1 * 2 * PI
            local radius = 8
            local result_offset = FindValidPositionByFan(theta, radius, 50, function(offset)
                local x,y,z = (pt + offset):Get()
                local ents = TheSim:FindEntities(x,y,z , 1)
                return not next(ents) 
            end)
            if result_offset then
                local tentacle = SpawnPrefab("basalt_pillar")
                tentacle.Transform:SetPosition((pt + result_offset):Get())
                GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                local fx = SpawnPrefab("lightning_rod_fx")
                local pos = pt + result_offset
                fx.Transform:SetPosition(pos.x, pos.y, pos.z)
            end
            inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
        end
end)
TheInput:AddKeyUpHandler(KEY_KP_MINUS, function()
    local player = GetPlayer()
    local range = 15
    local pos = Vector3(player.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v.prefab == "basalt_pillar" then
            SpawnPrefab("lightning_rod_fx").Transform:SetPosition(v.Transform:GetWorldPosition())
            v:Remove()
        end
    end
    inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
end)

    ɰС̼ӺżΧһȦѹǽ￿ᱻС̼żԶʧעⲻҪ̫ʱӺżѹҲȦʹǽȱڡʹóɫħȻʿȡ޸ļɣͿɳѼҾߡũ棬Ҳ¹;¹




һ˰.ڴ䣨جȼֿڴ䣬ڵϷɳɱ˷乥ˣ

    ü±ϷĿ¼\data\scripts\prefabs\nightmarefuel.luaļinst:AddComponent("inspectable")һвݣ

local killersounds = 
{
    takeoff = "dontstarve/bee/killerbee_takeoff",
    attack = "dontstarve/bee/killerbee_attack",
    buzz = "dontstarve/bee/killerbee_fly_LP",
    hit = "dontstarve/bee/killerbee_hurt",
    death = "dontstarve/bee/killerbee_death",
}
local function OnDeploy (inst, pt)
  if GetPlayer().components.inventory:Has("goldnugget", 500) then 
    GetPlayer().components.inventory:ConsumeByName("goldnugget", 500)
    local box = SpawnPrefab("nightmarefuel")
    box.Transform:SetPosition(pt.x, pt.y, pt.z)
    box.AnimState:SetBank("bee_box")
    box.AnimState:SetBuild("bee_box")
    box.AnimState:PlayAnimation("idle")
    box.AnimState:SetMultColour(255/255,0/255,0/255,1)
    box.Transform:SetScale(0.5, 0.5, 0.5)
    local sound = box.entity:AddSoundEmitter()
    local minimap = box.entity:AddMiniMapEntity()
    minimap:SetIcon( "beebox.png" )
    box.components.inventoryitem:ChangeImageName("beebox")
    box:RemoveComponent("stackable")
    box:RemoveComponent("fuel")
    box:RemoveComponent("deployable")
    box:AddComponent("workable")
    box.components.workable:SetWorkAction(ACTIONS.HAMMER)
    box.components.workable:SetWorkLeft(3)
    box.components.workable:SetOnFinishCallback(function(box)
	 SpawnPrefab("collapse_small").Transform:SetPosition(box.Transform:GetWorldPosition())
	 box.SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
	 box:Remove()
    end )
    box.task = box:DoPeriodicTask(2, function(box)
        box.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        box:DoTaskInTime(1, function() box.AnimState:SetBloomEffectHandle("") end )
        local pos = Vector3(box.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
        for k,v in pairs(ents) do
            if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then
               if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then
                  local pt1 = box:GetPosition()
                  local killerbee = SpawnPrefab("nightmarefuel")
                  killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                  killerbee.AnimState:SetBank("bee")
                  killerbee.AnimState:SetBuild("bee_angry_build")
                  killerbee.AnimState:PlayAnimation("idle")
                  killerbee.AnimState:SetRayTestOnBB(true)
                  killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1)
                  killerbee.entity:AddSoundEmitter()
                  killerbee.entity:AddLightWatcher()
                  killerbee.entity:AddDynamicShadow()
                  killerbee.DynamicShadow:SetSize( .8, .5 )
                  killerbee.Transform:SetFourFaced()
                  MakeCharacterPhysics(killerbee, 1, .3)
                  killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS)
                  killerbee.Physics:ClearCollisionMask()
                  killerbee.Physics:CollidesWith(COLLISION.WORLD)
                  killerbee.Physics:CollidesWith(COLLISION.FLYERS)
                  killerbee:AddTag("killerbee")
                  killerbee:AddComponent("locomotor")
                  killerbee.components.locomotor:EnableGroundSpeedMultiplier(false)
                  killerbee.components.locomotor:SetTriggersCreep(false)
                  killerbee:SetStateGraph("SGbee")
                  killerbee:AddComponent("health")
                  killerbee.components.health:SetMaxHealth(200)
                  killerbee:AddComponent("combat")
                  killerbee.components.combat:SetTarget(v)
                  killerbee.components.combat:SetDefaultDamage(20)
                  killerbee.components.combat:SetAttackPeriod(0.1)
                  killerbee.components.combat.hiteffectsymbol = "body"
                  killerbee.components.combat:SetRetargetFunction(1, function(killerbee)
                      if not killerbee.components.health:IsDead() then
                         return FindEntity(box, 30, function(guy)
                             if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
                                return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive"
                             end
                         end)
                      end
                  end )
                  local killerbrain = require("brains/killerbeebrain")
                  killerbee:SetBrain(killerbrain)
                  killerbee.sounds = killersounds
                  killerbee:AddComponent("knownlocations")
                  killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end )
                  killerbee:RemoveComponent("stackable")
                  killerbee:RemoveComponent("fuel")
                  killerbee:RemoveComponent("deployable")
                  killerbee:RemoveComponent("inventoryitem")
                  killerbee:DoTaskInTime(30, function() killerbee:Remove() end )
                  v:ListenForEvent("death", function() killerbee:Remove() end )
               end
            end
        end
    end )
    box.components.inventoryitem:SetOnPutInInventoryFn(function(box)
        box:RemoveTag("doings")
        if box.task then box.task:Cancel() box.task = nil end
        local pos = Vector3(box.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
        for k,v in pairs(ents) do
            if v:HasTag("killerbee") then
               v:Remove()
            end
        end
    end )
    box.components.inventoryitem:SetOnDroppedFn(function(box)
        box:AddTag("doings")
        box.task = box:DoPeriodicTask(2, function(box)
            box.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            box:DoTaskInTime(1, function() box.AnimState:SetBloomEffectHandle("") end )
            local pos = Vector3(box.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
            for k,v in pairs(ents) do
                if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then
                   if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then
                      local pt1 = box:GetPosition()
                      local killerbee = SpawnPrefab("nightmarefuel")
                      killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                      killerbee.AnimState:SetBank("bee")
                      killerbee.AnimState:SetBuild("bee_angry_build")
                      killerbee.AnimState:PlayAnimation("idle")
                      killerbee.AnimState:SetRayTestOnBB(true)
                      killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1)
                      killerbee.entity:AddSoundEmitter()
                      killerbee.entity:AddLightWatcher()
                      killerbee.entity:AddDynamicShadow()
                      killerbee.DynamicShadow:SetSize( .8, .5 )
                      killerbee.Transform:SetFourFaced()
                      MakeCharacterPhysics(killerbee, 1, .3)
                      killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS)
                      killerbee.Physics:ClearCollisionMask()
                      killerbee.Physics:CollidesWith(COLLISION.WORLD)
                      killerbee.Physics:CollidesWith(COLLISION.FLYERS)
                      killerbee:AddTag("killerbee")
                      killerbee:AddComponent("locomotor")
                      killerbee.components.locomotor:EnableGroundSpeedMultiplier(false)
                      killerbee.components.locomotor:SetTriggersCreep(false)
                      killerbee:SetStateGraph("SGbee")
                      killerbee:AddComponent("health")
                      killerbee.components.health:SetMaxHealth(200)
                      killerbee:AddComponent("combat")
                      killerbee.components.combat:SetTarget(v)
                      killerbee.components.combat:SetDefaultDamage(20)
                      killerbee.components.combat:SetAttackPeriod(0.1)
                      killerbee.components.combat.hiteffectsymbol = "body"
                      killerbee.components.combat:SetRetargetFunction(1, function(killerbee)
                          if not killerbee.components.health:IsDead() then
                             return FindEntity(box, 30, function(guy)
                                 if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
                                    return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive"
                                 end
                             end)
                          end
                      end )
                      local killerbrain = require("brains/killerbeebrain")
                      killerbee:SetBrain(killerbrain)
                      killerbee.sounds = killersounds
                      killerbee:AddComponent("knownlocations")
                      killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end )
                      killerbee:RemoveComponent("stackable")
                      killerbee:RemoveComponent("fuel")
                      killerbee:RemoveComponent("deployable")
                      killerbee:RemoveComponent("inventoryitem")
                      killerbee:DoTaskInTime(30, function() killerbee:Remove() end )
                      v:ListenForEvent("death", function() killerbee:Remove() end )
                   end
                end
            end
        end )
    end )
    box:AddTag("doings")
    box:AddTag("boxs")
  end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("boxs") then
        data.boxs = true
    end
    if inst:HasTag("doings") then
        data.doings = true
    end
    if inst:HasTag("killerbee") then
        data.killerbee = true
    end
end
local function onload(inst, data)
  if data and data.boxs then
     inst.AnimState:SetBank("bee_box")
     inst.AnimState:SetBuild("bee_box")
     inst.AnimState:PlayAnimation("idle")
     inst.AnimState:SetMultColour(255/255,0/255,0/255,1)
     inst.Transform:SetScale(0.5, 0.5, 0.5)
     local sound = inst.entity:AddSoundEmitter()
     local minimap = inst.entity:AddMiniMapEntity()
     minimap:SetIcon( "beebox.png" )
     inst.components.inventoryitem:ChangeImageName("beebox")
     inst:RemoveComponent("stackable")
     inst:RemoveComponent("fuel")
     inst:RemoveComponent("deployable")
     inst:AddComponent("workable")
     inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
     inst.components.workable:SetWorkLeft(3)
     inst.components.workable:SetOnFinishCallback(function(inst)
	  SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
	  inst.SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
	  inst:Remove()
     end )
     inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst)
         inst:RemoveTag("doings")
         if inst.task then inst.task:Cancel() inst.task = nil end
         local pos = Vector3(inst.Transform:GetWorldPosition())
         local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
         for k,v in pairs(ents) do
             if v:HasTag("killerbee") then
                v:Remove()
             end
         end
     end )
     inst.components.inventoryitem:SetOnDroppedFn(function(inst)
         inst:AddTag("doings")
         inst.task = inst:DoPeriodicTask(2, function(inst)
             inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
             inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end )
             local pos = Vector3(inst.Transform:GetWorldPosition())
             local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
             for k,v in pairs(ents) do
                 if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then
                    if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then
                       local pt1 = inst:GetPosition()
                       local killerbee = SpawnPrefab("nightmarefuel")
                       killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                       killerbee.AnimState:SetBank("bee")
                       killerbee.AnimState:SetBuild("bee_angry_build")
                       killerbee.AnimState:PlayAnimation("idle")
                       killerbee.AnimState:SetRayTestOnBB(true)
                       killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1)
                       killerbee.entity:AddSoundEmitter()
                       killerbee.entity:AddLightWatcher()
                       killerbee.entity:AddDynamicShadow()
                       killerbee.DynamicShadow:SetSize( .8, .5 )
                       killerbee.Transform:SetFourFaced()
                       MakeCharacterPhysics(killerbee, 1, .3)
                       killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS)
                       killerbee.Physics:ClearCollisionMask()
                       killerbee.Physics:CollidesWith(COLLISION.WORLD)
                       killerbee.Physics:CollidesWith(COLLISION.FLYERS)
                       killerbee:AddTag("killerbee")
                       killerbee:AddComponent("locomotor")
                       killerbee.components.locomotor:EnableGroundSpeedMultiplier(false)
                       killerbee.components.locomotor:SetTriggersCreep(false)
                       killerbee:SetStateGraph("SGbee")
                       killerbee:AddComponent("health")
                       killerbee.components.health:SetMaxHealth(200)
                       killerbee:AddComponent("combat")
                       killerbee.components.combat:SetTarget(v)
                       killerbee.components.combat:SetDefaultDamage(20)
                       killerbee.components.combat:SetAttackPeriod(0.1)
                       killerbee.components.combat.hiteffectsymbol = "body"
                       killerbee.components.combat:SetRetargetFunction(1, function(killerbee)
                           if not killerbee.components.health:IsDead() then
                              return FindEntity(inst, 30, function(guy)
                                  if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
                                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive"
                                  end
                              end)
                           end
                       end )
                       local killerbrain = require("brains/killerbeebrain")
                       killerbee:SetBrain(killerbrain)
                       killerbee.sounds = killersounds
                       killerbee:AddComponent("knownlocations")
                       killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end )
                       killerbee:RemoveComponent("stackable")
                       killerbee:RemoveComponent("fuel")
                       killerbee:RemoveComponent("deployable")
                       killerbee:RemoveComponent("inventoryitem")
                       killerbee:DoTaskInTime(30, function() killerbee:Remove() end )
                       v:ListenForEvent("death", function() killerbee:Remove() end )
                    end
                 end
             end
         end )
     end )
     inst:AddTag("boxs")
  end
  if data and data.doings then
     inst.task = inst:DoPeriodicTask(2, function(inst)
         inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
         inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end )
         local pos = Vector3(inst.Transform:GetWorldPosition())
         local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
         for k,v in pairs(ents) do
             if v.components.health and not v.components.health:IsDead() and not v:HasTag("player") then
                if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard" or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive" then
                   local pt1 = inst:GetPosition()
                   local killerbee = SpawnPrefab("nightmarefuel")
                   killerbee.Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                   killerbee.AnimState:SetBank("bee")
                   killerbee.AnimState:SetBuild("bee_angry_build")
                   killerbee.AnimState:PlayAnimation("idle")
                   killerbee.AnimState:SetRayTestOnBB(true)
                   killerbee.AnimState:SetMultColour(255/255,255/255,255/255,1)
                   killerbee.entity:AddSoundEmitter()
                   killerbee.entity:AddLightWatcher()
                   killerbee.entity:AddDynamicShadow()
                   killerbee.DynamicShadow:SetSize( .8, .5 )
                   killerbee.Transform:SetFourFaced()
                   MakeCharacterPhysics(killerbee, 1, .3)
                   killerbee.Physics:SetCollisionGroup(COLLISION.FLYERS)
                   killerbee.Physics:ClearCollisionMask()
                   killerbee.Physics:CollidesWith(COLLISION.WORLD)
                   killerbee.Physics:CollidesWith(COLLISION.FLYERS)
                   killerbee:AddTag("killerbee")
                   killerbee:AddComponent("locomotor")
                   killerbee.components.locomotor:EnableGroundSpeedMultiplier(false)
                   killerbee.components.locomotor:SetTriggersCreep(false)
                   killerbee:SetStateGraph("SGbee")
                   killerbee:AddComponent("health")
                   killerbee.components.health:SetMaxHealth(200)
                   killerbee:AddComponent("combat")
                   killerbee.components.combat:SetTarget(v)
                   killerbee.components.combat:SetDefaultDamage(20)
                   killerbee.components.combat:SetAttackPeriod(0.1)
                   killerbee.components.combat.hiteffectsymbol = "body"
                   killerbee.components.combat:SetRetargetFunction(1, function(killerbee)
                       if not killerbee.components.health:IsDead() then
                          return FindEntity(inst, 30, function(guy)
                              if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("player") then
                                 return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy.prefab == "beefalo" or guy.prefab == "bunnyman" or guy.prefab == "pigman" or guy.prefab == "pigguard" or guy.prefab == "merm" or guy.prefab == "monkey" or guy.prefab == "tallbird" or guy.prefab == "walrus" or guy.prefab == "little_walrus" or guy.prefab == "wasphive"
                              end
                          end)
                       end
                   end )
                   local killerbrain = require("brains/killerbeebrain")
                   killerbee:SetBrain(killerbrain)
                   killerbee.sounds = killersounds
                   killerbee:AddComponent("knownlocations")
                   killerbee:ListenForEvent("attacked", function(killerbee, data) killerbee.components.combat:SetTarget(data.attacker) end )
                   killerbee:RemoveComponent("stackable")
                   killerbee:RemoveComponent("fuel")
                   killerbee:RemoveComponent("deployable")
                   killerbee:RemoveComponent("inventoryitem")
                   killerbee:DoTaskInTime(30, function() killerbee:Remove() end )
                   v:ListenForEvent("death", function() killerbee:Remove() end )
                end
             end
         end
     end )
     inst:AddTag("doings")
  end
  if data and data.killerbee then
     inst:Remove()
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ܹ500ƽʱجȼֿڴ䣬500ƽϻƽʱֳڵʱΧеˣ᲻Ϸɳɱ˷乥ˣֱΪֹɱ˷䲻ṥǼͬ飨ˡˣڴ䣬ɽƷʾΪͼ꣬зɳɱ˷佫ʧڴڵϵͳȿ԰սҲԱأΧжٵˣɳ㹻ɱ˷ȥֻһɣԵӲҪϸߡͨСͼѯڴλãʾΪͼꡣҪڴʱôҵ




һ˾.ħȦF9ڵϻħȦκ￿ٰF9ȡ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_F9, function()
    if not inst:HasTag("havelifebuoy") then
       inst:AddTag("havelifebuoy")
       inst.components.locomotor:Stop()
       inst.AnimState:PlayAnimation("give")
       inst.components.health:DoDelta(-10)
       GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.7, 0.02, .5, 40)
       GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
       SpawnPrefab("groundpoundring_fx").Transform:SetPosition(inst.Transform:GetWorldPosition())
       SpawnPrefab("tauntfire_fx").Transform:SetPosition(inst.Transform:GetWorldPosition())
       inst:DoTaskInTime(0.5, function() 
           local pt = inst:GetPosition()
           local lifebuoy = SpawnPrefab("firesuppressor_placer")
           lifebuoy.Transform:SetPosition(pt.x, 0, pt.z)
           lifebuoy.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
           lifebuoy.AnimState:SetLayer( LAYER_BACKGROUND )
           lifebuoy.AnimState:SetSortOrder( 1 )
           lifebuoy.Transform:SetScale(1.1, 1.1, 1.1)
           lifebuoy.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           lifebuoy.AnimState:SetMultColour(255/255,0/255,0/255,1)
           lifebuoy.persists = false
           lifebuoy:DoPeriodicTask(0.3, function()
               local pos = Vector3(lifebuoy.Transform:GetWorldPosition())
               local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
               for k,v in pairs(ents) do
                   if v.components.health and v.components.combat and not v.components.health:IsDead() and not v:HasTag("player") and not v:HasTag("wall") then
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                      SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
                      v.components.health:DoDelta(-200)
                      local pt1 = lifebuoy:GetPosition()
                      local pt2 = v:GetPosition()
                      v.Transform:SetPosition((pt2.x-pt1.x)*1.5+pt2.x, 0, (pt2.z-pt1.z)*1.5+pt2.z)
                   end
               end
           end )
           lifebuoy:AddTag("NOCLICK")
           lifebuoy:AddTag("lifebuoy")
       end )
    else
       inst:RemoveTag("havelifebuoy")
       inst.components.locomotor:Stop()
       inst.AnimState:PlayAnimation("give")
       GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
       SpawnPrefab("tauntfire_fx").Transform:SetPosition(inst.Transform:GetWorldPosition())
       local pos = Vector3(inst.Transform:GetWorldPosition())
       local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
       for k,v in pairs(ents) do
           if v:HasTag("lifebuoy") then
              v:Remove()
           end
       end
    end
end )

    ɰF9ڵϻħȦվȦУκ￿ɱֵٴΰF9յħȦħȦһѪħÿһΣǽ10ֵϵʱʩ




һţ.ܹԶֻеҪ롰üһͬ޸ģ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst.Transform:SetFourFaced()һвݣ

local function OnAttacked(inst, data)
    local spawn = ""
    if math.random()<.1 then
        spawn = "rook_nightmare"
    elseif math.random()<.5 then
        spawn = "bishop_nightmare"
    else
        spawn = "knight_nightmare"
    end
    SpawnAt("maxwell_smoke",inst)
    local it = SpawnAt(spawn,inst)
    if it.components.follower then
       it.components.follower:SetLeader(GetPlayer())
    end
end
    inst:ListenForEvent("attacked", OnAttacked)

    ܵʱԶе֣ǡǿƹCtrl + һееŻ




һһ.ٻ飨ȸǶ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\torch.luaļinst:AddComponent("inspectable")һвݣ

local function cancreatelight(staff, caster, target, pos)
    local ground = GetWorld()
    if ground and pos then
        local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
        return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
    end
    return false
end
local function createlight(staff, target, pos)
    local light = SpawnPrefab("abigail")
    light.Transform:SetPosition(pos.x, pos.y, pos.z)
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false

    װʱڿյϰҼٻ飬ᱣ㡣ȡ飬ٻϣһ׷һctrl + ȡȫ顣Ҫ롰ҵС顱һͬ޸




һŶ.ţװӰٻ˹ʿ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\nightsword.luaļinst.components.equippable.dapperness = TUNING.CRAZINESS_MED滻Ϊݣ

local function cancreatelight(staff, caster, target, pos)
    local ground = GetWorld()
    if ground and pos then
        local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
        return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
    end
    return false
end
local function createlight(staff, target, pos)
    local light = SpawnPrefab("krampus")
    light.Transform:SetPosition(pos.x, pos.y, pos.z)
    local caster = staff.components.inventoryitem.owner
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false


    2.ü±ϷĿ¼\data\scripts\prefabs\krampus.luaļݣ

local function OnAttacked(inst, data)
    inst.components.combat:SetTarget(data.attacker)
    --inst.components.combat:ShareTarget(data.attacker, SEE_DIST, function(dude) return dude:HasTag("hound") and not dude.components.health:IsDead() end, 5)
end

    滻Ϊ

local function Retarget(inst)
    local newtarget = FindEntity(inst, 20, function(guy)
            return  guy.components.combat and 
                    inst.components.combat:CanTarget(guy) and
                    (guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy)
    end)
    return newtarget
end
local function OnAttacked(inst, data)
    local attacker = data.attacker
    if attacker and attacker:HasTag("player") then
        inst.components.health:SetVal(0)
    else
        inst.components.combat:SetTarget(attacker)
    end
end


    3.local brain = require "brains/krampusbrain"滻Ϊlocal brain = require "brains/abigailbrain"


    4.ݣ

    inst:AddComponent("sleeper")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH)
    
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "krampus_torso"
    inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE)
    inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD)

    滻Ϊ

    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(TUNING.KRAMPUS_HEALTH*10)
    inst:AddComponent("follower")
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "krampus_torso"
    inst.components.combat:SetDefaultDamage(TUNING.KRAMPUS_DAMAGE*10)
    inst.components.combat:SetAttackPeriod(TUNING.KRAMPUS_ATTACK_PERIOD*.1)
    inst.components.combat:SetRetargetFunction(3, Retarget)
    inst.AnimState:Hide("SACK")
    inst.AnimState:Show("ARM")

    װӰʱڿյϰҼٻ˹ʿ˹ȸ죬͵ֻΪԡѪսҪ˹ʱɱɣȻǿǶһ




һ.ҵС飨ûٻһս

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\torch.luaļinst:AddComponent("inspectable")һвݣ

local function cancreatelight(staff, caster, target, pos)
    local ground = GetWorld()
    if ground and pos then
        local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)
        return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND
    end
    return false
end
local function createlight(staff, target, pos)
    local light = SpawnPrefab("shadowwaxwell")
    light.Transform:SetPosition(pos.x, pos.y, pos.z)
    local caster = staff.components.inventoryitem.owner
    light.components.follower:SetLeader(caster)
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createlight)
    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true
    inst.components.spellcaster.canusefrominventory = false


    2.ü±ϷĿ¼\data\scripts\prefabs\shadowwaxwell.luaļݣ

	anim:SetBuild("waxwell_shadow_mod")
	anim:PlayAnimation("idle")

    anim:Hide("ARM_carry")
    anim:Hide("hat")
    anim:Hide("hat_hair")

    inst:AddTag("scarytoprey")
    inst:AddTag("NOCLICK")

	inst:AddComponent("colourtweener")
	inst.components.colourtweener:StartTween({0,0,0,.5}, 0)

	inst:AddComponent("locomotor")
    inst.components.locomotor:SetSlowMultiplier( 0.6 )
    inst.components.locomotor.pathcaps = { ignorecreep = true }
    inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED

    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "torso"
    -- inst.components.combat:SetRetargetFunction(1, Retarget)
    inst.components.combat:SetKeepTargetFunction(KeepTarget)
    inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD)
    inst.components.combat:SetRange(2, 3)
    inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE)

    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE)
    inst.components.health.nofadeout = true
    inst:ListenForEvent("death", ondeath)

	inst:AddComponent("inventory")
    inst.components.inventory.dropondeath = false

    inst:AddComponent("sanityaura")
    inst.components.sanityaura.penalty = TUNING.SHADOWWAXWELL_SANITY_PENALTY

    滻Ϊ

	local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
	inst.animname = names[math.random(#names)]
	anim:SetBuild(inst.animname)
	anim:PlayAnimation("idle")
    anim:Hide("ARM_carry")
    anim:Hide("hat")
    anim:Hide("hat_hair")
	inst:AddComponent("locomotor")
    inst.components.locomotor.pathcaps = { ignorecreep = true }
    inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED*2
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "torso"
    inst.components.combat:SetKeepTargetFunction(KeepTarget)
    inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD*.1)
    inst.components.combat:SetRange(2, 3)
    inst.components.combat:SetDefaultDamage(TUNING.SHADOWWAXWELL_DAMAGE*10)
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE*10)
    inst.components.health.nofadeout = true
	inst:AddComponent("inventory")
    inst.components.inventory.dropondeath = false

    װڿյϵҼٻǣһսҪʱ䰴Ctrl + ɱɣɱҲȻȥҪٻɡҪ롰ٻ顱һͬ޸ģʹ˹ʱҪ޸ı




һ.˫ǣóֳﹷúֳﺣ꣩

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\gears.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local dog = SpawnPrefab("teenbird")
    dog.Transform:SetPosition(pt.x, pt.y, pt.z)
    dog.AnimState:SetBank("hound")
    dog.AnimState:SetBuild("hound_ice")
    dog:SetStateGraph("SGhound")
    dog.components.follower:SetLeader(GetPlayer())
    dog.Transform:SetScale(0.6, 0.6, 0.6)
    dog:AddTag("dogs")
    dog.components.health:SetMaxHealth(10000)
    dog.components.locomotor.runspeed = 20
    dog:RemoveComponent("growable")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\scripts\prefabs\walrus_tusk.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local beaver = SpawnPrefab("teenbird")
    beaver.Transform:SetPosition(pt.x, pt.y, pt.z)
    beaver.AnimState:SetBank("werebeaver")
    beaver.AnimState:SetBuild("werebeaver_build")
    beaver:SetStateGraph("SGwerebeaver")
    beaver.components.follower:SetLeader(GetPlayer())
    beaver.Transform:SetScale(0.6, 0.6, 0.6)
    beaver:AddTag("beavers")
    beaver.components.eater:SetVegetarian()
    beaver.components.health:SetMaxHealth(10000)
    beaver.components.locomotor.runspeed = 20
    beaver:RemoveComponent("growable")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\smallbird.luaļAsset("ANIM", "anim/smallbird_basic.zip"),һвݣ

    Asset("ANIM", "anim/werebeaver_build.zip"),
    Asset("ANIM", "anim/werebeaver_basic.zip"),


    4.inst:AddTag("teenbird")һвݣ

local function onsave(inst, data)
    if inst:HasTag("dogs") then
        data.dogs = true
    end
    if inst:HasTag("beavers") then
        data.beavers = true
    end
end
local function onload(inst, data)
    if data.dogs then
       inst.AnimState:SetBank("hound")
       inst.AnimState:SetBuild("hound_ice")
       inst:SetStateGraph("SGhound")
       inst.components.follower:SetLeader(GetPlayer())
       inst.Transform:SetScale(0.6, 0.6, 0.6)
       inst.components.health:SetMaxHealth(10000)
       inst.components.locomotor.runspeed = 20
       inst:RemoveComponent("growable")
       inst:AddTag("dogs")
    end
    if data.beavers then
       inst.AnimState:SetBank("werebeaver")
       inst.AnimState:SetBuild("werebeaver_build")
       inst:SetStateGraph("SGwerebeaver")
       inst.components.follower:SetLeader(GetPlayer())
       inst.Transform:SetScale(0.6, 0.6, 0.6)
       inst.components.health:SetMaxHealth(10000)
       inst.components.eater:SetVegetarian()
       inst.components.locomotor.runspeed = 20
       inst:RemoveComponent("growable")
       inst:AddTag("beavers")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    óֳﹷúֳﺣ꣬ǿ㣬֣ǻʮСҪιʳȻҧ㣨ģﹷϲ⣬ﺣϲ߲ˣͨιʳΪǲѪڼҵĽһЩʳ




һ.ڴӣ÷۱ֺӣ׽ӡС

    ü±ϷĿ¼\data\scripts\prefabs\bandage.luaļinst:AddComponent("inventoryitem")һвݣ

local function OnDeploy (inst, pt)
    local helper = SpawnPrefab("bandage")
    helper.Transform:SetPosition(pt.x, pt.y, pt.z)
    helper.AnimState:SetBank("kiki")
    helper.AnimState:SetBuild("kiki_basic")
    helper.AnimState:PlayAnimation("idle_loop", true)
    helper.Transform:SetFourFaced()
    helper.Transform:SetScale(0.8, 0.8, 0.8)
    helper:RemoveComponent("stackable")
    helper:RemoveComponent("healer")
    local sound = helper.entity:AddSoundEmitter()	
    helper.soundtype = ""
    local brain = require "brains/abigailbrain"
    helper:SetBrain(brain)
    helper:AddComponent("locomotor")
    helper.components.locomotor:SetTriggersCreep(false)
    helper.components.locomotor.pathcaps = { ignorecreep = false }
    helper.components.locomotor.walkspeed = 12
    helper:SetStateGraph("SGmonkey")
    helper:AddComponent("follower")
    GetPlayer().components.leader:AddFollower(helper)
    helper:AddComponent("combat")
    helper.components.combat.hiteffectsymbol = "torso"
    helper.components.combat:SetRetargetFunction(1, function(helper)
        if not helper.components.health:IsDead() then
            return FindEntity(helper, 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole"
                end
            end)
        end
    end )
    helper.components.combat:SetKeepTargetFunction(function(helper, target) return target and target:IsValid() end )
    helper.components.combat:SetAttackPeriod(1)
    helper.components.combat:SetRange(1, 2)
    helper.components.combat:SetDefaultDamage(1)
    helper.components.combat.onhitotherfn = function(helper, other, damage)
        if other.prefab == "crow" then
           local prey = SpawnPrefab("crow")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "robin" then
           local prey = SpawnPrefab("robin")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "robin_winter" then
           local prey = SpawnPrefab("robin_winter")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "bee" then
           local prey = SpawnPrefab("bee")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "killerbee" then
           local prey = SpawnPrefab("killerbee")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "rabbit" then
           local prey = SpawnPrefab("rabbit")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "butterfly" then
           local prey = SpawnPrefab("butterfly")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "mole" then
           local prey = SpawnPrefab("mole")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        other:Remove()
    end
    helper:AddComponent("health")
    helper.components.health:SetMaxHealth(1000)
    helper.components.health:SetInvincible(true)
    helper.components.health.nofadeout = true
    helper.components.inventoryitem:ChangeImageName("cave_banana")
    helper:AddComponent( "playerprox" )
    helper.components.playerprox:SetDist(3,5)
    helper.components.playerprox:SetOnPlayerNear(function(helper) helper.components.locomotor.walkspeed = 5 end )
    helper.components.playerprox:SetOnPlayerFar(function(helper) helper.components.locomotor.walkspeed = 12 end )
    helper:AddTag("helpers")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

local function onsave(inst, data)
    if inst:HasTag("helpers") then
        data.helpers = true
    end
end
local function onload(inst, data)
  if data and data.helpers then
    inst.AnimState:SetBank("kiki")
    inst.AnimState:SetBuild("kiki_basic")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.Transform:SetFourFaced()
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("healer")
    local sound = inst.entity:AddSoundEmitter()	
    inst.soundtype = ""
    local brain = require "brains/abigailbrain"
    inst:SetBrain(brain)
    inst:AddComponent("locomotor")
    inst.components.locomotor:SetTriggersCreep(false)
    inst.components.locomotor.pathcaps = { ignorecreep = false }
    inst.components.locomotor.walkspeed = 12
    inst:SetStateGraph("SGmonkey")
    inst:AddComponent("follower")
    GetPlayer().components.leader:AddFollower(inst)
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "torso"
    inst.components.combat:SetRetargetFunction(1, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.prefab == "crow" or guy.prefab == "robin" or guy.prefab == "robin_winter" or guy.prefab == "bee" or guy.prefab == "killerbee" or guy.prefab == "rabbit" or guy.prefab == "butterfly" or guy.prefab == "mole"
                end
            end)
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst.components.combat:SetAttackPeriod(1)
    inst.components.combat:SetRange(1, 2)
    inst.components.combat:SetDefaultDamage(1)
    inst.components.combat.onhitotherfn = function(inst, other, damage)
        if other.prefab == "crow" then
           local prey = SpawnPrefab("crow")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "robin" then
           local prey = SpawnPrefab("robin")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "robin_winter" then
           local prey = SpawnPrefab("robin_winter")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "bee" then
           local prey = SpawnPrefab("bee")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "killerbee" then
           local prey = SpawnPrefab("killerbee")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "rabbit" then
           local prey = SpawnPrefab("rabbit")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "butterfly" then
           local prey = SpawnPrefab("butterfly")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        if other.prefab == "mole" then
           local prey = SpawnPrefab("mole")
           GetPlayer().components.inventory:GiveItem(prey)
        end
        other:Remove()
    end
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(1000)
    inst.components.health:SetInvincible(true)
    inst.components.health.nofadeout = true
    inst.components.inventoryitem:ChangeImageName("cave_banana")
    inst:AddComponent( "playerprox" )
    inst.components.playerprox:SetDist(3,5)
    inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end )
    inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end )
    inst:AddTag("helpers")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ÷۱ֺӣӣɽƷʾΪ㽶ͼ꣩ڸӡ۷䡢ɱ˷䡢СʱɽӷڵϣΪ㲶׽Сͬʱ޸ˡϳꡱͿԽ׽СƽҪˣƷж䰴Ҽɡ۱ѡף£1ֽ2




һ.ڴܣֽֿڴܣԡսð֣ιܣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\papyrus.luaļinst:AddComponent("inventoryitem")һвݣ

local function OnDeploy (inst, pt)
    local coon = SpawnPrefab("papyrus")
    coon.Transform:SetPosition(pt.x, pt.y, pt.z)
    coon.AnimState:SetBank("catcoon")
    coon.AnimState:SetBuild("catcoon_build")
    coon.AnimState:PlayAnimation("idle_loop")
    coon.Transform:SetFourFaced()
    coon.Transform:SetScale(0.8, 0.8, 0.8)
    coon.entity:AddSoundEmitter()
    local shadow = coon.entity:AddDynamicShadow()
    shadow:SetSize(2,0.75)
    coon:RemoveComponent("stackable")
    coon:RemoveComponent("fuel")
    coon:RemoveComponent("tradable")
    coon:RemoveComponent("burnable")
    coon:RemoveComponent("propagator")
    coon:RemoveComponent("deployable")
    coon:RemoveTag("cattoy")
    coon.components.inventoryitem:ChangeImageName("catcoonhat")
    coon:AddComponent("named")
    coon.components.named:SetName("Catcoon")
    coon:AddComponent("follower")
    coon.components.follower:SetLeader(GetPlayer())
    coon:AddComponent("locomotor")
    coon.components.locomotor.walkspeed = 12
    coon:SetStateGraph("SGcatcoon")
    local brain = require "brains/abigailbrain"
    coon:SetBrain(brain)
    coon:AddComponent("health")
    coon.components.health:SetMaxHealth(3000)
    coon:AddComponent("lootdropper")
    coon.components.lootdropper:SetLoot({"smallmeat"})
    coon:AddComponent("combat")
    coon.components.combat:SetDefaultDamage(50)
    coon.components.combat:SetRange(4)
    coon.components.combat:SetAttackPeriod(0.5)
    coon.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt")
    coon.components.combat.battlecryinterval = 20
    coon.components.combat:SetRetargetFunction(1, function(coon)
        if not coon.components.health:IsDead() then
            return FindEntity(GetPlayer(), 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature")
                end
            end)
        end
    end )
    coon.components.combat:SetKeepTargetFunction(function(coon, target) return target and target:IsValid() end )
    coon:ListenForEvent("attacked", function(coon, data)
        if data.attacker ~= GetPlayer() then
           coon.components.combat:SetTarget(data.attacker)
        else
           coon.components.health:Kill()
        end
    end )
    coon:AddComponent( "playerprox" )
    coon.components.playerprox:SetDist(3,5)
    coon.components.playerprox:SetOnPlayerNear(function(coon) coon.components.locomotor.walkspeed = 5 end )
    coon.components.playerprox:SetOnPlayerFar(function(coon) coon.components.locomotor.walkspeed = 12 end )
    coon:AddComponent("trader")
    coon.components.trader:SetAcceptTest(function(coon, item)
        if not coon:HasTag("supercoon") then
           if item.prefab == "fish" then
              return true
           end
           if item.prefab == "smallmeat" then
              return coon.components.health:GetPercent() < 1
           end
        end
        return false
    end )
    coon.components.trader.onaccept = function(coon, giver, item)
        if item.prefab == "fish" then
           coon:AddTag("supercoon")
           coon.components.named:SetName("SuperCatcoon")
           SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition())
           coon.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           coon.Transform:SetScale(1.3, 1.3, 1.3)
           coon.components.inventoryitem.canbepickedup = false
           coon.components.health:SetInvincible(true)
           coon.components.combat:SetDefaultDamage(500)
           coon:DoTaskInTime(60, function(coon)
               coon:RemoveTag("supercoon")
               coon.components.named:SetName("Catcoon")
               SpawnPrefab("collapse_big").Transform:SetPosition(coon.Transform:GetWorldPosition())
               coon.AnimState:SetBloomEffectHandle("")
               coon.Transform:SetScale(0.8, 0.8, 0.8)
               coon.components.inventoryitem.canbepickedup = true
               coon.components.health:SetInvincible(false)
               coon.components.combat:SetDefaultDamage(50)
           end )
        end
        if item.prefab == "smallmeat" then
           coon.components.health:DoDelta(1000)
        end
    end
    coon:AddTag("coons")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("coons") then
        data.coons = true
    end
end
local function onload(inst, data)
  if data and data.coons then
    inst.AnimState:SetBank("catcoon")
    inst.AnimState:SetBuild("catcoon_build")
    inst.AnimState:PlayAnimation("idle_loop")
    inst.Transform:SetFourFaced()
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize(2,0.75)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("cattoy")
    inst.components.inventoryitem:ChangeImageName("catcoonhat")
    inst:AddComponent("named")
    inst.components.named:SetName("Catcoon")
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 12
    inst:SetStateGraph("SGcatcoon")
    local brain = require "brains/abigailbrain"
    inst:SetBrain(brain)
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(3000)
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(50)
    inst.components.combat:SetRange(4)
    inst.components.combat:SetAttackPeriod(0.5)
    inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/catcoon/hurt")
    inst.components.combat.battlecryinterval = 20
    inst.components.combat:SetRetargetFunction(1, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(GetPlayer(), 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") or guy:HasTag("smallcreature")
                end
            end)
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:ListenForEvent("attacked", function(inst, data)
        if data.attacker ~= GetPlayer() then
           inst.components.combat:SetTarget(data.attacker)
        else
           inst.components.health:Kill()
        end
    end )
    inst:AddComponent( "playerprox" )
    inst.components.playerprox:SetDist(3,5)
    inst.components.playerprox:SetOnPlayerNear(function(inst) inst.components.locomotor.walkspeed = 5 end )
    inst.components.playerprox:SetOnPlayerFar(function(inst) inst.components.locomotor.walkspeed = 12 end )
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item)
        if not inst:HasTag("supercoon") then
           if item.prefab == "fish" then
              return true
           end
           if item.prefab == "smallmeat" then
              return inst.components.health:GetPercent() < 1
           end
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        if item.prefab == "fish" then
           inst:AddTag("supercoon")
           inst.components.named:SetName("SuperCatcoon")
           SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst.Transform:SetScale(1.3, 1.3, 1.3)
           inst.components.inventoryitem.canbepickedup = false
           inst.components.health:SetInvincible(true)
           inst.components.combat:SetDefaultDamage(500)
           inst:DoTaskInTime(60, function(inst)
               inst:RemoveTag("supercoon")
               inst.components.named:SetName("Catcoon")
               SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
               inst.AnimState:SetBloomEffectHandle("")
               inst.Transform:SetScale(0.8, 0.8, 0.8)
               inst.components.inventoryitem.canbepickedup = true
               inst.components.health:SetInvincible(false)
               inst.components.combat:SetDefaultDamage(50)
           end )
        end
        if item.prefab == "smallmeat" then
           inst.components.health:DoDelta(1000)
        end
    end
    inst:AddTag("coons")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ֽֿڴܣ㲶ԡսܣɽƷʾΪñͼ꣩ιС⣬Ϊ䲹Ѫ3ɲι㣬ܣˣ1060ڳ״̬£ڴ޷ҲʳҪڴˣƷж䰴ҼɡֽھѡŰɫʯ£4«έ




һ.ţôʯţƷԶУɿ󡢿

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\inv_marble.luaļinst:AddComponent("inspectable")һвݣ

local slotpos = {}
for y = 4, 0, -1 do
    for x = 0, 14 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
local sounds = 
{
    walk = "dontstarve/beefalo/walk",
    grunt = "dontstarve/beefalo/grunt",
    yell = "dontstarve/beefalo/yell",
    swish = "dontstarve/beefalo/tail_swish",
    curious = "dontstarve/beefalo/curious",
    angry = "dontstarve/beefalo/angry",
}
local function OnDeploy (inst, pt)
    local bull = SpawnPrefab("marble")
    bull.Transform:SetPosition(pt.x, pt.y, pt.z)
    bull.AnimState:SetBank("beefalo")
    bull.AnimState:SetBuild("beefalo_build")
    bull.AnimState:PlayAnimation("idle_loop", true)
    bull.Transform:SetFourFaced()
    bull.Transform:SetScale(0.8, 0.8, 0.8)
    local sound = bull.entity:AddSoundEmitter()
    bull.sounds = sounds
    local shadow = bull.entity:AddDynamicShadow()
    shadow:SetSize( 3, 1.25 )
    MakeCharacterPhysics(bull, 100, 1.5)
    bull:AddTag("bull")
    bull:AddTag("companion")
    bull:AddComponent("locomotor")
    bull.components.locomotor.walkspeed = 1.5
    bull.components.locomotor.runspeed = 15
    bull:SetStateGraph("SGBeefalo")
    bull:AddComponent("follower")
    bull:AddComponent("knownlocations")
    bull.components.container.canbeopened = true
    bull:AddComponent("combat")
    bull:AddComponent("health")
    bull.components.health:SetMaxHealth(10000)
    bull.components.health:SetInvincible(true)
    bull.components.health.nofadeout = true
    bull:RemoveComponent("stackable")
    bull:RemoveComponent("inventoryitem")
    bull:RemoveComponent("bait")
    bull:RemoveTag("molebait")
    bull:AddComponent("workable")
    bull.components.workable:SetWorkAction(ACTIONS.CHOP)
    bull.components.workable:SetWorkLeft(3)
    bull.components.workable:SetOnFinishCallback(function(bull)
        bull.AnimState:PlayAnimation("death")
        bull.SoundEmitter:PlaySound("dontstarve/beefalo/yell")
        bull:DoTaskInTime(1.5, function() bull.components.container:DropEverything() bull:Remove() end)
    end )
    bull:DoPeriodicTask(1, function(bull)
        if not bull.components.container:Has("cutgrass", 1) then
           bull.components.locomotor:Stop()
           bull:SetBrain(nil)
           bull.components.follower:SetLeader(nil)
           bull:RemoveTag("letgo")
        else
           local brain = require "brains/chesterbrain"
           bull:SetBrain(brain)
           bull:RestartBrain()
           bull.components.follower:SetLeader(GetPlayer())
           bull:AddTag("letgo")
        end
    end )
    bull:DoPeriodicTask(180, function(bull)
        if bull.components.container:Has("cutgrass", 1) then
           bull.components.container:ConsumeByName("cutgrass", 1)
           bull.AnimState:PlayAnimation("graze_loop")
        end
    end )
    bull:DoPeriodicTask(.1, function(bull)
      if bull:HasTag("letgo") then
        local pos = Vector3(bull.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15)
        for k,v in pairs(ents) do
            local pt1 = v:GetPosition()
            if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer
               and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart")
               and not v:HasTag("projectile") and not v:HasTag("helpers") then
               if not bull.components.container:IsFull() then
                  SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                  bull.components.container:GiveItem(v)
                  bull.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
               end
            end
        end
      end
    end )
    bull.Physics:SetCollisionCallback(function(bull, other)
        if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then
           SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
           other.components.workable:Destroy(bull)
        end
    end)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("bull") then
        data.bull = true
    end
end
local function onload(inst, data)
  if data and data.bull then
    inst.AnimState:SetBank("beefalo")
    inst.AnimState:SetBuild("beefalo_build")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.Transform:SetFourFaced()
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    local sound = inst.entity:AddSoundEmitter()
    inst.sounds = sounds
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 3, 1.25 )
    MakeCharacterPhysics(inst, 100, 1.5)
    inst:AddTag("bull")
    inst:AddTag("companion")
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 1.5
    inst.components.locomotor.runspeed = 15
    inst:SetStateGraph("SGBeefalo")
    inst:AddComponent("follower")
    inst:AddComponent("knownlocations")
    inst.components.container.canbeopened = true
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(10000)
    inst.components.health:SetInvincible(true)
    inst.components.health.nofadeout = true
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("bait")
    inst:RemoveTag("molebait")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.CHOP)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        inst.AnimState:PlayAnimation("death")
        inst.SoundEmitter:PlaySound("dontstarve/beefalo/yell")
        inst:DoTaskInTime(1.5, function() inst.components.container:DropEverything() inst:Remove() end)
    end )
    inst:DoPeriodicTask(1, function(inst)
        if not inst.components.container:Has("cutgrass", 1) then
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
           inst:RemoveTag("letgo")
        else
           local brain = require "brains/chesterbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst:AddTag("letgo")
        end
    end )
    inst:DoPeriodicTask(180, function(inst)
        if inst.components.container:Has("cutgrass", 1) then
           inst.components.container:ConsumeByName("cutgrass", 1)
           inst.AnimState:PlayAnimation("graze_loop")
        end
    end )
    inst:DoPeriodicTask(.1, function(inst)
      if inst:HasTag("letgo") then
        local pos = Vector3(inst.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15)
        for k,v in pairs(ents) do
            local pt1 = v:GetPosition()
            if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer
               and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart")
               and not v:HasTag("projectile") and not v:HasTag("helpers") then
               if not inst.components.container:IsFull() then
                  SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                  inst.components.container:GiveItem(v)
                  inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
               end
            end
        end
      end
    end )
    inst.Physics:SetCollisionCallback(function(inst, other)
        if other and other.components.workable and other.components.workable.workleft > 0 and not other:HasTag("bull") then
           SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
           other.components.workable:Destroy(inst)
        end
    end)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-300,200,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst:AddTag("fridge")

    ôʯţɿӣݺ㣬ȡ·Ʒеĸȡóݺֹͣ棬ԭصȴţеĲݣÿ2-3еĲݱˣͲ㣬ֱٸΪֹţײʯͷײƷֱУȥ󡢿ɡҪţĽὫײ٣ǨҪţʱøӿ¼ɣƷڵ




һŰ.ҿţţҿţΪ㿱̽ʯ

    ü±ϷĿ¼\data\scripts\prefabs\armor_snurtleshell.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local snail = SpawnPrefab("armorsnurtleshell")
    snail.Transform:SetPosition(pt.x, pt.y, pt.z)
    snail.AnimState:SetBank("slurtle")
    snail.AnimState:SetBuild("slurtle")
    snail.AnimState:PlayAnimation("idle", true)
    snail.Transform:SetFourFaced()
    local sound = snail.entity:AddSoundEmitter()
    local brain = require "brains/leifbrain"
    snail:SetBrain(brain)
    snail:AddComponent("locomotor")
    snail.components.locomotor.walkspeed = 7
    snail:SetStateGraph("SGslurtle")
    local minimap = snail.entity:AddMiniMapEntity()
    minimap:SetIcon( "slurtle_den.png" )
    snail.components.inventoryitem:ChangeImageName("armorsnurtleshell")
    snail:RemoveComponent("armor")
    snail:RemoveComponent("equippable")
    snail:RemoveComponent("useableitem")
    snail:RemoveComponent("deployable")
    snail:RemoveTag("shell")
    snail:RemoveComponent("inventoryitem")
    snail:AddComponent("combat")
    snail:AddComponent("health")
    snail.components.health:SetMaxHealth(1000)
    snail.components.health:SetInvincible(true)
    snail.components.health.nofadeout = true
    snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail)
        local pt1 = snail:GetPosition()
        local rocks = {"rock1","rock2","rock_flintless","rock_ice"}
        local rock = rocks[math.random(#rocks)]
        local newrock = SpawnPrefab(rock)
        newrock.Transform:SetPosition(pt1.x, 0, pt1.z)
        newrock.Physics:SetActive(false)
        newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end )
        SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z)
        snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
        GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40)
    end )
    snail:AddComponent("inventoryitem")
    snail.components.inventoryitem:SetOnPutInInventoryFn(function(snail)
        snail:RemoveTag("sports")
        snail.components.locomotor:Stop()
        snail:SetBrain(nil)
        if snail.task then snail.task:Cancel() snail.task = nil end
    end )
    snail.components.inventoryitem:SetOnDroppedFn(function(snail)
        snail:AddTag("sports")
        local brain = require "brains/leifbrain"
        snail:SetBrain(brain)
        snail:RestartBrain()
        snail.task = snail:DoPeriodicTask(math.random(8,12), function(snail)
            local pt1 = snail:GetPosition()
            local rocks = {"rock1","rock2","rock_flintless","rock_ice"}
            local rock = rocks[math.random(#rocks)]
            local newrock = SpawnPrefab(rock)
            newrock.Transform:SetPosition(pt1.x, 0, pt1.z)
            newrock.Physics:SetActive(false)
            newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end )
            SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z)
            snail.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            GetPlayer().components.playercontroller:ShakeCamera(snail, "FULL", 0.2, 0.02, .25, 40)
        end )
    end )
    snail:AddTag("sports")
    snail:AddTag("companion")
    snail:AddTag("snails")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

local function onsave(inst, data)
    if inst:HasTag("snails") then
        data.snails = true
    end
    if inst:HasTag("sports") then
        data.sports = true
    end
end
local function onload(inst, data)
  if data and data.snails then
    inst.AnimState:SetBank("slurtle")
    inst.AnimState:SetBuild("slurtle")
    inst.AnimState:PlayAnimation("idle", true)
    inst.Transform:SetFourFaced()
    local sound = inst.entity:AddSoundEmitter()
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 7
    inst:SetStateGraph("SGslurtle")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "slurtle_den.png" )
    inst.components.inventoryitem:ChangeImageName("armorsnurtleshell")
    inst:RemoveComponent("armor")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("useableitem")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("shell")
    inst:RemoveComponent("inventoryitem")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(1000)
    inst.components.health:SetInvincible(true)
    inst.components.health.nofadeout = true
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst)
        inst:RemoveTag("sports")
        inst.components.locomotor:Stop()
        inst:SetBrain(nil)
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst.components.inventoryitem:SetOnDroppedFn(function(inst)
        inst:AddTag("sports")
        local brain = require "brains/leifbrain"
        inst:SetBrain(brain)
        inst:RestartBrain()
        inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst)
            local pt1 = inst:GetPosition()
            local rocks = {"rock1","rock2","rock_flintless","rock_ice"}
            local rock = rocks[math.random(#rocks)]
            local newrock = SpawnPrefab(rock)
            newrock.Transform:SetPosition(pt1.x, 0, pt1.z)
            newrock.Physics:SetActive(false)
            newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end )
            SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z)
            inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
        end )
    end )
    inst:AddTag("companion")
    inst:AddTag("snails")
  end
  if data and data.sports then
    local brain = require "brains/leifbrain"
    inst:SetBrain(brain)
    inst:RestartBrain()
    inst.task = inst:DoPeriodicTask(math.random(8,12), function(inst)
        local pt1 = inst:GetPosition()
        local rocks = {"rock1","rock2","rock_flintless","rock_ice"}
        local rock = rocks[math.random(#rocks)]
        local newrock = SpawnPrefab(rock)
        newrock.Transform:SetPosition(pt1.x, 0, pt1.z)
        newrock.Physics:SetActive(false)
        newrock:DoTaskInTime(3, function(newrock) newrock.Physics:SetActive(true) end )
        SpawnPrefab("splash_ocean").Transform:SetPosition(pt1.x, 0, pt1.z)
        inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
        GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
    end )
    inst:AddTag("sports")
    local pt2 = GetPlayer():GetPosition()
    inst.Transform:SetPosition(pt2.x+1, 0, pt2.z+1)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ţҿţţɽƷʾΪţ׵ͼ꣩ڿտĵϷҿţΪ㿱̽µʯʯͷӴ˳ΪԴҿţֻרעҿ󣬲㣬ŪˣҲˣ浵˳ٶߡҪҿţʱƷж䰴Ҽɡţ׿ڵһţʱã޸ˡͳСҲԻ9-11ƽ




һž.˹Ůѣ÷Ů֮һɱñ

    ü±ϷĿ¼\data\scripts\prefabs\stinger.luaļ

    1.Asset("ANIM", "anim/stinger.zip"),һвݣ

    Asset("ANIM", "anim/wathgrithr.zip"),
    Asset("SOUND", "sound/wathgrithr.fsb"),


    2.inst:AddComponent("inspectable")һвݣ

local slotpos = {}
for y = 5, 0, -1 do
    for x = 0, 2 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
local widgetbuttoninfo = {
    text = "Do",
    position = Vector3(68, 361, 0),
    fn = function(inst)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
        if not inst:HasTag("withme") then
           inst:AddTag("withme")
           local brain = require "brains/chesterbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
        else
           inst:RemoveTag("withme")
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
        end
end }
local function OnDeploy (inst, pt)
    local girl = SpawnPrefab("stinger")
    girl.Transform:SetPosition(pt.x, pt.y, pt.z)
    girl.AnimState:SetBank("wilson")
    local girlnames = {"wendy","willow","wathgrithr"}
    girl.buildname = girlnames[math.random(#girlnames)]
    girl.AnimState:SetBuild(girl.buildname)
    girl.AnimState:PlayAnimation("idle")
    girl.AnimState:Show("ARM_normal") 
    girl.AnimState:Hide("ARM_carry")
    girl.Transform:SetFourFaced()
    girl.entity:AddSoundEmitter()
    local shadow = girl.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    MakeCharacterPhysics(girl, 75, .5)
    local minimap = girl.entity:AddMiniMapEntity()
    minimap:SetIcon( "wendy.png" )
    girl:RemoveComponent("stackable")
    girl:RemoveComponent("inventoryitem")
    girl:RemoveComponent("deployable")
    girl:AddComponent("named")
    girl.components.named:SetName("My Baby")
    girl:AddComponent("knownlocations")
    girl:AddComponent("follower")
    girl.components.follower:SetLeader(GetPlayer())
    girl:AddComponent("inventory")
    girl.components.container.canbeopened = true
    girl:AddComponent("locomotor")
    girl.components.locomotor.walkspeed = 8
    girl.components.locomotor.runspeed = 12
    girl:SetStateGraph("SGshadowwaxwell")
    local brain = require "brains/chesterbrain"
    girl:SetBrain(brain)
    girl:AddComponent("combat")
    girl:AddComponent("health")
    girl.components.health:SetMaxHealth(2000)
    girl:ListenForEvent("death", function()
        girl.components.container:DropEverything()
    end )
    girl:AddComponent("talker")
    girl:DoPeriodicTask(60, function()
        local words = {"I love you","You are my love","I like you","I want stay with you","I miss you","you are my darling","I am your sweetheart","You have to love me","Don't go","Are you hungry"}
        local word = words[math.random(#words)]
        girl.components.talker:Say(word, 4, false)
        girl.components.health:DoDelta(2000)
    end)
    girl:DoPeriodicTask(400, function()
        local names = {"waffles","turkeydinner","baconeggs"}
        local name = names[math.random(#names)]
        local foods = SpawnPrefab(name)
        girl.components.container:GiveItem(foods)
        girl.components.talker:Say("Come to eat", 4, false)
    end)
    girl:AddComponent("machine")
    girl.components.machine.turnonfn = function(girl)
        girl.components.machine.ison = true
        girl:AddTag("neat")
        local hats = {"hat_flower","hat_earmuffs","hat_feather","hat_slurper","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_beefalo","hat_rain","hat_catcoon"}
        girl.hat = hats[math.random(#hats)]
        local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"}
        girl.armor = armors[math.random(#armors)]
        girl.sg:GoToState("hit")
        girl.AnimState:OverrideSymbol("swap_hat", girl.hat, "swap_hat")
        girl.AnimState:OverrideSymbol("swap_body", girl.armor, "swap_body")
        girl.AnimState:Show("HAT")
        girl.AnimState:Show("HAT_HAIR")
        girl.AnimState:Hide("HAIR_NOHAT")
        girl.AnimState:Hide("HAIR")
        local words = {"I like it","I don't loke it"}
        local word = words[math.random(#words)]
        girl.components.talker:Say(word, 4, false)
    end
    girl.components.machine.turnofffn = function(girl)
        girl.components.machine.ison = false
        girl:RemoveTag("neat")
        girl.sg:GoToState("stunned")
        girl.AnimState:Hide("HAT")
        girl.AnimState:Hide("HAT_HAIR")
        girl.AnimState:Show("HAIR_NOHAT")
        girl.AnimState:Show("HAIR")
        girl.AnimState:ClearOverrideSymbol("swap_body")
        girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt")
        girl.components.talker:Say("Don't, Don't, Don't", 4, false)
    end
    girl:AddComponent("sanityaura")
    girl.components.sanityaura.aura = TUNING.SANITYAURA_HUGE
    girl:ListenForEvent("attacked", function(girl, data)
       girl.sg:GoToState("stunned")
       girl.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt")
       girl.components.talker:Say("Don't, Don't, Don't", 4, false)
    end )
    girl:AddTag("fridge")
    girl:AddTag("withme")
    girl:AddTag("companion")
    girl:AddTag("girls")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddComponent("container")
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,150,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
local function onsave(inst, data)
    if inst:HasTag("girls") then
        data.girls = true
    end
    if inst:HasTag("withme") then
        data.withme = true
    end
    if inst:HasTag("neat") then
        data.neat = true
    end
    data.buildname = inst.buildname
    data.hat = inst.hat
    data.armor = inst.armor
end
local function onload(inst, data)
  if data and data.girls then
    inst.AnimState:SetBank("wilson")
    local girlnames = {"wendy","willow","wathgrithr"}
    inst.buildname = girlnames[math.random(#girlnames)]
    inst.AnimState:SetBuild(inst.buildname)
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:Show("ARM_normal") 
    inst.AnimState:Hide("ARM_carry")
    inst.Transform:SetFourFaced()
    inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    MakeCharacterPhysics(inst, 75, .5)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "wendy.png" )
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("deployable")
    inst:AddComponent("named")
    inst.components.named:SetName("My Baby")
    inst:AddComponent("knownlocations")
    inst:AddComponent("follower")
    inst:AddComponent("inventory")
    inst.components.container.canbeopened = true
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 8
    inst.components.locomotor.runspeed = 12
    inst:SetStateGraph("SGshadowwaxwell")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(2000)
    inst:ListenForEvent("death", function()
        inst.components.container:DropEverything()
    end )
    inst:AddComponent("talker")
    inst:DoPeriodicTask(60, function()
        local words = {"I love you","You are my love","I like you","I want stay with you","I miss you","you are my darling","I am your sweetheart","You have to love me","Don't go","Are you hungry"}
        local word = words[math.random(#words)]
        inst.components.talker:Say(word, 4, false)
        inst.components.health:DoDelta(2000)
    end)
    inst:DoPeriodicTask(400, function()
        local names = {"waffles","turkeydinner","baconeggs"}
        local name = names[math.random(#names)]
        local foods = SpawnPrefab(name)
        inst.components.container:GiveItem(foods)
        inst.components.talker:Say("Come to eat", 4, false)
    end)
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = function(inst)
        inst.components.machine.ison = true
        inst:AddTag("neat")
        local hats = {"hat_flower","hat_earmuffs","hat_feather","hat_slurper","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_beefalo","hat_rain","hat_catcoon"}
        inst.hat = hats[math.random(#hats)]
        local armors = {"armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_sanity","armor_slurper","torso_rain"}
        inst.armor = armors[math.random(#armors)]
        inst.sg:GoToState("hit")
        inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat")
        inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body")
        inst.AnimState:Show("HAT")
        inst.AnimState:Show("HAT_HAIR")
        inst.AnimState:Hide("HAIR_NOHAT")
        inst.AnimState:Hide("HAIR")
        local words = {"I like it","I don't loke it"}
        local word = words[math.random(#words)]
        inst.components.talker:Say(word, 4, false)
    end
    inst.components.machine.turnofffn = function(inst)
        inst.components.machine.ison = false
        inst:RemoveTag("neat")
        inst.sg:GoToState("stunned")
        inst.AnimState:Hide("HAT")
        inst.AnimState:Hide("HAT_HAIR")
        inst.AnimState:Show("HAIR_NOHAT")
        inst.AnimState:Show("HAIR")
        inst.AnimState:ClearOverrideSymbol("swap_body")
        inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt")
        inst.components.talker:Say("Don't, Don't, Don't", 4, false)
    end
    inst:AddComponent("sanityaura")
    inst.components.sanityaura.aura = TUNING.SANITYAURA_HUGE
    inst:ListenForEvent("attacked", function(inst, data)
       inst.sg:GoToState("stunned")
       inst.SoundEmitter:PlaySound("dontstarve/characters/wendy/hurt")
       inst.components.talker:Say("Don't, Don't, Don't", 4, false)
    end )
    inst:AddTag("fridge")
    inst:AddTag("companion")
    inst:AddTag("girls")
  end
  if data and data.withme then
    inst:AddTag("withme")
    local brain = require "brains/chesterbrain"
    inst:SetBrain(brain)
    inst:RestartBrain()
    inst.components.follower:SetLeader(GetPlayer())
  end
  if data and data.neat then
    inst.components.machine.ison = true
    inst:AddTag("neat")
    inst.AnimState:Show("HAT")
    inst.AnimState:Show("HAT_HAIR")
    inst.AnimState:Hide("HAIR_NOHAT")
    inst.AnimState:Hide("HAIR")
    if data and data.hat then
       inst.hat = data.hat
       inst.AnimState:OverrideSymbol("swap_hat", inst.hat, "swap_hat")
    end
    if data and data.armor then
       inst.armor = data.armor
       inst.AnimState:OverrideSymbol("swap_body", inst.armor, "swap_body")
    end
  end
  if data and data.buildname then
     inst.buildname = data.buildname
     inst.AnimState:SetBuild(inst.buildname)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ÷˹ŮѣΪµ١ޱ塢˿˹֮һŮѣɴı18񣩣㱳ıعܡϷġDoťŮͣԭأٴε㡰Doťɼ棬Źٸ㣬Ҳͨ㡰Doť档ҼŮѣΪñٴεñõñһֱϣܴӰ졣ÿŮѻΪһıȡŮѻ᲻ʱ˵˿Բԣٹ¶ˣŮûսˣҪŶҲѡܣŬģˣƷڵϡҪŮˣɱɣCtrl + Ҫ롰÷ɱ˷ѡһͬ޸




.ӣȥӽӰ࣬һһȥ

    1.ü±ϷĿ¼\data\scripts\prefabs\minotaurhorn.luaļinst:AddComponent("inspectable")һвݣ

local function getson (inst)
    TheFrontEnd:Fade(false,1)
  GetPlayer():DoTaskInTime(1.5, function()
    TheFrontEnd:Fade(true,1)
    local pt = GetPlayer():GetPosition()
    local son = SpawnPrefab("resurrectionstatue")
    son.Transform:SetPosition(pt.x, pt.y, pt.z)
    son.AnimState:SetBank("wilson")
    if GetPlayer().prefab == "wilson" then son.AnimState:SetBuild("wilson") end
    if GetPlayer().prefab == "wendy" then son.AnimState:SetBuild("wendy") end
    if GetPlayer().prefab == "wes" then son.AnimState:SetBuild("wes") end
    if GetPlayer().prefab == "wickerbottom" then son.AnimState:SetBuild("wickerbottom") end
    if GetPlayer().prefab == "willow" then son.AnimState:SetBuild("willow") end
    if GetPlayer().prefab == "wolfgang" then son.AnimState:SetBuild("wolfgang_skinny") end
    if GetPlayer().prefab == "wx78" then son.AnimState:SetBuild("wx78") end
    if GetPlayer().prefab == "woodie" then son.AnimState:SetBuild("woodie") end
    if GetPlayer().prefab == "waxwell" then son.AnimState:SetBuild("waxwell") end
    if GetPlayer().prefab == "wathgrithr" then son.AnimState:SetBuild("wathgrithr") end
    if GetPlayer().prefab == "webber" then son.AnimState:SetBuild("webber") end
    local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"}
    local hat = hats[math.random(#hats)]
    son.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
    local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"}
    local armor = armors[math.random(#armors)]
    son.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
    son.AnimState:Show("HAT")
    son.AnimState:Show("HAT_HAIR")
    son.AnimState:Hide("HAIR_NOHAT")
    son.AnimState:Hide("HAIR")
    son.AnimState:Hide("ARM_carry")
    son.AnimState:Show("ARM_normal")
    son.AnimState:PlayAnimation("idle")
    son.AnimState:Hide("snow")
    son.Transform:SetFourFaced()
    son.Transform:SetScale(0.8,0.8,0.8)
    son:AddComponent("combat")
    son.components.combat.hiteffectsymbol = "torso"
    son.components.combat:SetRetargetFunction(3, function(son)
        if not son.components.health:IsDead() then
            return FindEntity(son, 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy
                end
            end)
        end
    end )
    son.components.combat:SetKeepTargetFunction(function(son, target) return target and target:IsValid() end )
    son.components.combat:SetAttackPeriod(1)
    son.components.combat:SetRange(2, 3)
    son.components.combat:SetDefaultDamage(10)
    son:AddComponent("health")
    son.components.health:SetMaxHealth(1000)
    son.components.health.nofadeout = true
    son:AddComponent("inventory")
    son.components.inventory.dropondeath = false
    son:AddComponent("locomotor")
    son.components.locomotor.pathcaps = { ignorecreep = true }
    son.components.locomotor.runspeed = 12
    local brain = require"brains/shadowwaxwellbrain"
    son:SetBrain(brain)
    son:SetStateGraph("SGshadowwaxwell")
    son:RemoveComponent("lootdropper")
    son:RemoveComponent("workable")
    son:RemoveComponent("burnable")
    son:RemoveComponent("propagator")
    MakeCharacterPhysics(son, 75, .5)
    son:RemoveTag("structure")
    son:AddComponent("follower")
    son.components.follower.leader = GetPlayer()
    son:AddComponent("trader")
    son.components.trader:SetAcceptTest(function(son, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" and son.components.health and not son.components.health:IsDead() then
              return son.components.health:GetPercent() < .99
           end
        end
        return false
    end )
    son.components.trader.onaccept = function(son, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        son.components.health:DoDelta(1000)
    end
    son:AddComponent("machine")
    son.components.machine.turnonfn = function() son.components.locomotor:Stop() son.brain:Stop() end
    son.components.machine.turnofffn = function() son.brain:Start() end
    son:ListenForEvent("death", function()
        GetPlayer().components.sanity:DoDelta(-100)
        SpawnPrefab("trinket_1").Transform:SetPosition(son.Transform:GetWorldPosition())
    end )
    son:AddTag("companion")
    son:AddTag("sons")
    inst:Remove()
  end )
end
local function OnDeploy (inst, pt)
  if GetPlayer().components.inventory:Has("goldnugget", 100) then
    GetPlayer().components.inventory:ConsumeByName("goldnugget", 100)
    local egg1 = SpawnPrefab("minotaurhorn")
    egg1.AnimState:SetBuild("tallbird_egg")
    egg1.AnimState:SetBank("egg")
    egg1.AnimState:PlayAnimation("egg")
    egg1.Transform:SetPosition(pt.x+2+3, pt.y, pt.z+2-3)
    egg1.AnimState:SetMultColour(0/255,255/255,0/255,1)
    egg1.Transform:SetScale(1.5,1.5,1.5)
    egg1:AddComponent("health")
    egg1.components.health:SetMaxHealth(1)
    egg1:AddComponent("combat")
    egg1:RemoveComponent("edible")
    egg1.components.inventoryitem.canbepickedup = false
    local egg2 = SpawnPrefab("minotaurhorn")
    egg2.AnimState:SetBuild("tallbird_egg")
    egg2.AnimState:SetBank("egg")
    egg2.AnimState:PlayAnimation("egg")
    egg2.Transform:SetPosition(pt.x+2-3, pt.y, pt.z+2+3)
    egg2.AnimState:SetMultColour(0/255,255/255,0/255,1)
    egg2.Transform:SetScale(1.5,1.5,1.5)
    egg2:AddComponent("health")
    egg2.components.health:SetMaxHealth(1)
    egg2:AddComponent("combat")
    egg2:RemoveComponent("edible")
    egg2.components.inventoryitem.canbepickedup = false
    egg1:ListenForEvent("death", function() egg1.AnimState:PlayAnimation("crack") egg2:Remove()
        if math.random()<.5 then
           local pt = GetPlayer():GetPosition()
           GetSeasonManager():DoLightningStrike(pt)
           inst:DoTaskInTime(1, function() getson(inst) end )
        else
           SpawnPrefab("collapse_small").Transform:SetPosition(egg1.Transform:GetWorldPosition())
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
        end
    end )
    egg2:ListenForEvent("death", function() egg2.AnimState:PlayAnimation("crack") egg1:Remove()
        if math.random()<.5 then
           local pt = GetPlayer():GetPosition()
           GetSeasonManager():DoLightningStrike(pt)
           inst:DoTaskInTime(2, function() getson(inst) end )
        else
           SpawnPrefab("collapse_small").Transform:SetPosition(egg2.Transform:GetWorldPosition())
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
        end
    end )
  end
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\resurrectionstatue.luaļݣ

	inst.OnSave = onsave 
    inst.OnLoad = onload

    滻Ϊ

local items = { AXE = "swap_axe", PICK = "swap_pickaxe", SWORD = "swap_spear" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function onsave2(inst, data)
    if inst:HasTag("sons") then
        data.sons = true
    end
end
local function onload2(inst, data)
  if data and data.sons then
    inst.AnimState:SetBank("wilson")
    if GetPlayer().prefab == "wilson" then inst.AnimState:SetBuild("wilson") end
    if GetPlayer().prefab == "wendy" then inst.AnimState:SetBuild("wendy") end
    if GetPlayer().prefab == "wes" then inst.AnimState:SetBuild("wes") end
    if GetPlayer().prefab == "wickerbottom" then inst.AnimState:SetBuild("wickerbottom") end
    if GetPlayer().prefab == "willow" then inst.AnimState:SetBuild("willow") end
    if GetPlayer().prefab == "wolfgang" then inst.AnimState:SetBuild("wolfgang_skinny") end
    if GetPlayer().prefab == "wx78" then inst.AnimState:SetBuild("wx78") end
    if GetPlayer().prefab == "woodie" then inst.AnimState:SetBuild("woodie") end
    if GetPlayer().prefab == "waxwell" then inst.AnimState:SetBuild("waxwell") end
    if GetPlayer().prefab == "wathgrithr" then inst.AnimState:SetBuild("wathgrithr") end
    if GetPlayer().prefab == "webber" then inst.AnimState:SetBuild("webber") end
    local hats = {"hat_beefalo","hat_feather","hat_flower","hat_top","hat_walrus","hat_winter"}
    local hat = hats[math.random(#hats)]
    inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
    local armors = {"armor_sanity","armor_slurper","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter"}
    local armor = armors[math.random(#armors)]
    inst.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
    inst.AnimState:Show("HAT")
    inst.AnimState:Show("HAT_HAIR")
    inst.AnimState:Hide("HAIR_NOHAT")
    inst.AnimState:Hide("HAIR")
    inst.AnimState:Hide("ARM_carry")
    inst.AnimState:Show("ARM_normal")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:Hide("snow")
    inst.Transform:SetFourFaced()
    inst.Transform:SetScale(0.8,0.8,0.8)
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "torso"
    inst.components.combat:SetRetargetFunction(3, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy
                end
            end)
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst.components.combat:SetAttackPeriod(1)
    inst.components.combat:SetRange(2, 3)
    inst.components.combat:SetDefaultDamage(10)
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(1000)
    inst.components.health.nofadeout = true
    inst:AddComponent("inventory")
    inst.components.inventory.dropondeath = false
    inst:AddComponent("locomotor")
    inst.components.locomotor.pathcaps = { ignorecreep = true }
    inst.components.locomotor.runspeed = 12
    local brain = require"brains/shadowwaxwellbrain"
    inst:SetBrain(brain)
    inst:SetStateGraph("SGshadowwaxwell")
    inst:RemoveComponent("lootdropper")
    inst:RemoveComponent("workable")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    MakeCharacterPhysics(inst, 75, .5)
    inst:RemoveTag("structure")
    inst:AddComponent("follower")
    inst.components.follower.leader = GetPlayer()
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" and inst.components.health and not inst.components.health:IsDead() then
              return inst.components.health:GetPercent() < .99
           end
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        inst.components.health:DoDelta(1000)
    end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = function() inst.components.locomotor:Stop() inst.brain:Stop() end
    inst.components.machine.turnofffn = function() inst.brain:Start() end
    inst:ListenForEvent("death", function()
        GetPlayer().components.sanity:DoDelta(-100)
        SpawnPrefab("trinket_1").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddTag("companion")
    inst:AddTag("sons")
  end
end
    inst.OnSave = onsave2
    inst.OnLoad = onload2

    ܹ100ƽʱԶػ߽ڵϣӣ2ϻƽʱֻԶػ߽ǣѡһƣˣĻһ£ͻúӣûУһֻ̣´ˡʹòͬǣòͬĺӣԴ̡ˣˣ̳ҵһһڼȥزˣ100ԣΪһССԶҪΣʱԶҼͣԭأΣųˣٶҼɼ档ͨ㻨ǮΪѪŻƽһ5ƽϻƽѪʱաעδǲµضģٺúȥˢְ




һ.˽Ҿûҩ˽ҾװסñӣҪ֧ʣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\gunpowder.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "armorgrass" or item.prefab == "armorwood" or item.prefab == "armormarble" or item.prefab == "armor_sanity" or item.prefab == "armorruins" or item.prefab == "footballhat" or item.prefab == "ruinshat" or item.prefab == "beefalohat" or item.prefab == "featherhat" or item.prefab == "goldnugget" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)}
local widgetbuttoninfo = {
    text = "Go",
    position = Vector3(0, -165, 0),
    fn = function(inst)
      if inst:HasTag("mercenary") then
         if inst.components.container:Has("goldnugget", 20) then inst:AddTag("cango") end
         inst.components.container:Close(GetPlayer())
         GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
         inst.AnimState:Hide("HAT")
         inst.AnimState:Hide("HAT_HAIR")
         inst.AnimState:Show("HAIR_NOHAT")
         inst.AnimState:Show("HAIR")
         inst.AnimState:ClearOverrideSymbol("swap_body")
         for k,v in pairs(inst.components.container.slots) do
             if v.prefab == "footballhat" or v.prefab == "ruinshat" or v.prefab == "beefalohat" or v.prefab == "featherhat" then
                inst.AnimState:Show("HAT")
                inst.AnimState:Show("HAT_HAIR")
                inst.AnimState:Hide("HAIR_NOHAT")
                inst.AnimState:Hide("HAIR")
             end
             if v and v.prefab == "armorgrass" then
                inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")
                inst:ListenForEvent("attacked", function(inst, data)
                    inst.components.health:DoDelta(15)
                end )
             end
             if v and v.prefab == "armorwood" then
                inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body")
                inst:ListenForEvent("attacked", function(inst, data)
                    inst.components.health:DoDelta(20)
                end )
             end
             if v and v.prefab == "armormarble" then
                inst.AnimState:OverrideSymbol("swap_body", "armor_marble", "swap_body")
                inst:ListenForEvent("attacked", function(inst, data)
                    inst.components.health:DoDelta(25)
                end )
             end
             if v and v.prefab == "armor_sanity" then
                inst.AnimState:OverrideSymbol("swap_body", "armor_sanity", "swap_body")
                inst:ListenForEvent("attacked", function(inst, data)
                    inst.components.health:DoDelta(30)
                end )
             end
             if v and v.prefab == "armorruins" then
                inst.AnimState:OverrideSymbol("swap_body", "armor_ruins", "swap_body")
                inst:ListenForEvent("attacked", function(inst, data)
                    inst.components.health:DoDelta(35)
                end )
             end
             if v and v.prefab == "footballhat" then
                inst.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat")
             end
             if v and v.prefab == "ruinshat" then
                inst.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat")
             end
             if v and v.prefab == "beefalohat" then
                inst.AnimState:OverrideSymbol("swap_hat", "hat_beefalo", "swap_hat")
             end
             if v and v.prefab == "featherhat" then
                inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")
             end
         end
      end
    end }
    inst:AddComponent("container")
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,180,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.itemtestfn = itemtest
    inst.components.container.onopenfn = function(inst) inst:RemoveTag("cango") end
local items = { SWORD = "swap_spear" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function OnDeploy (inst, pt)
  if GetPlayer().components.inventory:Has("goldnugget", 100) then 
    GetPlayer().components.inventory:ConsumeByName("goldnugget", 100)
    local mercenary = SpawnPrefab("gunpowder")
    mercenary.Transform:SetPosition(pt.x, pt.y, pt.z)
    mercenary.AnimState:SetBank("wilson")
    mercenary.AnimState:SetBuild("wilson")
    mercenary.AnimState:PlayAnimation("idle")
    mercenary.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
    mercenary.AnimState:Show("ARM_carry") 
    mercenary.AnimState:Hide("ARM_normal")
    mercenary.Transform:SetFourFaced()
    local shadow = mercenary.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    MakeCharacterPhysics(mercenary, 75, .5)
    local minimap = mercenary.entity:AddMiniMapEntity()
    minimap:SetIcon( "researchlab.png" )
    mercenary:AddTag("mercenary")
    mercenary:AddComponent("locomotor")
    mercenary.components.locomotor.walkspeed = 8
    mercenary.components.locomotor.runspeed = 15
    mercenary:SetStateGraph("SGshadowwaxwell")
    mercenary:RemoveComponent("stackable")
    mercenary:RemoveComponent("explosive")
    mercenary:RemoveComponent("inventoryitem")
    mercenary:RemoveComponent("burnable")
    mercenary:RemoveComponent("propagator")
    mercenary:RemoveComponent("deployable")
    mercenary:RemoveComponent("bait")
    mercenary:RemoveTag("molebait")
    mercenary:AddComponent("follower")
    mercenary:AddComponent("inventory")
    mercenary.components.container.canbeopened = true
    mercenary:AddComponent("combat")
    mercenary.components.combat.hiteffectsymbol = "torso"
    mercenary.components.combat:SetDefaultDamage(50)
    mercenary.components.combat:SetRange(2, 3)
    mercenary.components.combat:SetAttackPeriod(0.5)
    mercenary.components.combat:SetRetargetFunction(2, function(mercenary)
        if not mercenary.components.health:IsDead() then
            return FindEntity(mercenary, 25, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end)
        end
    end )
    mercenary.components.combat:SetKeepTargetFunction(function(mercenary, target) return target and target:IsValid() end )
    mercenary:AddComponent("health")
    mercenary.components.health:SetMaxHealth(1500)
    mercenary.components.health.nofadeout = true
    mercenary:DoPeriodicTask(1, function(mercenary)
      if mercenary:HasTag("cango") then
        if not mercenary.components.container:Has("goldnugget", 20) then
           mercenary.AnimState:SetBloomEffectHandle("")
           mercenary.components.locomotor:Stop()
           mercenary:SetBrain(nil)
           mercenary.components.follower:SetLeader(nil)
        else
           mercenary.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           local brain = require "brains/abigailbrain"
           mercenary:SetBrain(brain)
           mercenary:RestartBrain()
           mercenary.components.follower:SetLeader(GetPlayer())
        end
      else
         mercenary.AnimState:SetBloomEffectHandle("")
         mercenary.components.locomotor:Stop()
         mercenary:SetBrain(nil)
         mercenary.components.follower:SetLeader(nil)
      end
    end )
    mercenary:DoPeriodicTask(480, function(mercenary)
        if mercenary.components.container:Has("goldnugget", 20) then
           mercenary.components.container:ConsumeByName("goldnugget", 20)
           mercenary.components.health:DoDelta(500)
        end
    end )
    mercenary:AddComponent( "playerprox" )
    mercenary.components.playerprox:SetDist(3,5)
    mercenary.components.playerprox:SetOnPlayerNear(function(mercenary)
        mercenary.components.locomotor.walkspeed = 1
        mercenary.components.locomotor.runspeed = 2
    end )
    mercenary.components.playerprox:SetOnPlayerFar(function(mercenary)
        mercenary.components.locomotor.walkspeed = 8
        mercenary.components.locomotor.runspeed = 15
    end )
  end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("mercenary") then
        data.mercenary = true
    end
    if inst:HasTag("cango") then
        data.cango = true
    end
end
local function onload(inst, data)
  if data and data.mercenary then
    inst.AnimState:SetBank("wilson")
    inst.AnimState:SetBuild("wilson")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
    inst.AnimState:Show("ARM_carry") 
    inst.AnimState:Hide("ARM_normal")
    inst.Transform:SetFourFaced()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    MakeCharacterPhysics(inst, 75, .5)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "researchlab.png" )
    inst:AddTag("mercenary")
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 8
    inst.components.locomotor.runspeed = 15
    inst:SetStateGraph("SGshadowwaxwell")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("explosive")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("bait")
    inst:RemoveTag("molebait")
    inst:AddComponent("follower")
    inst:AddComponent("inventory")
    inst.components.container.canbeopened = true
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "torso"
    inst.components.combat:SetDefaultDamage(50)
    inst.components.combat:SetRange(2, 3)
    inst.components.combat:SetAttackPeriod(0.5)
    inst.components.combat:SetRetargetFunction(2, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 25, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end)
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(1500)
    inst.components.health.nofadeout = true
    inst:DoPeriodicTask(1, function(inst)
      if inst:HasTag("cango") then
        if not inst.components.container:Has("goldnugget", 20) then
           inst.AnimState:SetBloomEffectHandle("")
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
        else
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
        end
      else
         inst.AnimState:SetBloomEffectHandle("")
         inst.components.locomotor:Stop()
         inst:SetBrain(nil)
         inst.components.follower:SetLeader(nil)
      end
    end )
    inst:DoPeriodicTask(480, function(inst)
        if inst.components.container:Has("goldnugget", 20) then
           inst.components.container:ConsumeByName("goldnugget", 20)
           inst.components.health:DoDelta(500)
        end
    end )
    inst:AddComponent( "playerprox" )
    inst.components.playerprox:SetDist(3,5)
    inst.components.playerprox:SetOnPlayerNear(function(inst)
        inst.components.locomotor.walkspeed = 1
        inst.components.locomotor.runspeed = 2
    end )
    inst.components.playerprox:SetOnPlayerFar(function(inst)
        inst.components.locomotor.walkspeed = 8
        inst.components.locomotor.runspeed = 15
    end )
    inst.AnimState:Hide("HAT")
    inst.AnimState:Hide("HAT_HAIR")
    inst.AnimState:Show("HAIR_NOHAT")
    inst.AnimState:Show("HAIR")
    inst.AnimState:ClearOverrideSymbol("swap_body")
    for k,v in pairs(inst.components.container.slots) do
        if v.prefab == "footballhat" or v.prefab == "ruinshat" or v.prefab == "beefalohat" or v.prefab == "featherhat" then
           inst.AnimState:Show("HAT")
           inst.AnimState:Show("HAT_HAIR")
           inst.AnimState:Hide("HAIR_NOHAT")
           inst.AnimState:Hide("HAIR")
        end
        if v and v.prefab == "armorgrass" then
           inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")
           inst:ListenForEvent("attacked", function(inst, data)
               inst.components.health:DoDelta(15)
           end )
        end
        if v and v.prefab == "armorwood" then
           inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body")
           inst:ListenForEvent("attacked", function(inst, data)
               inst.components.health:DoDelta(20)
           end )
        end
        if v and v.prefab == "armormarble" then
           inst.AnimState:OverrideSymbol("swap_body", "armor_marble", "swap_body")
           inst:ListenForEvent("attacked", function(inst, data)
               inst.components.health:DoDelta(25)
           end )
        end
        if v and v.prefab == "armor_sanity" then
           inst.AnimState:OverrideSymbol("swap_body", "armor_sanity", "swap_body")
           inst:ListenForEvent("attacked", function(inst, data)
               inst.components.health:DoDelta(30)
           end )
        end
        if v and v.prefab == "armorruins" then
           inst.AnimState:OverrideSymbol("swap_body", "armor_ruins", "swap_body")
           inst:ListenForEvent("attacked", function(inst, data)
               inst.components.health:DoDelta(35)
           end )
        end
        if v and v.prefab == "footballhat" then
           inst.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat")
        end
        if v and v.prefab == "ruinshat" then
           inst.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat")
        end
        if v and v.prefab == "beefalohat" then
           inst.AnimState:OverrideSymbol("swap_hat", "hat_beefalo", "swap_hat")
        end
        if v and v.prefab == "featherhat" then
           inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")
        end
    end
  end
  if data and data.cango then
     inst:AddTag("cango")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    100ƽʱûҩ˽Ҿ100ƽϻƽʱֳɴ򿪸ӣ20ƽ󣬵Goť̡׷ٴεͣԭأ棬ٵGoťɡ˽ҾʿÿĹ20ƽԶϵĻƽп۳ͬʱز֮һѪϵĻƽ20ʱչ뼰ʱѡ˽ҾĸпסñӣGoťԶװװ׿˽Ҿķɵ͵ΪݿסľסʯסҹħסԶſסװñֻװãװñƤñԶñţëñëñҪĸ2׻2ñӣֻѡ1װ˽ҾСͼʾΪѧͼ꣬Էҵǵλáҩڿѧѡԭӣ£1ü1ľ̿1ʯ




.ʹʹΪ֮УƷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\raincoat.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local scalewing = SpawnPrefab("raincoat")
    scalewing.Transform:SetPosition(pt.x, pt.y, pt.z)
    scalewing.AnimState:SetBank("butterfly")
    scalewing.AnimState:SetBuild("butterfly_basic")
    scalewing.AnimState:PlayAnimation("idle")
    scalewing.AnimState:SetRayTestOnBB(true);
    scalewing.Transform:SetTwoFaced()
    scalewing.Transform:SetScale(1.5, 1.5, 1.5)
    scalewing.AnimState:SetMultColour(255/255,0/255,115/255,0.8)
    scalewing.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    scalewing.entity:AddSoundEmitter()
    local shadow = scalewing.entity:AddDynamicShadow()
    shadow:SetSize(.8, .5)
    RemovePhysicsColliders(scalewing)
    scalewing.entity:AddLight()
    scalewing.Light:SetFalloff(1)
    scalewing.Light:SetIntensity(.8)
    scalewing.Light:SetRadius(12)
    scalewing.Light:SetColour(180/255, 195/255, 50/255)
    scalewing.Light:Enable(true)
    scalewing:RemoveComponent("inventoryitem")
    scalewing:RemoveComponent("equippable")
    scalewing:RemoveComponent("waterproofer")
    scalewing:RemoveComponent("fueled")
    scalewing:RemoveComponent("insulator")
    scalewing:RemoveComponent("deployable")
    scalewing:AddComponent("inventoryitem")
    scalewing.components.inventoryitem:ChangeImageName("butterfly")
    scalewing:AddComponent("named")
    scalewing.components.named:SetName("Butterfly")
    scalewing:AddComponent("follower")
    scalewing.components.follower:SetLeader(GetPlayer())
    scalewing:AddComponent("locomotor")
    scalewing.components.locomotor.walkspeed = 8
    scalewing:SetStateGraph("SGbutterfly")
    local brain = require "brains/abigailbrain"
    scalewing:SetBrain(brain)
    scalewing:AddComponent("health")
    scalewing.components.health:SetMaxHealth(10)
    scalewing.components.health:SetInvincible(true)
    scalewing:AddComponent("combat")
    scalewing.components.combat:SetDefaultDamage(0)
    scalewing.components.combat:SetRange(2)
    scalewing.components.combat:SetAttackPeriod(0.5)
    scalewing.components.combat:SetRetargetFunction(1, function(scalewing)
        if not scalewing.components.health:IsDead() then
            return FindEntity(GetPlayer(), 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster")
                end
            end)
        end
    end )
    scalewing.components.combat:SetKeepTargetFunction(function(scalewing, target) return target and target:IsValid() end )
    scalewing:AddTag("duty")
    scalewing.task = scalewing:DoPeriodicTask(0.5, function(scalewing)
        local target = FindEntity(scalewing, 3, function(guy)
            if guy.components.health and not guy.components.health:IsDead() then
               return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster")
            end
        end )
        if target then
           if target.components.combat then target.components.combat:SetTarget(scalewing) end
           if target.components.locomotor then target.components.locomotor:Stop() end
           SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
           scalewing.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
           target.components.health:DoDelta(-100)
        end
    end )
    scalewing.components.inventoryitem:SetOnDroppedFn(function(scalewing)
        scalewing:AddTag("duty")
        scalewing.Light:Enable(true)
        scalewing.task = scalewing:DoPeriodicTask(0.5, function(scalewing)
            local target = FindEntity(scalewing, 3, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == scalewing or scalewing.components.combat.target == guy or guy:HasTag("monster")
                end
            end )
            if target then
               if target.components.combat then target.components.combat:SetTarget(scalewing) end
               if target.components.locomotor then target.components.locomotor:Stop() end
               SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
               scalewing.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
               target.components.health:DoDelta(-100)
            end
        end )
    end )
    scalewing.components.inventoryitem:SetOnPickupFn(function(scalewing)
        scalewing:RemoveTag("duty")
        scalewing.Light:Enable(false)
        if scalewing.task then scalewing.task:Cancel() scalewing.task = nil end
    end )
    scalewing.components.inventoryitem:SetOnPutInInventoryFn(function(scalewing)
        scalewing:RemoveTag("duty")
        scalewing.Light:Enable(false)
        if scalewing.task then scalewing.task:Cancel() scalewing.task = nil end
    end )
    scalewing:AddTag("scalewings")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("scalewings") then
        data.scalewings = true
    end
    if inst:HasTag("duty") then
        data.duty = true
    end
end
local function onload(inst, data)
  if data and data.scalewings then
    inst.AnimState:SetBank("butterfly")
    inst.AnimState:SetBuild("butterfly_basic")
    inst.AnimState:PlayAnimation("idle")
    inst.AnimState:SetRayTestOnBB(true);
    inst.Transform:SetTwoFaced()
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    inst.AnimState:SetMultColour(255/255,0/255,115/255,0.8)
    inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize(.8, .5)
    RemovePhysicsColliders(inst)
    inst.entity:AddLight()
    inst.Light:SetFalloff(1)
    inst.Light:SetIntensity(.8)
    inst.Light:SetRadius(12)
    inst.Light:SetColour(180/255, 195/255, 50/255)
    inst.Light:Enable(true)
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("waterproofer")
    inst:RemoveComponent("fueled")
    inst:RemoveComponent("insulator")
    inst:RemoveComponent("deployable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:ChangeImageName("butterfly")
    inst:AddComponent("named")
    inst.components.named:SetName("Butterfly")
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 8
    inst:SetStateGraph("SGbutterfly")
    local brain = require "brains/abigailbrain"
    inst:SetBrain(brain)
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(10)
    inst.components.health:SetInvincible(true)
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(0)
    inst.components.combat:SetRange(2)
    inst.components.combat:SetAttackPeriod(0.5)
    inst.components.combat:SetRetargetFunction(1, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(GetPlayer(), 20, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster")
                end
            end)
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst.components.inventoryitem:SetOnDroppedFn(function(inst)
        inst:AddTag("duty")
        inst.Light:Enable(true)
        inst.task = inst:DoPeriodicTask(0.5, function(inst)
            local target = FindEntity(inst, 3, function(guy)
                if guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster")
                end
            end )
            if target then
               if target.components.combat then target.components.combat:SetTarget(inst) end
               if target.components.locomotor then target.components.locomotor:Stop() end
               SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
               inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
               target.components.health:DoDelta(-100)
            end
        end )
    end )
    inst.components.inventoryitem:SetOnPickupFn(function(inst)
        inst:RemoveTag("duty")
        inst.Light:Enable(false)
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst.components.inventoryitem:SetOnPutInInventoryFn(function(inst)
        inst:RemoveTag("duty")
        inst.Light:Enable(false)
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst:AddTag("scalewings")
  end
  if data and data.duty then
    inst:AddTag("duty")
    inst.task = inst:DoPeriodicTask(0.5, function(inst)
        local target = FindEntity(inst, 3, function(guy)
            if guy.components.health and not guy.components.health:IsDead() then
               return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster")
            end
        end )
        if target then
           if target.components.combat then target.components.combat:SetTarget(inst) end
           if target.components.locomotor then target.components.locomotor:Stop() end
           SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
           inst.SoundEmitter:PlaySound("dontstarve/common/lightningrod")
           target.components.health:DoDelta(-100)
        end
    end )
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ʹ㣬Ϊκͼĵˣ⵽ʹĵɱֵֹ俿㡣ʹƷʾΪͼꡣҪʹˣƷж䰴Ҽɡڴѡñ£2Ƥ2ӡ2Ӳͷ




.ܣûɫֳܣսð֣ͣԭأιɲѪ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.AnimState:PlayAnimation("yellowamulet")һвݣ

local function SetStandState(inst, state)
    inst.StandState = string.lower(state)
end
local function OnDeploy (inst, pt)
    local mybear = SpawnPrefab("yellowamulet")
    mybear.Transform:SetPosition(pt.x, pt.y, pt.z)
    mybear.AnimState:SetBank("bearger")
    mybear.AnimState:SetBuild("bearger_build")
    mybear.AnimState:PlayAnimation("idle_loop", true)
    mybear.Transform:SetScale(0.5, 0.5, 0.5)
    mybear.Transform:SetFourFaced()
    local sound = mybear.entity:AddSoundEmitter()
    local shadow = mybear.entity:AddDynamicShadow()
    shadow:SetSize(3, 1.8)
    MakeCharacterPhysics(mybear, 500, 1)
    mybear:RemoveComponent("equippable")
    mybear:RemoveComponent("inventoryitem")
    mybear:RemoveComponent("fueled")
    mybear:RemoveComponent("deployable")
    SetStandState(mybear, "QUAD")
    mybear.CanGroundPound = false
    mybear.SetStandState = SetStandState
    mybear.IsStandState = function(mybear, state)
        return mybear.StandState == string.lower(state)
    end
    mybear.WorkEntities = function(mybear)
        mybear.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
        GetPlayer().components.playercontroller:ShakeCamera(mybear, "FULL", 0.5, 0.05, 2, 40)
    end
    mybear:AddComponent("groundpounder")
    mybear.components.groundpounder.destroyer = true
    mybear.components.groundpounder.damageRings = 3
    mybear.components.groundpounder.destructionRings = 4
    mybear.components.groundpounder.numRings = 5
    mybear:AddComponent("named")
    mybear.components.named:SetName("My Bear")
    mybear:AddComponent("inventory")
    mybear:AddComponent("knownlocations")
    mybear:AddComponent("timer")
    mybear:AddComponent("eater")
    mybear.components.eater.foodprefs = {"MEAT"}
    mybear:AddComponent("follower")
    mybear.components.follower:SetLeader(GetPlayer())
    mybear:AddComponent("lootdropper")
    mybear.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "bearger_fur"})
    mybear:AddComponent("health")
    mybear.components.health:SetMaxHealth(10000)
    mybear:AddComponent("combat")
    mybear.components.combat:SetDefaultDamage(300)
    mybear.components.combat:SetAttackPeriod(0.5)
    mybear.components.combat.hiteffectsymbol = "bearger_body"
    mybear.components.combat:SetAreaDamage(4, 1)
    mybear.components.combat.playerdamagepercent = 0
    mybear.components.combat:SetRange(2, 4)
    mybear.components.combat:SetHurtSound("dontstarve_DLC001/creatures/bearger/hurt")
    mybear.components.combat:SetRetargetFunction(1, function(mybear)
        if not mybear.components.health:IsDead() then
            return FindEntity(mybear, 25, function(guy)
                if guy.components.combat then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    mybear.components.combat:SetKeepTargetFunction(function(mybear, target) return target and target:IsValid() end )
    mybear:ListenForEvent("attacked", function(mybear, data)
        if data.attacker ~= GetPlayer() then
           mybear.components.combat:SetTarget(data.attacker)
        else
           mybear.components.combat:SetTarget(nil)
        end
    end )
    mybear:AddComponent("locomotor")
    mybear.components.locomotor.walkspeed = 15
    mybear.components.locomotor.runspeed = 20
    mybear.components.locomotor:SetShouldRun(true)
    mybear:SetStateGraph("SGbearger")
    local brain = require "brains/abigailbrain"
    mybear:SetBrain(brain)
    mybear:AddComponent("trader")
    mybear.components.trader:SetAcceptTest(function(mybear, item)
        if item.prefab == "meat" then
           return mybear.components.health:GetPercent() < 1
        end
        return false
    end )
    mybear.components.trader.onaccept = function(mybear, giver, item)
        if item.prefab == "meat" then
           mybear.components.health:DoDelta(2000)
        end
    end
    mybear.components.inspectable.getstatus = function(mybear)
        if not mybear:HasTag("stophere") then
           mybear:AddTag("stophere")
           mybear.components.locomotor:Stop()
           mybear:SetBrain(nil)
           mybear.components.follower:SetLeader(nil)
           mybear.AnimState:PlayAnimation("sleep_loop",true)
        else
           mybear:RemoveTag("stophere")
           local brain = require "brains/abigailbrain"
           mybear:SetBrain(brain)
           mybear:RestartBrain()
           mybear.components.follower:SetLeader(GetPlayer())
        end
    end
    mybear:AddTag("companion")
    mybear:AddTag("mybears")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("mybears") then
        data.mybears = true
    end
    if inst:HasTag("stophere") then
        data.stophere = true
    end
end
local function onload(inst, data)
  if data and data.mybears then
    inst.AnimState:SetBank("bearger")
    inst.AnimState:SetBuild("bearger_build")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.Transform:SetScale(0.5, 0.5, 0.5)
    inst.Transform:SetFourFaced()
    local sound = inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize(3, 1.8)
    MakeCharacterPhysics(inst, 500, 1)
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("fueled")
    inst:RemoveComponent("deployable")
    SetStandState(inst, "QUAD")
    inst.CanGroundPound = false
    inst.SetStandState = SetStandState
    inst.IsStandState = function(inst, state)
        return inst.StandState == string.lower(state)
    end
    inst.WorkEntities = function(inst)
        inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
        GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40)
    end
    inst:AddComponent("groundpounder")
    inst.components.groundpounder.destroyer = true
    inst.components.groundpounder.damageRings = 3
    inst.components.groundpounder.destructionRings = 4
    inst.components.groundpounder.numRings = 5
    inst:AddComponent("named")
    inst.components.named:SetName("My Bear")
    inst:AddComponent("inventory")
    inst:AddComponent("knownlocations")
    inst:AddComponent("timer")
    inst:AddComponent("eater")
    inst.components.eater.foodprefs = {"MEAT"}
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "bearger_fur"})
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(10000)
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(300)
    inst.components.combat:SetAttackPeriod(0.5)
    inst.components.combat.hiteffectsymbol = "bearger_body"
    inst.components.combat:SetAreaDamage(4, 1)
    inst.components.combat.playerdamagepercent = 0
    inst.components.combat:SetRange(2, 4)
    inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/bearger/hurt")
    inst.components.combat:SetRetargetFunction(1, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 25, function(guy)
                if guy.components.combat then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:ListenForEvent("attacked", function(inst, data)
        if data.attacker ~= GetPlayer() then
           inst.components.combat:SetTarget(data.attacker)
        else
           inst.components.combat:SetTarget(nil)
        end
    end )
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 15
    inst.components.locomotor.runspeed = 20
    inst.components.locomotor:SetShouldRun(true)
    inst:SetStateGraph("SGbearger")
    local brain = require "brains/abigailbrain"
    inst:SetBrain(brain)
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item)
        if item.prefab == "meat" then
           return inst.components.health:GetPercent() < 1
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        if item.prefab == "meat" then
           inst.components.health:DoDelta(2000)
        end
    end
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("stophere") then
           inst:AddTag("stophere")
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
           inst.AnimState:PlayAnimation("sleep_loop",true)
        else
           inst:RemoveTag("stophere")
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
        end
    end
    inst:AddTag("companion")
    inst:AddTag("mybears")
  end
  if data and data.stophere then
    inst:AddTag("stophere")
    inst.components.locomotor:Stop()
    inst:SetBrain(nil)
    inst.components.follower:SetLeader(nil)
    inst.AnimState:PlayAnimation("sleep_loop",true)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ûɫֳܣǿ׳սʱĺð֡ܣͣԭأٴεɼ档ܴ⣨ŴΪѪ5ɲҪˣɱɣCtrl + ỹ֡ʱײ赲ĽֲԲҪĻ̫ɫԶѡԶż̳£2ʯ3جȼϡ1ɫʯ




.ѣѿֳѣǿҼɰϵƷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\armor_dragonfly.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local myfly = SpawnPrefab("armordragonfly")
    myfly.Transform:SetPosition(pt.x, pt.y, pt.z)
    myfly.AnimState:SetBank("dragonfly")
    myfly.AnimState:SetBuild("dragonfly_build")
    myfly.AnimState:PlayAnimation("idle", true)
    myfly.Transform:SetScale(0.5, 0.5, 0.5)
    myfly.Transform:SetFourFaced()
    local sound = myfly.entity:AddSoundEmitter()
    local shadow = myfly.entity:AddDynamicShadow()
    shadow:SetSize(3, 1.8)
    MakeCharacterPhysics(myfly, 50, 0.7)
    local light = myfly.entity:AddLight()
    myfly.Light:Enable(false)
    myfly.Light:SetRadius(2)
    myfly.Light:SetFalloff(0.5)
    myfly.Light:SetIntensity(.75)
    myfly.Light:SetColour(235/255,121/255,12/255)
    myfly:RemoveComponent("inventoryitem")
    myfly:RemoveComponent("armor")
    myfly:RemoveComponent("equippable")
    myfly:RemoveComponent("deployable")
    MakeLargePropagator(myfly)
    myfly.components.propagator.decayrate = 0
    myfly:AddComponent("groundpounder")
    myfly.components.groundpounder.numRings = 2
    myfly.components.groundpounder.burner = true
    myfly.components.groundpounder.groundpoundfx = "firesplash_fx"
    myfly.components.groundpounder.groundpounddamagemult = .5
    myfly.components.groundpounder.groundpoundringfx = "firering_fx"
    myfly:AddComponent("named")
    myfly.components.named:SetName("My Dragonfly")
    myfly:AddComponent("inventory")
    myfly:AddComponent("knownlocations")
    myfly:AddComponent("follower")
    myfly.components.follower:SetLeader(GetPlayer())
    myfly:AddComponent("lootdropper")
    myfly.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "dragon_scales"})
    myfly:AddComponent("health")
    myfly.components.health:SetMaxHealth(5000)
    myfly:AddComponent("combat")
    myfly.components.combat:SetDefaultDamage(300)
    myfly.components.combat:SetAttackPeriod(0.5)
    myfly.components.combat.hiteffectsymbol = "dragonfly_body"
    myfly.components.combat:SetAreaDamage(6, 0.8)
    myfly.components.combat.playerdamagepercent = 0
    myfly.components.combat:SetRange(4)
    myfly.components.combat.battlecryenabled = false
    myfly.components.combat:SetHurtSound("dontstarve_DLC001/creatures/dragonfly/hurt")
    myfly.components.combat:SetRetargetFunction(1, function(myfly)
        if not myfly.components.health:IsDead() then
            return FindEntity(myfly, 25, function(guy)
                if guy.components.combat then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    myfly.components.combat:SetKeepTargetFunction(function(myfly, target) return target and target:IsValid() end )
    myfly:ListenForEvent("attacked", function(myfly, data)
        if data.attacker ~= GetPlayer() then
           if not data.attacker:HasTag("myflys") then
              myfly.components.combat:SetTarget(data.attacker)
           end
        else
           myfly.components.health:Kill()
        end
    end )
    myfly:AddComponent("locomotor")
    myfly.components.locomotor.walkspeed = 25
    myfly:SetStateGraph("SGdragonfly")
    local brain = require "brains/abigailbrain"
    myfly:SetBrain(brain)
    myfly:DoPeriodicTask(5, function()
        if myfly.components.combat and not myfly.components.combat.target then
           if myfly.fire_build then
              myfly.sg:GoToState("flameoff")
           end
           if myfly.components.health and myfly.components.health:GetPercent() < 1 then
              myfly.components.health:DoDelta(200)
           end
        end
    end )
    myfly:AddComponent("machine")
    myfly.components.machine.turnonfn = function()
        myfly:AddTag("inhaling")
        myfly.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        myfly.task = myfly:DoPeriodicTask(.5, function(myfly)
            local pos = Vector3(myfly.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15)
            for k,v in pairs(ents) do
                local pt1 = v:GetPosition()
                if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer
                   and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart")
                   and not v:HasTag("projectile") then
                   if not GetPlayer().components.inventory:IsFull() then
                      SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                      GetPlayer().components.inventory:GiveItem(v)
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                   end
                end
            end
        end )
    end
    myfly.components.machine.turnofffn = function()
        myfly:RemoveTag("inhaling")
        myfly.AnimState:SetBloomEffectHandle( "" )
        if myfly.task then myfly.task:Cancel() myfly.task = nil end
    end
    myfly.components.inspectable.getstatus = function(myfly)
        if not myfly:HasTag("stophere") then
           myfly:AddTag("stophere")
           myfly.components.locomotor:Stop()
           myfly:SetBrain(nil)
           myfly.components.follower:SetLeader(nil)
           myfly.sg:GoToState("flameoff")
        else
           myfly:RemoveTag("stophere")
           local brain = require "brains/abigailbrain"
           myfly:SetBrain(brain)
           myfly:RestartBrain()
           myfly.components.follower:SetLeader(GetPlayer())
        end
    end
    myfly:ListenForEvent("death", function()
        myfly.components.machine:TurnOff()
    end )
    myfly:AddTag("companion")
    myfly:AddTag("myflys")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("myflys") then
        data.myflys = true
    end
    if inst:HasTag("stophere") then
        data.stophere = true
    end
    if inst:HasTag("inhaling") then
        data.inhaling = true
    end
end
local function onload(inst, data)
  if data and data.myflys then
    inst.AnimState:SetBank("dragonfly")
    inst.AnimState:SetBuild("dragonfly_build")
    inst.AnimState:PlayAnimation("idle", true)
    inst.Transform:SetScale(0.5, 0.5, 0.5)
    inst.Transform:SetFourFaced()
    local sound = inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize(3, 1.8)
    MakeCharacterPhysics(inst, 50, 0.7)
    local light = inst.entity:AddLight()
    inst.Light:Enable(false)
    inst.Light:SetRadius(2)
    inst.Light:SetFalloff(0.5)
    inst.Light:SetIntensity(.75)
    inst.Light:SetColour(235/255,121/255,12/255)
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("armor")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("deployable")
    MakeLargePropagator(inst)
    inst.components.propagator.decayrate = 0
    inst:AddComponent("groundpounder")
    inst.components.groundpounder.numRings = 2
    inst.components.groundpounder.burner = true
    inst.components.groundpounder.groundpoundfx = "firesplash_fx"
    inst.components.groundpounder.groundpounddamagemult = .5
    inst.components.groundpounder.groundpoundringfx = "firering_fx"
    inst:AddComponent("named")
    inst.components.named:SetName("My Dragonfly")
    inst:AddComponent("inventory")
    inst:AddComponent("knownlocations")
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"meat", "meat", "meat", "meat", "dragon_scales"})
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(5000)
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(300)
    inst.components.combat:SetAttackPeriod(0.5)
    inst.components.combat.hiteffectsymbol = "dragonfly_body"
    inst.components.combat:SetAreaDamage(6, 0.8)
    inst.components.combat.playerdamagepercent = 0
    inst.components.combat:SetRange(4)
    inst.components.combat.battlecryenabled = false
    inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/dragonfly/hurt")
    inst.components.combat:SetRetargetFunction(1, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 25, function(guy)
                if guy.components.combat then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:ListenForEvent("attacked", function(inst, data)
        if data.attacker ~= GetPlayer() then
           if not data.attacker:HasTag("myflys") then
              inst.components.combat:SetTarget(data.attacker)
           end
        else
           inst.components.health:Kill()
        end
    end )
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 25
    inst:SetStateGraph("SGdragonfly")
    local brain = require "brains/abigailbrain"
    inst:SetBrain(brain)
    inst:DoPeriodicTask(5, function()
        if inst.components.combat and not inst.components.combat.target then
           if inst.fire_build then
              inst.sg:GoToState("flameoff")
           end
           if inst.components.health and inst.components.health:GetPercent() < 1 then
              inst.components.health:DoDelta(200)
           end
        end
    end )
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = function()
        inst:AddTag("inhaling")
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        inst.task = inst:DoPeriodicTask(.5, function(inst)
            local pos = Vector3(inst.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 15)
            for k,v in pairs(ents) do
                local pt1 = v:GetPosition()
                if v.components.inventoryitem and v.components.inventoryitem.canbepickedup and v.components.inventoryitem.cangoincontainer
                   and not v.components.inventoryitem:IsHeld() and not v:HasTag("trap") and not v:HasTag("light") and not v:HasTag("blowdart")
                   and not v:HasTag("projectile") then
                   if not GetPlayer().components.inventory:IsFull() then
                      SpawnPrefab("small_puff").Transform:SetPosition(pt1.x, pt1.y, pt1.z)
                      GetPlayer().components.inventory:GiveItem(v)
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                   end
                end
            end
        end )
    end
    inst.components.machine.turnofffn = function()
        inst:RemoveTag("inhaling")
        inst.AnimState:SetBloomEffectHandle( "" )
        if inst.task then inst.task:Cancel() inst.task = nil end
    end
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("stophere") then
           inst:AddTag("stophere")
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
           inst.sg:GoToState("flameoff")
        else
           inst:RemoveTag("stophere")
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
        end
    end
    inst:ListenForEvent("death", function()
        inst.components.machine:TurnOff()
    end )
    inst:AddTag("companion")
    inst:AddTag("myflys")
  end
  if data and data.stophere then
    inst:AddTag("stophere")
    inst.components.locomotor:Stop()
    inst:SetBrain(nil)
    inst.components.follower:SetLeader(nil)
    inst.sg:GoToState("flameoff")
  end
  if data and data.inhaling then
    inst.components.machine.ison = true
    inst.components.machine:TurnOn()
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ѿֳѣǿԶѪսʱĺð֡ѣͣԭأٴεɼ档ҼѣϵĶȡƷٴεֹͣҪˣɱɣCtrl + һ¼ѹʱ֣ԴսʱҪ̫ҲҪͬʱ1ϵĳȥս׻Źѿսѡѽ£1Ƭ1ľס3Ƥ




.ͳսǣXٻսǣ㣬5Ϊսǣ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_X, function()
    if inst.components.inventory:Has("goldnugget", 20) then
       inst.components.inventory:ConsumeByName("goldnugget", 20)
       inst.AnimState:PlayAnimation("give")
       inst.SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
       local mywolf = SpawnPrefab("greenamulet")
       local pt = GetPlayer():GetPosition()
       mywolf.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3)))
       mywolf.AnimState:SetBank("warg")
       mywolf.AnimState:SetBuild("warg_build")
       mywolf.AnimState:PlayAnimation("idle")
       mywolf.Transform:SetScale(0.6, 0.6, 0.6)
       mywolf.Transform:SetFourFaced()
       local sound = mywolf.entity:AddSoundEmitter()
       local shadow = mywolf.entity:AddDynamicShadow()
       shadow:SetSize(1.2, 0.7)
       MakeCharacterPhysics(mywolf, 100, 1)
       mywolf:RemoveComponent("equippable")
       mywolf:RemoveComponent("inventoryitem")
       mywolf:RemoveComponent("finiteuses")
       mywolf:RemoveComponent("deployable")
       mywolf:AddComponent("named")
       mywolf.components.named:SetName("Wolf")
       mywolf:AddComponent("follower")
       mywolf.components.follower:SetLeader(GetPlayer())
       mywolf:AddComponent("lootdropper")
       mywolf.components.lootdropper:SetLoot({"monstermeat", "houndstooth"})
       mywolf:AddComponent("health")
       mywolf.components.health:SetMaxHealth(1000)
       mywolf.components.health:StartRegen(50, 10)
       mywolf:AddComponent("combat")
       mywolf.components.combat:SetDefaultDamage(50)
       mywolf.components.combat:SetAttackPeriod(0.5)
       mywolf.components.combat:SetRange(3)
       mywolf.components.combat:SetRetargetFunction(1, function(mywolf)
           if not mywolf.components.health:IsDead() then
               return FindEntity(mywolf, 25, function(guy)
                   if guy.components.combat then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end )
           end
       end )
       mywolf.components.combat:SetKeepTargetFunction(function(mywolf, target) return target and target:IsValid() end )
       mywolf:ListenForEvent("attacked", function(mywolf, data)
           if data.attacker ~= GetPlayer() then
              mywolf.components.combat:SetTarget(data.attacker)
              mywolf.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("mywolfs") and not dude.components.health:IsDead() end, 10)
           else
              mywolf.components.health:Kill()
           end
       end )
       mywolf:AddComponent("locomotor")
       mywolf.components.locomotor.runspeed = 18
       mywolf.components.locomotor:SetShouldRun(true)
       mywolf:SetStateGraph("SGwarg")
       local brain = require "brains/abigailbrain"
       mywolf:SetBrain(brain)
       mywolf:AddComponent("trader")
       mywolf.components.trader:SetAcceptTest(function(mywolf, item)
           if GetPlayer().components.inventory:Has("monstermeat", 5) then
              if item.prefab == "monstermeat" then
                 if not mywolf:HasTag("superwolf") then
                    return true
                 end
              end
           end
           return false
       end )
       mywolf.components.trader.onaccept = function(mywolf, giver, item)
           if item.prefab == "monstermeat" then
              giver.components.inventory:ConsumeByName("monstermeat", 4)
              mywolf:AddTag("superwolf")
              mywolf.components.named:SetName("Super Wolf")
              mywolf.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
              mywolf.Transform:SetScale(0.7, 0.7, 0.7)
              mywolf.components.health:SetMaxHealth(2000)
              mywolf.components.health:DoDelta(2000)
              mywolf.components.combat:SetDefaultDamage(100)
              mywolf.components.locomotor.runspeed = 25
           end
       end
       mywolf.components.inspectable.getstatus = function(mywolf)
           if not mywolf:HasTag("stophere") then
              mywolf:AddTag("stophere")
              mywolf.components.locomotor:Stop()
              mywolf:SetBrain(nil)
              mywolf.components.follower:SetLeader(nil)
           else
              mywolf:RemoveTag("stophere")
              local brain = require "brains/abigailbrain"
              mywolf:SetBrain(brain)
              mywolf:RestartBrain()
              mywolf.components.follower:SetLeader(GetPlayer())
           end
       end
       mywolf:AddTag("companion")
       mywolf:AddTag("mywolfs")
    end
end )


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.AnimState:PlayAnimation("greenamulet")һвݣ

local function onsave(inst, data)
    if inst:HasTag("mywolfs") then
        data.mywolfs = true
    end
    if inst:HasTag("superwolf") then
        data.superwolf = true
    end
    if inst:HasTag("stophere") then
        data.stophere = true
    end
end
local function onload(inst, data)
    if data and data.mywolfs then
       inst.AnimState:SetBank("warg")
       inst.AnimState:SetBuild("warg_build")
       inst.AnimState:PlayAnimation("idle")
       inst.Transform:SetScale(0.6, 0.6, 0.6)
       inst.Transform:SetFourFaced()
       local sound = inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize(1.2, 0.7)
       MakeCharacterPhysics(inst, 100, 1)
       inst:RemoveComponent("equippable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("finiteuses")
       inst:RemoveComponent("deployable")
       inst:AddComponent("named")
       inst.components.named:SetName("Wolf")
       inst:AddComponent("follower")
       inst.components.follower:SetLeader(GetPlayer())
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"monstermeat", "houndstooth"})
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(1000)
       inst.components.health:StartRegen(50, 10)
       inst:AddComponent("combat")
       inst.components.combat:SetDefaultDamage(50)
       inst.components.combat:SetAttackPeriod(0.5)
       inst.components.combat:SetRange(3)
       inst.components.combat:SetRetargetFunction(1, function(inst)
           if not inst.components.health:IsDead() then
               return FindEntity(inst, 25, function(guy)
                   if guy.components.combat then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end )
           end
       end )
       inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
       inst:ListenForEvent("attacked", function(inst, data)
           if data.attacker ~= GetPlayer() then
              inst.components.combat:SetTarget(data.attacker)
              inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("mywolfs") and not dude.components.health:IsDead() end, 10)
           else
              inst.components.health:Kill()
           end
       end )
       inst:AddComponent("locomotor")
       inst.components.locomotor.runspeed = 18
       inst.components.locomotor:SetShouldRun(true)
       inst:SetStateGraph("SGwarg")
       local brain = require "brains/abigailbrain"
       inst:SetBrain(brain)
       inst:AddComponent("trader")
       inst.components.trader:SetAcceptTest(function(inst, item)
           if GetPlayer().components.inventory:Has("monstermeat", 5) then
              if item.prefab == "monstermeat" then
                 if not inst:HasTag("superwolf") then
                    return true
                 end
              end
           end
           return false
       end )
       inst.components.trader.onaccept = function(inst, giver, item)
           if item.prefab == "monstermeat" then
              giver.components.inventory:ConsumeByName("monstermeat", 4)
              inst:AddTag("superwolf")
              inst.components.named:SetName("Super Wolf")
              inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
              inst.Transform:SetScale(0.7, 0.7, 0.7)
              inst.components.health:SetMaxHealth(2000)
              inst.components.health:DoDelta(2000)
              inst.components.combat:SetDefaultDamage(100)
              inst.components.locomotor.runspeed = 25
           end
       end
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("stophere") then
              inst:AddTag("stophere")
              inst.components.locomotor:Stop()
              inst:SetBrain(nil)
              inst.components.follower:SetLeader(nil)
           else
              inst:RemoveTag("stophere")
              local brain = require "brains/abigailbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
           end
       end
       inst:AddTag("companion")
       inst:AddTag("mywolfs")
    end
    if data and data.superwolf then
       inst:AddTag("superwolf")
       inst.components.named:SetName("Super Wolf")
       inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
       inst.Transform:SetScale(0.7, 0.7, 0.7)
       inst.components.health:SetMaxHealth(2000)
       inst.components.health:DoDelta(2000)
       inst.components.combat:SetDefaultDamage(100)
       inst.components.locomotor.runspeed = 25
    end
    if data and data.stophere then
      inst:AddTag("stophere")
      inst.components.locomotor:Stop()
      inst:SetBrain(nil)
      inst.components.follower:SetLeader(nil)
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɰXٻսǣÿֻ20ƽϻƽʱ޷ٻսǼҳϣ㣬ͣԭأٴε档սκһ¼ɣCtrl + ỹսǿԶѪһֻս⵽ʱսǻΧˡս5⣨ŷսǵɽΪսǣֵٶȻͳսǲӣɨ½




.ǶӣTٻǶӣԵзɱʽըǮ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_T, function()
    if inst.components.inventory:Has("goldnugget", 2) then
       inst.components.inventory:ConsumeByName("goldnugget", 2)
       inst.AnimState:PlayAnimation("give")
       inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
       local bean = SpawnPrefab("goatmilk")
       local pt = GetPlayer():GetPosition()
       bean.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3)))
       SpawnPrefab("collapse_small").Transform:SetPosition(bean.Transform:GetWorldPosition())
       bean.AnimState:SetBank("treedrake")
       bean.AnimState:SetBuild("treedrake_build")
       bean.AnimState:PlayAnimation("enter")
       bean.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
       bean.Transform:SetScale(1.2, 1.2, 1.2)
       bean.Transform:SetFourFaced()
       local sound = bean.entity:AddSoundEmitter()
       local shadow = bean.entity:AddDynamicShadow()
       shadow:SetSize(1.25, .75)
       MakeCharacterPhysics(bean, 1, .25)
       local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255} }
       bean.colour_idx = math.random(#colours)
       bean.AnimState:SetMultColour(colours[bean.colour_idx][1],colours[bean.colour_idx][2],colours[bean.colour_idx][3],1)
       bean:RemoveComponent("edible")
       bean:RemoveComponent("perishable")
       bean:RemoveComponent("stackable")
       bean:RemoveComponent("inventoryitem")
       bean:RemoveTag("catfood")
       bean.persists = false
       bean:AddComponent("named")
       bean.components.named:SetName("Jelly Bean")
       bean:AddComponent("follower")
       bean.components.follower:SetLeader(GetPlayer())
       bean:AddComponent("health")
       bean.components.health:SetMaxHealth(10)
       bean.components.health:SetInvincible(true)
       bean:AddComponent("combat")
       bean.components.combat:SetDefaultDamage(1)
       bean.components.combat:SetAttackPeriod(2)
       bean.components.combat:SetRange(0.5)
       bean.components.combat:SetRetargetFunction(1, function(bean)
           if not bean.components.health:IsDead() then
               return FindEntity(bean, 25, function(guy)
                   if guy.components.combat then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end )
           end
       end )
       bean.components.combat:SetKeepTargetFunction(function(bean, target) return target and target:IsValid() end )
       bean:AddComponent("locomotor")
       bean.components.locomotor.walkspeed = 15
       bean:SetStateGraph("SGbirchnutdrake")
       local brain = require "brains/abigailbrain"
       bean:SetBrain(brain)
       bean:DoPeriodicTask(0.25, function()
           local pos = Vector3(bean.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)
           for k,v in pairs(ents) do
               if v and v.components.combat and v.components.health and not v.components.health:IsDead() then
                  if v.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == v or v.components.combat.target == bean or bean.components.combat.target == v or v:HasTag("monster") then
                     GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
                     SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                     SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
                     GetClock():DoLightningLighting()
                     GetPlayer().components.playercontroller:ShakeCamera(v, "FULL", 0.7, 0.02, .5, 40)
                     v.components.health:Kill()
                     bean:Remove()
                  end
               end
           end
       end )
       bean.components.inspectable.getstatus = function(bean)
           inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
           SpawnPrefab("collapse_small").Transform:SetPosition(bean.Transform:GetWorldPosition())
           for k = 1, 2 do
               local goldnugget = SpawnPrefab("goldnugget")
               inst.components.inventory:GiveItem(goldnugget)
           end
           bean:Remove()
       end
       bean:AddTag("companion")
       bean:AddTag("beans")
    end
end )

    ɰTٻǶӣ2ƽϻƽʱ޷ٻǶԱĵˣ䷢ɱʽըɱܱߵˡǶԱǣ2ƽ𣨷Ʒ浵˳ٶǶӽ뿪֮ǰǶ˵




.ţţֶţ빫ţӮ𣬹ڻӶͽ

    ü±ϷĿ¼\data\scripts\prefabs\horn.luaļinst:AddComponent("inspectable")һвݣ

local sounds = 
{
    walk = "dontstarve/beefalo/walk",
    grunt = "dontstarve/beefalo/grunt",
    yell = "dontstarve/beefalo/yell",
    swish = "dontstarve/beefalo/tail_swish",
    curious = "dontstarve/beefalo/curious",
    angry = "dontstarve/beefalo/angry",
}
local function makebullring(inst)
    local pt = inst:GetPosition()
    local bullring0 = SpawnPrefab("horn")
    bullring0.Transform:SetPosition(pt.x, pt.y, pt.z)
    bullring0.AnimState:SetBank("marble_trees")
    bullring0.AnimState:SetBuild("marble_trees")
    bullring0.AnimState:PlayAnimation("full_4")
    bullring0.Transform:SetScale(1.5, 1.5, 1.5)
    bullring0:RemoveComponent("instrument")
    bullring0:RemoveComponent("tool")
    bullring0:RemoveComponent("finiteuses")
    bullring0:RemoveComponent("inventoryitem")
    bullring0:RemoveComponent("deployable")
    bullring0:RemoveTag("horn")
    bullring0:AddComponent("named")
    bullring0.components.named:SetName("Bullring")
    local light = bullring0.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(15)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    bullring0:AddComponent("workable")
    bullring0.components.workable:SetWorkAction(ACTIONS.HAMMER)
    bullring0.components.workable:SetWorkLeft(3)
    bullring0.components.workable:SetOnFinishCallback(function()
        SpawnPrefab("collapse_big").Transform:SetPosition(bullring0.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos = Vector3(bullring0.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("nobullring") then
               v:Remove()
            end
        end
        bullring0:Remove()
    end )
    bullring0.components.inspectable.getstatus = function(bullring0)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
        local bullfighting = SpawnPrefab("horn")
        bullfighting.Transform:SetPosition(pt.x+2, 0, pt.z+2)
        bullfighting.AnimState:SetBank("beefalo")
        bullfighting.AnimState:SetBuild("beefalo_build")
        bullfighting.AnimState:PlayAnimation("idle_loop", true)
        bullfighting.Transform:SetFourFaced()
        bullfighting.Transform:SetScale(1.3, 1.3, 1.3)
        local sound = bullfighting.entity:AddSoundEmitter()
        bullfighting.sounds = sounds
        local shadow = bullfighting.entity:AddDynamicShadow()
        shadow:SetSize( 3, 1.25 )
        MakeCharacterPhysics(bullfighting, 200, 1.3)
        bullfighting:RemoveComponent("instrument")
        bullfighting:RemoveComponent("tool")
        bullfighting:RemoveComponent("finiteuses")
        bullfighting:RemoveComponent("inventoryitem")
        bullfighting:RemoveComponent("deployable")
        bullfighting:RemoveTag("horn")
        bullfighting:AddComponent("named")
        bullfighting.components.named:SetName("Bullfighting")
        bullfighting:AddComponent("locomotor")
        bullfighting.components.locomotor.walkspeed = math.random(4,6)
        bullfighting.components.locomotor.runspeed = math.random(8,10)
        bullfighting:SetStateGraph("SGBeefalo")
        local brain = require "brains/leifbrain"
        bullfighting:SetBrain(brain)
        bullfighting:AddComponent("follower")
        bullfighting:AddComponent("knownlocations")
        bullfighting:AddComponent("lootdropper")
        bullfighting.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","beefalowool","beefalowool","beefalowool","beefalowool"})
        bullfighting.components.lootdropper:AddChanceLoot("horn", 0.1)
        bullfighting:AddComponent("health")
        bullfighting.components.health:SetMaxHealth(math.random(3000,7000))
        bullfighting:AddComponent("combat")
        bullfighting.components.combat:SetTarget(GetPlayer())
        bullfighting.components.combat.hiteffectsymbol = "beefalo_body"
        bullfighting.components.combat:SetDefaultDamage(math.random(30,70))
        bullfighting.components.combat:SetAttackPeriod(math.random(1,3))
        bullfighting.components.combat:SetRetargetFunction(1, function(bullfighting)
            if not bullfighting.components.health:IsDead() then
               return FindEntity(bullfighting, 200, function(guy)
                    if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("bullfighting") then
                       return guy:HasTag("player")
                    end
               end )
            end
        end )
        bullfighting.components.combat:SetKeepTargetFunction(function(bullfighting, target) return target and target:IsValid() end )
        bullfighting:ListenForEvent("death", function()
            for k = 1, 30 do
                local goldnugget = SpawnPrefab("goldnugget")
                GetPlayer().components.inventory:GiveItem(goldnugget)
            end
            GetPlayer():StartThread(function()
                for k = 1, math.random(3,10) do
                    GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
                    local bounty = SpawnPrefab("goldnugget")
                    bounty.Transform:SetPosition(pt.x, pt.y, pt.z)
                    bounty.components.inventoryitem.canbepickedup = false
	            bounty:AddComponent("complexprojectile")
	            bounty.components.complexprojectile.yOffset = 2.5
                    bounty.components.complexprojectile:Launch(Point(pt.x+(math.random(6,10)-math.random(5)), 0, pt.z+(math.random(6,10)-math.random(5))))
	            bounty.components.complexprojectile:SetOnHit(function()
                        bounty:RemoveComponent("complexprojectile")
                        bounty.components.inventoryitem.canbepickedup = true
                    end )
                    Sleep(0.15)
                end
            end )
        end )
        bullfighting:DoTaskInTime(60, function()
            if not bullfighting.components.health:IsDead() then
               SpawnPrefab("die_fx").Transform:SetPosition(bullfighting.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
               bullfighting:Remove()
            end
        end )
        bullfighting:AddTag("bullfighting")
    end
    bullring0:AddTag("bullring0")
    local bullring1 = SpawnPrefab("horn")
    bullring1.Transform:SetPosition(pt.x+2.5, 0, pt.z-2.5)
    bullring1.AnimState:SetBank("marble_trees")
    bullring1.AnimState:SetBuild("marble_trees")
    bullring1.AnimState:PlayAnimation("full_4")
    bullring1.Transform:SetScale(0.8, 0.8, 0.8)
    bullring1:RemoveComponent("instrument")
    bullring1:RemoveComponent("tool")
    bullring1:RemoveComponent("finiteuses")
    bullring1:RemoveComponent("inventoryitem")
    bullring1:RemoveComponent("deployable")
    bullring1:RemoveTag("horn")
    bullring1:AddTag("NOCLICK")
    bullring1:AddTag("nobullring")
    local bullring2 = SpawnPrefab("horn")
    bullring2.Transform:SetPosition(pt.x-2.5, 0, pt.z+2.5)
    bullring2.AnimState:SetBank("marble_trees")
    bullring2.AnimState:SetBuild("marble_trees")
    bullring2.AnimState:PlayAnimation("full_4")
    bullring2.Transform:SetScale(0.8, 0.8, 0.8)
    bullring2:RemoveComponent("instrument")
    bullring2:RemoveComponent("tool")
    bullring2:RemoveComponent("finiteuses")
    bullring2:RemoveComponent("inventoryitem")
    bullring2:RemoveComponent("deployable")
    bullring2:RemoveTag("horn")
    bullring2:AddTag("NOCLICK")
    bullring2:AddTag("nobullring")
    for k = 0,6 do
        local audience = SpawnPrefab("horn")
        audience.Transform:SetPosition(pt.x-2+6-k*2, 0, pt.z-2-6+k*2)
        audience.AnimState:SetBank("wilson")
        local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
        local buildname = names[math.random(#names)]
        audience.AnimState:SetBuild(buildname)
        local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"}
        local hat = hats[math.random(#hats)]
        audience.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
        local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"}
        local armor = armors[math.random(#armors)]
        audience.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
        audience.AnimState:Show("HAT")
        audience.AnimState:Show("HAT_HAIR")
        audience.AnimState:Hide("HAIR_NOHAT")
        audience.AnimState:Hide("HAIR")
        audience.AnimState:Hide("ARM_carry")
        audience.AnimState:Show("ARM_normal")
        local stories = {"idle","hungry","eat","dart","throw","atk","idle_onemanband1_loop","run_pst","item_hat","give"}
        local story = stories[math.random(#stories)]
        audience.AnimState:PlayAnimation(story,true)
        audience.Transform:SetFourFaced()
        audience:RemoveComponent("instrument")
        audience:RemoveComponent("tool")
        audience:RemoveComponent("finiteuses")
        audience:RemoveComponent("inventoryitem")
        audience:RemoveComponent("deployable")
        audience:RemoveTag("horn")
        audience:AddTag("NOCLICK")
        audience:AddTag("nobullring")
    end
end
local function OnDeploy (inst, pt)
    makebullring(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("bullring0") then
        data.bullring0 = true
    end
    if inst:HasTag("bullfighting") then
        data.bullfighting = true
    end
    if inst:HasTag("nobullring") then
        data.nobullring = true
    end
end
local function onload(inst, data)
    if data and data.bullring0 then
       makebullring(inst)
       inst:Remove()
    end
    if data and data.bullfighting then
       inst:Remove()
    end
    if data and data.nobullring then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ţֶţмĴʯţ1սʤɻ30ƽĽֱӷƷʹ⡢ţëսƷδܻʤ1ӺţʧÿγĹţѪࡢٶȶͬδӮ´βʤŶйΪȲʣʤǻӻƽȣΪĽҪţˣôҵмĴʯ




.֣ÿ⵽ڶ˵ķ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("frograin")һвݣ

local function OnNight(inst)
    local player = GetPlayer()
    local pt = Vector3(player.Transform:GetWorldPosition())
    local nummerms = math.random(15)
    local ground = GetWorld()
    if math.random()< .2 then 
        for k = 1, nummerms do
            local theta = 1 * 2 * PI
            local radius = 12
            local result_offset = FindValidPositionByFan(theta, radius, nummerms, function(offset)
                local x,y,z = (pt + offset):Get()
                local ents = TheSim:FindEntities(x,y,z , 1)
                return not next(ents) 
            end)
            if result_offset and ground.Map:GetTileAtPoint((pt + result_offset):Get()) ~= GROUND.IMPASSABLE then
                local merm = SpawnPrefab("merm")
                merm.Transform:SetPosition((pt + result_offset):Get())
                merm.components.combat.target = player
                GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                local fx = SpawnPrefab("collapse_small")
                local pos = pt + result_offset
                fx.Transform:SetPosition(pos.x, pos.y, pos.z)
            end
        end
    end
end
    inst:ListenForEvent( "dusktime", function() OnNight( inst ) end, GetWorld()) 

    ڵʱÿһ⵽ڶˣķʱͺƴˣʱܣǻʱռȵ˯ʱٸ




.ˣÿʱѰӮ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("hunter")һвݣ

local function OnDay(inst)
    local names = {"trinket_1","trinket_2","trinket_3","trinket_4","trinket_5","trinket_6","trinket_7","trinket_8","trinket_9","trinket_10","trinket_11","trinket_12"}
    inst.name = names[math.random(#names)]
    local player = GetPlayer()
    local pt = Vector3(player.Transform:GetWorldPosition())
    local gold = SpawnPrefab(inst.name)
    gold.Transform:SetPosition(pt.x+(math.random(500)-math.random(500)), 0, pt.z+(math.random(500)-math.random(500)))
    gold:RemoveComponent("tradable")
    gold:RemoveComponent("stackable")
    local minimap = gold.entity:AddMiniMapEntity()
    minimap:SetIcon( "abigail_flower.png" )
    inst:DoTaskInTime(60+math.random(5), function()
        if not gold.components.inventoryitem:IsHeld() then
           SpawnPrefab("collapse_small").Transform:SetPosition(gold.Transform:GetWorldPosition())
           SpawnPrefab("collapse_small").Transform:SetPosition(player.Transform:GetWorldPosition())
           player.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
        else
           for k = 1, 10+math.random(10) do
           SpawnPrefab("goldnugget").Transform:SetPosition(player.Transform:GetWorldPosition())
           player.SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
           end
        end
        gold:Remove()
    end)
end
    inst:ListenForEvent( "daytime", function() OnDay(inst) end, GetWorld())

    ÿʱֱ12ղƷ֮һСͼϽʾ컨ͼ꣬1ڼ񵽾Ϳɻý𣬴ʱ䱦ｫʧһ̾˵ѰʧܣѰʱҲѾ񵽱Ļ10-20ƽĽڽ£ע⣬пܳںϣû޸Ĺͼȫǿɶɺֻ̾




һ.޾񣨵·ƽַ׬ͽ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\homesign.luaļinst:AddComponent("inspectable")һвݣ

local function GetStatus(inst)
    if not inst:HasTag("westart") then
       GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
       inst:AddTag("westart")
       inst.AnimState:SetMultColour(255/255,0/255,0/255,1)
       local names = {"spiderqueen","deerclops","leif_sparse","minotaur","knight","bishop","rook","firehound"}
       local name = names[math.random(#names)]
       local bonuspoints = math.random(6)
       local pt = inst:GetPosition()
       local wanted = SpawnPrefab(name)
       wanted.Transform:SetPosition(pt.x+(math.random(300)-math.random(300)), 0, pt.z+(math.random(300)-math.random(300)))
       wanted.components.health:SetMaxHealth(1000 * bonuspoints)
       wanted.components.health:DoDelta(1000 * bonuspoints)
       wanted.AnimState:SetMultColour(255/255,0/255,0/255,1)
       wanted.Transform:SetScale(1.5, 1.5, 1.5)
       local minimap = wanted.entity:AddMiniMapEntity()
       minimap:SetIcon( "lucy_axe.png" )
       wanted:ListenForEvent("death", function()
           inst:RemoveTag("westart")
           inst.AnimState:SetMultColour(35/255,105/255,235/255,1)
           for k = 1, 20*bonuspoints do
               SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
           end
       end )
       inst:DoTaskInTime(180, function()
           if not wanted.components.health:IsDead() then
              SpawnPrefab("die_fx").Transform:SetPosition(wanted.Transform:GetWorldPosition())
              SpawnPrefab("die_fx").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition())
              GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
              wanted:Remove()
              inst:RemoveTag("westart")
              inst.AnimState:SetMultColour(35/255,105/255,235/255,1)
           end
       end)
    end
end
    inst.components.inspectable.getstatus = GetStatus
    inst.AnimState:SetMultColour(35/255,105/255,235/255,1)

    ɵ·ƽ񣬵ͼλýһͨĹȫɫСͼʾΪɫͼ꣬Ѫ1000-6000㣬ɹƷ־1ֻӵ6000Ѫ3ڣϷ6Сʱҵɱַɹͽߣʱʧܣ̣ͨĹｫ˼ͽΪ20-120ƽɱĹѪԽߣͽԽߡпܳںϣû޸Ĺͼȫǿɶɺֻ̾ˡһ޾ϵͳͬʱ޸ˡͳСͽװĲϼѪӴ˿ʼͽ˵İ




һһ.޽Զż̳500ƽѪֵ100㣩

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļݣ

        inst:AddComponent("health")
        inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH)
        inst.components.health.nofadeout = true
        -------
        
        inst:AddComponent("hunger")
        inst.components.hunger:SetMax(TUNING.WILSON_HUNGER)
        inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)
        inst.components.hunger:SetKillRate(TUNING.WILSON_HEALTH/TUNING.STARVE_KILL_TIME)

        
        inst:AddComponent("sanity")
        inst.components.sanity:SetMax(TUNING.WILSON_SANITY)
        inst.components.sanity.onSane = OnSane
        inst.components.sanity.onInsane = OnInsane

    滻Ϊ

local function newupgrades(inst)
	inst.components.health.maxhealth = TUNING.WILSON_HEALTH + inst.level_num*100
	inst.components.hunger.max = TUNING.WILSON_HUNGER + inst.level_num*100
	inst.components.sanity.max = TUNING.WILSON_SANITY + inst.level_num*100
end
        inst.level_num = 0
        inst:AddComponent("health")
        inst.components.health:SetMaxHealth(TUNING.WILSON_HEALTH + inst.level_num*100)
        inst.components.health.nofadeout = true
        inst:AddComponent("hunger")
        inst.components.hunger:SetMax(TUNING.WILSON_HUNGER + inst.level_num*100)
        inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)
        inst.components.hunger:SetKillRate(TUNING.WILSON_HEALTH/TUNING.STARVE_KILL_TIME)
        inst:AddComponent("sanity")
        inst.components.sanity:SetMax(TUNING.WILSON_SANITY + inst.level_num*100)
        inst.components.sanity.onSane = OnSane
        inst.components.sanity.onInsane = OnInsane
        newupgrades(inst)
local function onsave(inst, data)
    data.level_num = inst.level_num
end
local function onload(inst, data)
    inst.level_num = data.level_num or 0
    inst.components.health.maxhealth = TUNING.WILSON_HEALTH + inst.level_num*100
    inst.components.hunger.max = TUNING.WILSON_HUNGER + inst.level_num*100
    inst.components.sanity.max = TUNING.WILSON_SANITY + inst.level_num*100
    if data.health and data.health.health then inst.components.health.currenthealth = data.health.health end
    if data.hunger and data.hunger.hunger then inst.components.hunger.current = data.hunger.hunger end
    if data.sanity and data.sanity.current then inst.components.sanity.current = data.sanity.current end
end
    inst.OnSave = onsave
    inst.OnLoad = onload


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\altar_prototyper.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    local player = GetPlayer()
    if player.components.inventory:Has("goldnugget", 500) then
       if item.prefab == "goldnugget" then
        return true
        end
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item.prefab == "goldnugget" then
       giver.components.inventory:ConsumeByName("goldnugget", 499)
       giver.level_num = giver.level_num + 1
       inst.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
       giver.HUD.controls.status.heart:PulseGreen()
       giver.HUD.controls.status.stomach:PulseGreen()
       giver.HUD.controls.status.brain:PulseGreen()
       giver.HUD.controls.status.brain:ScaleTo(1.3,1,.7)
       giver.HUD.controls.status.heart:ScaleTo(1.3,1,.7)
       giver.HUD.controls.status.stomach:ScaleTo(1.3,1,.7)
       giver.components.health.maxhealth = TUNING.WILSON_HEALTH + giver.level_num*100
       giver.components.hunger.max = TUNING.WILSON_HUNGER + giver.level_num*100
       giver.components.sanity.max = TUNING.WILSON_SANITY + giver.level_num*100
       giver.components.health:DoDelta(giver.components.health.maxhealth)
       giver.components.hunger:DoDelta(giver.components.hunger.max)
       giver.components.sanity:DoDelta(giver.components.sanity.max)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ɸԶż̳500ƽŻƽԶż̳Ѫֵ100㣬ޣϻƽ500ʱȱٻƽ𣬿޸ġгʳꡱ̷ӻչСղƷСղƷڻгȽϵͳ׬ȡƽ𣨼޸ļɣûˣwx78ʿֶԣʱҪ޸Ĵ




һ.ԸأƽƤֵл»ƽ꣬ӵģ

    ü±ϷĿ¼\data\scripts\prefabs\pond.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if item.prefab == "goldnugget" then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if GetPlayer().components.kramped and GetPlayer().components.kramped.threshold > 0 then
       GetPlayer().components.kramped.threshold = GetPlayer().components.kramped.threshold -1
       GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/krampus/beenbad_lvl3")
    end
    if math.random()<.1 then
       GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic")
       inst:StartThread(function()
           for k = 1, 50 do
               local pt = Vector3(giver.Transform:GetWorldPosition())
               local gold = SpawnPrefab("goldnugget")
               gold.Transform:SetPosition(pt.x+(math.random(5)-math.random(5)), 20, pt.z+(math.random(5)-math.random(5)))
               gold.components.inventoryitem.canbepickedup = false
               inst:DoTaskInTime(1.8, function()
                   local pos = Vector3(gold.Transform:GetWorldPosition())
                   local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)
                   for k,v in pairs(ents) do
                       if v:HasTag("player") then
                          v.components.inventory:GiveItem(gold)
                       end
                   end
               end)
               inst:DoTaskInTime(2, function()
                    local pt2 = gold:GetPosition()
                    if not gold.components.inventoryitem:IsHeld() then
                       GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop")
                       SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(pt2.x, 0, pt2.z)
                       gold:Remove()
                    else
                       gold.components.inventoryitem.canbepickedup = true
                    end
               end)
               Sleep(1)
           end
           GetPlayer().SoundEmitter:KillSound("beavermusic")
       end)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ŻƽԳÿһƤֵɱСĳͷϢûдϢʾƤֵѾΪ㣬ѾˡԸĹУһƽ꣨50ƽ𣩣ƽصɲǣӵ͹ˣܵƽλãˤ飬ķӦ




һ.ǿţǿͨð֣֮ɱӣǿɵûƽ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļ"puppet_wes",һв"puppet_woodie",


    2.ü±ϷĿ¼\data\scripts\prefabs\adventure_portal.luaļinst:AddComponent("inspectable")һвݣ

local function createbandit(inst)
  for k = 1,math.random(20,35) do
    local pt = inst:GetPosition()
    local bandit = SpawnPrefab("beardhair")
    bandit.Transform:SetPosition(pt.x+(math.random(50)-math.random(50)), 0, pt.z+(math.random(50)-math.random(50)))
    bandit.AnimState:SetBank("wilson")
    bandit.AnimState:SetBuild("woodie")
    bandit.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")
    bandit.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")
    bandit.AnimState:Show("HAT")
    bandit.AnimState:Show("HAT_HAIR")
    bandit.AnimState:Hide("HAIR_NOHAT")
    bandit.AnimState:Hide("HAIR")
    bandit.AnimState:Hide("ARM_carry")
    bandit.AnimState:Show("ARM_normal")
    bandit.AnimState:PlayAnimation("idle")
    local sound = bandit.entity:AddSoundEmitter()
    local shadow = bandit.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    bandit.Transform:SetFourFaced()
    local brain = require "brains/frogbrain"
    bandit:SetBrain(brain)
    bandit:AddComponent("locomotor")
    bandit.components.locomotor.walkspeed = 5
    bandit.components.locomotor.runspeed = 10
    bandit:SetStateGraph("SGshadowwaxwell")
    MakeCharacterPhysics(bandit, 75, .5)
    bandit:RemoveComponent("inventoryitem")
    bandit:RemoveComponent("stackable")
    bandit:RemoveComponent("fuel")
    bandit:RemoveComponent("burnable")
    bandit:RemoveComponent("propagator")
    bandit:AddComponent("inventory")
    bandit:AddComponent("thief")
    bandit:AddComponent("knownlocations")
    bandit:AddComponent("health")
    bandit.components.health:SetMaxHealth(1500)
    bandit:ListenForEvent("death", function()
        local pt1 = bandit:GetPosition()
        for k = 1,math.random(15,25) do
            local gold = SpawnPrefab("goldnugget")
            gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
        end
        if math.random() < 0.1 then
           local weapons = {"goldenaxe","spear","tentaclespike","batbat","ruins_bat"}
           local weapon = weapons[math.random(#weapons)]
           SpawnPrefab(weapon).Transform:SetPosition(pt1.x, 0, pt1.z)
        end
    end )
    bandit:AddComponent("combat")
    bandit.components.combat:SetDefaultDamage(20)
    bandit.components.combat:SetAttackPeriod(1)
    bandit.components.combat:SetRetargetFunction(2, function(bandit)
        if not bandit.components.health:IsDead() then
            return FindEntity(bandit, 20, function(guy)
                return bandit.components.combat:CanTarget(guy) and not guy:HasTag("bandits")
            end )
        end
    end )
    bandit.components.combat.onhitotherfn = function(bandit, other, damage) bandit.components.thief:StealItem(other) end
    bandit:ListenForEvent("attacked", function(bandit, data)
        bandit.components.combat:SetTarget(data.attacker)
        bandit.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("bandits") and not dude.components.health:IsDead() end, 5)
    end )
    bandit.Physics:SetCollisionCallback(function(bandit, other)
        if other and other.components.workable and other.components.workable.workleft > 0 then
           other.components.workable:Destroy(bandit)
        end
    end)
    bandit:DoPeriodicTask(1, function(bandit)
        local pos = Vector3(bandit.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)
        for k,v in pairs(ents) do
            if v.components.pickable and v.components.pickable:CanBePicked() then
               v.components.pickable:Pick(bandit)
            end
            if v.components.crop then
               v.components.crop:Harvest(bandit)
            end
        end
    end )
    local minimap = bandit.entity:AddMiniMapEntity()
    minimap:SetIcon( "lucy_axe.png" )
    bandit:AddTag("monster")
    bandit:AddTag("bandits")
  end
end
local function delbandit(inst)
    local range = 3000
    local pos = Vector3(inst.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v:HasTag("bandits") then
           v:Remove()
        end
    end
end
    inst:ListenForEvent( "daytime", function() createbandit(inst) end , GetWorld())
    inst:ListenForEvent( "nighttime", function() delbandit(inst) end , GetWorld())


    3.ü±ϷĿ¼\data\scripts\prefabs\beardhair.luaļAsset("ANIM", "anim/beardhair.zip"),һвݣ

	Asset("ANIM", "anim/woodie.zip"),
	Asset("SOUND", "sound/woodie.fsb"),


    4.inst:AddComponent("inspectable")һвݣ

local names = {"swap_goldenaxe","swap_spear","swap_spike","swap_batbat","swap_ruins_bat"}
local weapon = names[math.random(#names)]
local items = { SWORD = weapon }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function onsave(inst, data)
    if inst:HasTag("bandits") then
        data.bandits = true
    end
end
local function onload(inst, data)
  if data and data.bandits then
    inst.AnimState:SetBank("wilson")
    inst.AnimState:SetBuild("woodie")
    inst.AnimState:OverrideSymbol("swap_hat", "hat_feather", "swap_hat")
    inst.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")
    inst.AnimState:Show("HAT")
    inst.AnimState:Show("HAT_HAIR")
    inst.AnimState:Hide("HAIR_NOHAT")
    inst.AnimState:Hide("HAIR")
    inst.AnimState:Hide("ARM_carry")
    inst.AnimState:Show("ARM_normal")
    inst.AnimState:PlayAnimation("idle")
    local sound = inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    inst.Transform:SetFourFaced()
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 5
    inst.components.locomotor.runspeed = 10
    inst:SetStateGraph("SGshadowwaxwell")
    MakeCharacterPhysics(inst, 75, .5)
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:AddComponent("inventory")
    inst:AddComponent("thief")
    inst:AddComponent("knownlocations")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(1500)
    inst:ListenForEvent("death", function()
        local pt1 = inst:GetPosition()
        for k = 1,math.random(15,25) do
            local gold = SpawnPrefab("goldnugget")
            gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
        end
        if math.random() < 0.1 then
           local weapons = {"goldenaxe","spear","tentaclespike","batbat","ruins_bat"}
           local weapon = weapons[math.random(#weapons)]
           SpawnPrefab(weapon).Transform:SetPosition(pt1.x, 0, pt1.z)
        end
    end )
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(20)
    inst.components.combat:SetAttackPeriod(1)
    inst.components.combat:SetRetargetFunction(2, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 20, function(guy)
                return inst.components.combat:CanTarget(guy) and not guy:HasTag("bandits")
            end )
        end
    end )
    inst.components.combat.onhitotherfn = function(inst, other, damage) inst.components.thief:StealItem(other) end
    inst:ListenForEvent("attacked", function(inst, data)
        inst.components.combat:SetTarget(data.attacker)
        inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("bandits") and not dude.components.health:IsDead() end, 5)
    end )
    inst.Physics:SetCollisionCallback(function(inst, other)
        if other and other.components.workable and other.components.workable.workleft > 0 then
           other.components.workable:Destroy(inst)
        end
    end)
    inst:DoPeriodicTask(1, function(inst)
        local pos = Vector3(inst.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)
        for k,v in pairs(ents) do
            if v.components.pickable and v.components.pickable:CanBePicked() then
               v.components.pickable:Pick(inst)
            end
            if v.components.crop then
               v.components.crop:Harvest(inst)
            end
        end
    end )
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "lucy_axe.png" )
    inst:AddTag("monster")
    inst:AddTag("bandits")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    кǿͨð֮Ĵ½޸ĺ2糿֣ǽ̾ð֮Ÿٻɭ֡ٽũ֮ûлڡͨСͼɲѯǿλãʾΪ츫ͼꡣǿսʱǻϵƷҸǿһΧ㣬ȡưɡӴð֮ΧͰΣյģֻڵҹԴϢ֮ʡǿɻսƷƵĻƽһʵͬʱ޸ˡӶս֮ءͬǣشΣ㣬ȥǿɣǿճ־õķҲٵսÿһѪȥ֤һľӴ˵




һ.Ķͯʱй¶֣ʩƽ뿪ֱҹ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("clock")һвݣ

local function createbeggar(inst)
  for k = 1,math.random(3,7) do
    local pt = GetPlayer():GetPosition()
    local beggar = SpawnPrefab("foliage")
    beggar.Transform:SetPosition(pt.x+(math.random(50)-math.random(50)), 0, pt.z+(math.random(50)-math.random(50)))
    beggar.AnimState:SetBank("wilson")
    local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    local buildname = names[math.random(#names)]
    beggar.AnimState:SetBuild(buildname)
    beggar.Transform:SetScale(0.8, 0.8, 0.8)
    beggar.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")
    beggar.AnimState:Hide("ARM_carry")
    beggar.AnimState:Show("ARM_normal")
    beggar.AnimState:PlayAnimation("idle")
    local sound = beggar.entity:AddSoundEmitter()
    local shadow = beggar.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    beggar.Transform:SetFourFaced()
    local brain = require "brains/chesterbrain"
    beggar:SetBrain(brain)
    beggar:AddComponent("knownlocations")
    beggar:AddComponent("locomotor")
    beggar.components.locomotor.walkspeed = 5
    beggar.components.locomotor.runspeed = 15
    beggar:SetStateGraph("SGshadowwaxwell")
    MakeCharacterPhysics(beggar, 50, .5)
    beggar:RemoveComponent("stackable")
    beggar:RemoveComponent("tradable")
    beggar:RemoveComponent("fuel")
    beggar:RemoveComponent("inventoryitem")
    beggar:RemoveComponent("edible")
    beggar:RemoveComponent("perishable")
    beggar:RemoveComponent("burnable")
    beggar:RemoveComponent("propagator")
    beggar:RemoveTag("cattoy")
    beggar:AddComponent("follower")
    beggar.components.follower:SetLeader(GetPlayer())
    beggar:AddComponent("health")
    beggar.components.health:SetMaxHealth(500)
    beggar.components.health:SetInvincible(true)
    beggar.components.health.nofadeout = true
    beggar:AddComponent("combat")
    beggar:DoPeriodicTask(math.random(10,60), function(beggar)
        beggar.SoundEmitter:PlaySound("dontstarve/characters/willow/hurt")
        beggar.AnimState:PlayAnimation("hungry")
    end )
    beggar:AddComponent("trader")
    beggar.components.trader:SetAcceptTest(function(beggar, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 10) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    beggar.components.trader.onaccept = function(beggar, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        GetPlayer().components.sanity:DoDelta(5)
        beggar.components.locomotor:Stop()
        beggar:SetBrain(nil)
        beggar.components.follower:SetLeader(nil)
        beggar.AnimState:PlayAnimation("idle_onemanband1_loop",true)
        beggar:DoTaskInTime(5, function() beggar:Remove() end )
    end
    beggar:ListenForEvent( "nighttime", function()
        beggar.components.locomotor:Stop()
        beggar:SetBrain(nil)
        beggar.components.follower:SetLeader(nil)
        beggar.AnimState:PlayAnimation("idle_shiver_pre")
        beggar.AnimState:PushAnimation("idle_shiver_loop")
        beggar.AnimState:PushAnimation("idle_shiver_pst", false)
        beggar:RemoveComponent("trader")
        beggar:DoTaskInTime(math.random(1,6), function()
            beggar.components.health:SetInvincible(false)
            beggar.components.health:Kill()
        end )
    end, GetWorld())
    beggar:ListenForEvent("death", function()
        GetPlayer():DoTaskInTime(2, function()
            GetPlayer().components.sanity:DoDelta(-10)
        end )
    end )
    beggar:AddTag("beggars")
  end
end
    inst:ListenForEvent( "daytime", function() if math.random()<.3 then createbeggar(inst) end end , GetWorld())


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\foliage.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("beggars") then
        data.beggars = true
    end
end
local function onload(inst, data)
  if data and data.beggars then
    inst.AnimState:SetBank("wilson")
    local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    local buildname = names[math.random(#names)]
    inst.AnimState:SetBuild(buildname)
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")
    inst.AnimState:Hide("ARM_carry")
    inst.AnimState:Show("ARM_normal")
    inst.AnimState:PlayAnimation("idle")
    local sound = inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    inst.Transform:SetFourFaced()
    local brain = require "brains/chesterbrain"
    inst:SetBrain(brain)
    inst:AddComponent("knownlocations")
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 5
    inst.components.locomotor.runspeed = 15
    inst:SetStateGraph("SGshadowwaxwell")
    MakeCharacterPhysics(inst, 50, .5)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveTag("cattoy")
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(500)
    inst.components.health:SetInvincible(true)
    inst.components.health.nofadeout = true
    inst:AddComponent("combat")
    inst:DoPeriodicTask(math.random(10,60), function(inst)
        inst.SoundEmitter:PlaySound("dontstarve/characters/willow/hurt")
        inst.AnimState:PlayAnimation("hungry")
    end )
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 10) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        GetPlayer().components.sanity:DoDelta(5)
        inst.components.locomotor:Stop()
        inst:SetBrain(nil)
        inst.components.follower:SetLeader(nil)
        inst.AnimState:PlayAnimation("idle_onemanband1_loop",true)
        inst:DoTaskInTime(5, function() inst:Remove() end )
    end
    inst:ListenForEvent( "nighttime", function()
        inst.components.locomotor:Stop()
        inst:SetBrain(nil)
        inst.components.follower:SetLeader(nil)
        inst.AnimState:PlayAnimation("idle_shiver_pre")
        inst.AnimState:PushAnimation("idle_shiver_loop")
        inst.AnimState:PushAnimation("idle_shiver_pst", false)
        inst:RemoveComponent("trader")
        inst:DoTaskInTime(math.random(1,6), function()
            inst.components.health:SetInvincible(false)
            inst.components.health:Kill()
        end )
    end, GetWorld())
    inst:ListenForEvent("death", function()
        GetPlayer():DoTaskInTime(2, function()
            GetPlayer().components.sanity:DoDelta(-10)
        end )
    end )
    inst:AddTag("beggars")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɿһصϷģʽڼຮ֮أʧȥ˵Ķ̼ͯѾվȽŸ㣬ΰǡʱй¶ֻ֣Ҫ10ƽŻƽԶܸͯǼ±ͯ뿪Ҳ5ԣ㲻ԸҲκ鷳ֻĬĬظ棬һʩᡣҹʱǽǰΪ֮ݣ㽫10ԣʹϧһСȥȥδӣԼҪ롰Ұ֮ǡһͬ޸




һ.𣨴½ϲڳ岿䣬ǽԴ֮ദأ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("clock")һвݣ

local function createpigtent(inst)
    local pt = Vector3(GetPlayer().Transform:GetWorldPosition())
    local ground = GetWorld()
    local result_offset = FindValidPositionByFan(math.random()*2*PI, math.random(50, 80), 100, function(offset)
        local x,y,z = (pt + offset):Get()
        local ents = TheSim:FindEntities(x,y,z , 1)
        return not next(ents) 
    end)
    if result_offset and ground.Map:GetTileAtPoint((pt + result_offset):Get()) ~= GROUND.IMPASSABLE then
       local pigtent = SpawnPrefab("mosquitosack")
       pigtent.Transform:SetPosition((pt + result_offset):Get())
       pigtent.AnimState:SetBank("tent")
       pigtent.AnimState:SetBuild("tent")
       pigtent.AnimState:PlayAnimation("idle", true)
       local minimap = pigtent.entity:AddMiniMapEntity()
       minimap:SetIcon( "tent.png" )
       pigtent.AnimState:SetMultColour(255/255,0/255,0/255,1)
       pigtent.Transform:SetScale(2, 2, 2)
       pigtent:RemoveComponent("stackable")
       pigtent:RemoveComponent("inventoryitem")
       pigtent:RemoveComponent("healer")
       pigtent:RemoveComponent("burnable")
       pigtent:RemoveComponent("propagator")
       pigtent:RemoveTag("cattoy")
       pigtent:AddTag("pigtents")
       pigtent:AddComponent("workable")
       pigtent.components.workable:SetWorkAction(ACTIONS.HAMMER)
       pigtent.components.workable:SetWorkLeft(15)
       pigtent.components.workable:SetOnFinishCallback(function(pigtent)
           SpawnPrefab("collapse_big").Transform:SetPosition(pigtent.Transform:GetWorldPosition())
           GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
           pigtent:Remove()
       end )
       pigtent.components.workable:SetOnWorkCallback(function(pigtent, worker, workleft)
           local pos = Vector3(pigtent.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 100)
           for k,v in pairs(ents) do
               if v:HasTag("pignpcs") then
                  v.components.combat:SetTarget(worker)
               end
           end
       end)
       pigtent:ListenForEvent( "daytime", function()
         for k = 1,math.random(7,15) do
             local pt1 = pigtent:GetPosition()
             local pignpc = SpawnPrefab("mosquitosack")
             pignpc.Transform:SetPosition(pt1.x+(math.random(20)-math.random(20)), 0, pt1.z+(math.random(20)-math.random(20)))
             pignpc.entity:AddSoundEmitter()
             local shadow = pignpc.entity:AddDynamicShadow()
             shadow:SetSize( 1.5, .75 )
             pignpc.AnimState:SetBank("pigman")
             pignpc.AnimState:SetBuild("pig_guard_build")
             pignpc.Transform:SetFourFaced()
             pignpc.Transform:SetScale(1.2, 1.2, 1.2)
             MakeCharacterPhysics(pignpc, 50, .5)
             local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter"}
             local hat = hats[math.random(#hats)]
             pignpc.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
             pignpc.AnimState:Show("hat")
             pignpc.AnimState:PlayAnimation("idle_loop")
             local brain = require "brains/leifbrain"
             pignpc:SetBrain(brain)
             local minimap = pignpc.entity:AddMiniMapEntity()
             minimap:SetIcon( "pigking.png" )
             pignpc:AddComponent("locomotor")
             pignpc.components.locomotor.walkspeed = 5
             pignpc.components.locomotor.runspeed = 10
             pignpc:SetStateGraph("SGpig")
             pignpc:RemoveComponent("stackable")
             pignpc:RemoveComponent("inventoryitem")
             pignpc:RemoveComponent("healer")
             pignpc:RemoveComponent("burnable")
             pignpc:RemoveComponent("propagator")
             pignpc:RemoveTag("cattoy")
             pignpc:AddComponent("inventory")
             pignpc:AddComponent("follower")
             pignpc:AddComponent("knownlocations")
             pignpc:AddComponent("lootdropper")
             pignpc.components.lootdropper:SetLoot({"meat", "meat"})
             pignpc:AddComponent("health")
             pignpc.components.health:SetMaxHealth(1000)
             pignpc:AddComponent("combat")
             pignpc.components.combat:SetDefaultDamage(20)
             pignpc.components.combat:SetAttackPeriod(1)
             pignpc.components.combat:SetRetargetFunction(3, function(pignpc)
                 if not pignpc.components.health:IsDead() then
                    return FindEntity(pignpc, 20, function(guy)
                         if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("npcs") then
                            return guy:HasTag("monster") or guy:HasTag("smallcreature")
                         end
                    end )
                 end
             end )
             pignpc.components.combat:SetKeepTargetFunction(function(pignpc, target) return target and target:IsValid() end )
             pignpc:ListenForEvent("attacked", function(pignpc, data)
                 pignpc.components.combat:SetTarget(data.attacker)
                 pignpc.components.combat:ShareTarget(data.attacker, 50, function(dude) return dude:HasTag("pignpcs") and not dude.components.health:IsDead() end, 10)
             end )
             pignpc:DoPeriodicTask(1, function(pignpc)
               if not pignpc.components.health:IsDead() then
                 local pos = Vector3(pignpc.Transform:GetWorldPosition())
                 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)
                 for k,v in pairs(ents) do
                     if v.components.pickable and v.components.pickable:CanBePicked() then
                        v.components.pickable:Pick(pignpc)
                     end
                     if v.components.crop then
                        v.components.crop:Harvest(pignpc)
                     end
                     if v:HasTag("tree") and v.components.workable and v.components.workable.workleft > 0 then
                        v.components.workable:Destroy(pignpc)
                     end
                     if v.components.edible and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
                        v:Remove()
                     end
                 end
               end
             end )
             pignpc:ListenForEvent("death", function()
                 for k = 1,math.random(1,3) do
                     local pt2 = pignpc:GetPosition()
                     local gold = SpawnPrefab("goldnugget")
                     gold.Transform:SetPosition(pt2.x+(math.random(3)-math.random(3)), 0, pt2.z+(math.random(3)-math.random(3)))
                 end
             end )
             pignpc:ListenForEvent( "daytime", function() pignpc:Remove() end , GetWorld())
             pignpc:AddTag("pignpcs")
         end
       end , GetWorld())
    end
end
    inst:ListenForEvent( "nighttime", function() if math.random()<0.2 then createpigtent(inst) end end , GetWorld())


    2.ü±ϷĿ¼\data\scripts\prefabs\mosquitosack.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("pigtents") then
        data.pigtents = true
    end
    if inst:HasTag("pignpcs") then
        data.pignpcs = true
    end
end
local function onload(inst, data)
    if data and data.pigtents then
       inst.AnimState:SetBank("tent")
       inst.AnimState:SetBuild("tent")
       inst.AnimState:PlayAnimation("idle", true)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "tent.png" )
       inst.AnimState:SetMultColour(255/255,0/255,0/255,1)
       inst.Transform:SetScale(2, 2, 2)
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("healer")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveTag("cattoy")
       inst:AddTag("pigtents")
       inst:AddComponent("workable")
       inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
       inst.components.workable:SetWorkLeft(15)
       inst.components.workable:SetOnFinishCallback(function(inst)
           SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
           GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
           inst:Remove()
       end )
       inst.components.workable:SetOnWorkCallback(function(inst, worker, workleft)
           local pos = Vector3(inst.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 100)
           for k,v in pairs(ents) do
               if v:HasTag("pignpcs") then
                  v.components.combat:SetTarget(worker)
               end
           end
       end)
       inst:ListenForEvent( "daytime", function()
         for k = 1,math.random(7,15) do
             local pt1 = inst:GetPosition()
             local pignpc = SpawnPrefab("mosquitosack")
             pignpc.Transform:SetPosition(pt1.x+(math.random(20)-math.random(20)), 0, pt1.z+(math.random(20)-math.random(20)))
             pignpc.entity:AddSoundEmitter()
             local shadow = pignpc.entity:AddDynamicShadow()
             shadow:SetSize( 1.5, .75 )
             pignpc.AnimState:SetBank("pigman")
             pignpc.AnimState:SetBuild("pig_guard_build")
             pignpc.Transform:SetFourFaced()
             pignpc.Transform:SetScale(1.2, 1.2, 1.2)
             MakeCharacterPhysics(pignpc, 50, .5)
             local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter"}
             local hat = hats[math.random(#hats)]
             pignpc.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
             pignpc.AnimState:Show("hat")
             pignpc.AnimState:PlayAnimation("idle_loop")
             local brain = require "brains/leifbrain"
             pignpc:SetBrain(brain)
             local minimap = pignpc.entity:AddMiniMapEntity()
             minimap:SetIcon( "pigking.png" )
             pignpc:AddComponent("locomotor")
             pignpc.components.locomotor.walkspeed = 5
             pignpc.components.locomotor.runspeed = 10
             pignpc:SetStateGraph("SGpig")
             pignpc:RemoveComponent("stackable")
             pignpc:RemoveComponent("inventoryitem")
             pignpc:RemoveComponent("healer")
             pignpc:RemoveComponent("burnable")
             pignpc:RemoveComponent("propagator")
             pignpc:RemoveTag("cattoy")
             pignpc:AddComponent("inventory")
             pignpc:AddComponent("follower")
             pignpc:AddComponent("knownlocations")
             pignpc:AddComponent("lootdropper")
             pignpc.components.lootdropper:SetLoot({"meat", "meat"})
             pignpc:AddComponent("health")
             pignpc.components.health:SetMaxHealth(1000)
             pignpc:AddComponent("combat")
             pignpc.components.combat:SetDefaultDamage(20)
             pignpc.components.combat:SetAttackPeriod(1)
             pignpc.components.combat:SetRetargetFunction(3, function(pignpc)
                 if not pignpc.components.health:IsDead() then
                    return FindEntity(pignpc, 20, function(guy)
                         if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("npcs") then
                            return guy:HasTag("monster") or guy:HasTag("smallcreature")
                         end
                    end )
                 end
             end )
             pignpc.components.combat:SetKeepTargetFunction(function(pignpc, target) return target and target:IsValid() end )
             pignpc:ListenForEvent("attacked", function(pignpc, data)
                 pignpc.components.combat:SetTarget(data.attacker)
                 pignpc.components.combat:ShareTarget(data.attacker, 50, function(dude) return dude:HasTag("pignpcs") and not dude.components.health:IsDead() end, 10)
             end )
             pignpc:DoPeriodicTask(1, function(pignpc)
               if not pignpc.components.health:IsDead() then
                 local pos = Vector3(pignpc.Transform:GetWorldPosition())
                 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)
                 for k,v in pairs(ents) do
                     if v.components.pickable and v.components.pickable:CanBePicked() then
                        v.components.pickable:Pick(pignpc)
                     end
                     if v.components.crop then
                        v.components.crop:Harvest(pignpc)
                     end
                     if v:HasTag("tree") and v.components.workable and v.components.workable.workleft > 0 then
                        v.components.workable:Destroy(pignpc)
                     end
                     if v.components.edible and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
                        v:Remove()
                     end
                 end
               end
             end )
             pignpc:ListenForEvent("death", function()
                 for k = 1,math.random(1,3) do
                     local pt2 = pignpc:GetPosition()
                     local gold = SpawnPrefab("goldnugget")
                     gold.Transform:SetPosition(pt2.x+(math.random(3)-math.random(3)), 0, pt2.z+(math.random(3)-math.random(3)))
                 end
             end )
             pignpc:ListenForEvent( "daytime", function() pignpc:Remove() end , GetWorld())
             pignpc:AddTag("pignpcs")
         end
       end , GetWorld())
    end
    if data and data.pignpcs then
       inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize( 1.5, .75 )
       inst.AnimState:SetBank("pigman")
       inst.AnimState:SetBuild("pig_guard_build")
       inst.Transform:SetFourFaced()
       inst.Transform:SetScale(1.2, 1.2, 1.2)
       MakeCharacterPhysics(inst, 50, .5)
       local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter"}
       local hat = hats[math.random(#hats)]
       inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
       inst.AnimState:Show("hat")
       inst.AnimState:PlayAnimation("idle_loop")
       local brain = require "brains/leifbrain"
       inst:SetBrain(brain)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "pigking.png" )
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 5
       inst.components.locomotor.runspeed = 10
       inst:SetStateGraph("SGpig")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("healer")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveTag("cattoy")
       inst:AddComponent("inventory")
       inst:AddComponent("follower")
       inst:AddComponent("knownlocations")
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"meat", "meat"})
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(1000)
       inst:AddComponent("combat")
       inst.components.combat:SetDefaultDamage(20)
       inst.components.combat:SetAttackPeriod(1)
       inst.components.combat:SetRetargetFunction(3, function(inst)
           if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                   if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("npcs") then
                      return guy:HasTag("monster") or guy:HasTag("smallcreature")
                   end
              end )
           end
       end )
       inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
       inst:ListenForEvent("attacked", function(inst, data)
           inst.components.combat:SetTarget(data.attacker)
           inst.components.combat:ShareTarget(data.attacker, 50, function(dude) return dude:HasTag("pignpcs") and not dude.components.health:IsDead() end, 10)
       end )
       inst:DoPeriodicTask(1, function(inst)
         if not inst.components.health:IsDead() then
           local pos = Vector3(inst.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3)
           for k,v in pairs(ents) do
               if v.components.pickable and v.components.pickable:CanBePicked() then
                  v.components.pickable:Pick(inst)
               end
               if v.components.crop then
                  v.components.crop:Harvest(inst)
               end
               if v:HasTag("tree") and v.components.workable and v.components.workable.workleft > 0 then
                  v.components.workable:Destroy(inst)
               end
               if v.components.edible and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
                  v:Remove()
               end
           end
         end
       end )
       inst:ListenForEvent("death", function()
           for k = 1,math.random(1,3) do
               local pt2 = inst:GetPosition()
               local gold = SpawnPrefab("goldnugget")
               gold.Transform:SetPosition(pt2.x+(math.random(3)-math.random(3)), 0, pt2.z+(math.random(3)-math.random(3)))
           end
       end )
       inst:ListenForEvent( "daytime", function() inst:Remove() end , GetWorld())
       inst:AddTag("pignpcs")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڴ½ϲڳ˵ӪأɫĴ񣩣½࣬㣨ṥ½ϵԴǻῳɭ֡ԡɼһпԲɼֲũǣ⵽ֿǵӪأҲΪˣΧǽȦҲԥز˺ƽദǵĲ׳󣬻ΪУϵؽɱǰǰһѡ⡣ӪСͼʾΪͼ꣬ʾΪͼꡣô15¿ɲٺɫ񣬱岿䣬ڵڶʱȥ




һ.ӰأҹĹдε֮Ǳ꣩

    1.ü±ϷĿ¼\data\scripts\prefabs\gravestone.luaļinst:AddComponent("inspectable")һвݣ

local function createghostnpc(inst)
    for k = 1,math.random(3,7) do
        local pt = inst:GetPosition()
        local ghostnpc = SpawnPrefab("deadlyfeast")
        ghostnpc.Transform:SetPosition(pt.x+(math.random(20)-math.random(20)), 0, pt.z+(math.random(20)-math.random(20)))
        ghostnpc.entity:AddSoundEmitter()
        ghostnpc.AnimState:SetBank("ghost")
        ghostnpc.AnimState:SetBuild("ghost_build")
        ghostnpc.AnimState:PlayAnimation("idle", true)
        ghostnpc.Transform:SetFourFaced()
        MakeGhostPhysics(ghostnpc, 1, .5)
        local minimap = ghostnpc.entity:AddMiniMapEntity()
        minimap:SetIcon("whitespider_den.png")
        ghostnpc.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        local light = ghostnpc.entity:AddLight()
        light:SetIntensity(.6)
        light:SetRadius(.5)
        light:SetFalloff(.6)
        light:Enable(true)
        light:SetColour(180/255, 195/255, 225/255)
        local brain = require "brains/leifbrain"
        ghostnpc:SetBrain(brain)
        ghostnpc:AddComponent("locomotor")
        ghostnpc.components.locomotor.walkspeed = 5
        ghostnpc.components.locomotor.runspeed = 5
        ghostnpc:SetStateGraph("SGghost")
        ghostnpc:AddTag("ghostnpcs")
        ghostnpc:RemoveComponent("edible")
        ghostnpc:RemoveComponent("inventoryitem")
        ghostnpc:RemoveTag("meat")
        ghostnpc:AddComponent("sanityaura")
        ghostnpc.components.sanityaura.aura = -TUNING.SANITYAURA_SMALL
        ghostnpc:AddComponent("health")
        ghostnpc.components.health:SetMaxHealth(500)
        ghostnpc:AddComponent("trader")
        ghostnpc.components.trader:SetAcceptTest(function(ghostnpc, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 30) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        ghostnpc.components.trader.onaccept = function(ghostnpc, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 29)
            local ghostheart = SpawnPrefab("deadlyfeast")
            ghostheart.AnimState:SetBank("egg")
            ghostheart.AnimState:SetBuild("tallbird_egg")
            ghostheart.AnimState:PlayAnimation("cooked")
            ghostheart.components.inventoryitem:ChangeImageName("tallbirdegg_cooked")
            ghostheart:RemoveComponent("edible")
            ghostheart:RemoveTag("meat")
            ghostheart:AddComponent("equippable")
            ghostheart.components.equippable:SetOnEquip( function(ghostheart, owner)
                if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then
                   owner.components.locomotor:Stop()
                   owner.components.playercontroller:Enable(false)
                   owner:DoTaskInTime(0.3, function()
                       SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                       owner.AnimState:SetBank("ghost")
                       owner.AnimState:SetBuild("ghost_build")
                       owner:SetStateGraph("SGghost")
                       owner.AnimState:PlayAnimation("idle", true)
                       owner.Transform:SetScale(1.2,1.2,1.2)
                       local shadow = owner.entity:AddDynamicShadow()
                       shadow:SetSize( 0, 0 )
                       owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                       local light = owner.entity:AddLight()
                       light:SetIntensity(.6)
                       light:SetRadius(20)
                       light:SetFalloff(.6)
                       light:Enable(true)
                       light:SetColour(180/255, 195/255, 225/255)
                       owner.components.locomotor.walkspeed = 20
                       owner.components.locomotor.runspeed = 20
                       owner.components.health:DoDelta(owner.components.health.maxhealth)
                       owner.components.health:SetInvincible(true)
                       owner.components.hunger:DoDelta(owner.components.hunger.max)
                       owner.components.hunger:Pause()
                       owner.components.sanity:DoDelta(owner.components.sanity.max)
                       owner.components.sanity.ignore = true
                       owner.components.combat:SetDefaultDamage(1000)
                       owner:AddComponent("aura")
                       owner.components.aura.radius = 3
                       owner.components.aura.tickperiod = 0.5
                       owner.components.aura.ignoreallies = true
                       owner.components.aura.auratestfn = function(ghostnpc, target)
                           if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then
                              return true
                           end
                           return false
                       end
                       owner.components.temperature:SetTemp(20)
                       owner.components.playercontroller:Enable(true)
                   end )
                end
            end )
            ghostheart.components.equippable:SetOnUnequip( function(ghostheart, owner)
                SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                owner.components.locomotor:Stop()
                owner.components.playercontroller:Enable(false)
                owner:DoTaskInTime(0.3, function() 
                    owner.AnimState:SetBank("wilson")
                    if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end
                    if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end
                    if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end
                    if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end
                    if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end
                    if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end
                    if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end
                    if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end
                    if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end
                    if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end
                    if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end
                    owner:SetStateGraph("SGwilson")
                    owner.AnimState:PlayAnimation("idle")
                    owner.Transform:SetScale(1,1,1)
                    local shadow = owner.entity:AddDynamicShadow()
                    shadow:SetSize( 1.3, .6 )
                    owner.AnimState:SetBloomEffectHandle("")
                    owner.Light:Enable(false)
                    owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
                    owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
                    owner.components.health:SetInvincible(false)
                    owner.components.hunger:Resume()
                    owner.components.sanity.ignore = false
                    owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
                    owner.components.combat.hiteffectsymbol = "torso"
                    owner:RemoveComponent("aura")
                    owner.components.temperature:SetTemp(nil)
                    owner.components.playercontroller:Enable(true)
                    ghostheart:Remove()
                end )
            end )
            ghostheart.components.equippable.equipslot = EQUIPSLOTS.HANDS
            ghostheart:AddTag("ghostheart")
            GetPlayer().components.inventory:GiveItem(ghostheart)
        end
        ghostnpc:AddComponent("combat")
        ghostnpc.components.combat:SetDefaultDamage(3)
        ghostnpc.components.combat:SetAttackPeriod(1)
        ghostnpc.components.combat:SetRetargetFunction(2, function(ghostnpc)
            if not ghostnpc.components.health:IsDead() then
                return FindEntity(ghostnpc, 25, function(guy)
                    if guy:HasTag("monster") then return guy end
                    if guy:HasTag("player") and guy.components.inventory and not guy.components.inventory:FindItem(function(item) return item.prefab == "nightmarefuel" end ) then return guy end
                end )
            end
        end )
        ghostnpc:ListenForEvent("attacked", function(ghostnpc, data)
            ghostnpc.components.combat:SetTarget(data.attacker)
            ghostnpc.components.combat:ShareTarget(data.attacker, 35, function(dude) return dude:HasTag("ghostnpcs") and not dude.components.health:IsDead() end, 5)
        end )
        ghostnpc:AddComponent("aura")
        ghostnpc.components.aura.radius = 2
        ghostnpc.components.aura.tickperiod = 1
        ghostnpc.components.aura.ignoreallies = true
        ghostnpc.components.aura.auratestfn = function(ghostnpc, target)
          if target:HasTag("ghostnpcs") then return false end
          if target.components.combat.target == ghostnpc or ghostnpc.components.combat.target == target then
             return true
          end
        end
        ghostnpc:ListenForEvent("death", function()
            local gems = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem","thulecite","goldnugget"}
            local gem = gems[math.random(#gems)]
            SpawnPrefab(gem).Transform:SetPosition(ghostnpc.Transform:GetWorldPosition())
        end )
        ghostnpc:ListenForEvent( "daytime", function() ghostnpc:Remove() end , GetWorld())
    end
end
    inst:ListenForEvent( "dusktime", function() createghostnpc(inst) end , GetWorld())


    2.ü±ϷĿ¼\data\scripts\prefabs\deadlyfeast.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("ghostnpcs") then
        data.ghostnpcs = true
    end
    if inst:HasTag("ghostheart") then
        data.ghostheart = true
    end
end
local function onload(inst, data)
    if data and data.ghostnpcs then
        inst.entity:AddSoundEmitter()
        inst.AnimState:SetBank("ghost")
        inst.AnimState:SetBuild("ghost_build")
        inst.AnimState:PlayAnimation("idle", true)
        inst.Transform:SetFourFaced()
        MakeGhostPhysics(inst, 1, .5)
        local minimap = inst.entity:AddMiniMapEntity()
        minimap:SetIcon("whitespider_den.png")
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        local light = inst.entity:AddLight()
        light:SetIntensity(.6)
        light:SetRadius(.5)
        light:SetFalloff(.6)
        light:Enable(true)
        light:SetColour(180/255, 195/255, 225/255)
        local brain = require "brains/leifbrain"
        inst:SetBrain(brain)
        inst:AddComponent("locomotor")
        inst.components.locomotor.walkspeed = 5
        inst.components.locomotor.runspeed = 5
        inst:SetStateGraph("SGghost")
        inst:AddTag("ghostnpcs")
        inst:RemoveComponent("edible")
        inst:RemoveComponent("inventoryitem")
        inst:RemoveTag("meat")
        inst:AddComponent("sanityaura")
        inst.components.sanityaura.aura = -TUNING.SANITYAURA_SMALL
        inst:AddComponent("health")
        inst.components.health:SetMaxHealth(500)
        inst:AddComponent("trader")
        inst.components.trader:SetAcceptTest(function(inst, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 30) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        inst.components.trader.onaccept = function(inst, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 29)
            local ghostheart = SpawnPrefab("deadlyfeast")
            ghostheart.AnimState:SetBank("egg")
            ghostheart.AnimState:SetBuild("tallbird_egg")
            ghostheart.AnimState:PlayAnimation("cooked")
            ghostheart.components.inventoryitem:ChangeImageName("tallbirdegg_cooked")
            ghostheart:RemoveComponent("edible")
            ghostheart:RemoveTag("meat")
            ghostheart:AddComponent("equippable")
            ghostheart.components.equippable:SetOnEquip( function(ghostheart, owner)
                if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then
                   owner.components.locomotor:Stop()
                   owner.components.playercontroller:Enable(false)
                   owner:DoTaskInTime(0.3, function()
                       SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                       owner.AnimState:SetBank("ghost")
                       owner.AnimState:SetBuild("ghost_build")
                       owner:SetStateGraph("SGghost")
                       owner.AnimState:PlayAnimation("idle", true)
                       owner.Transform:SetScale(1.2,1.2,1.2)
                       local shadow = owner.entity:AddDynamicShadow()
                       shadow:SetSize( 0, 0 )
                       owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                       local light = owner.entity:AddLight()
                       light:SetIntensity(.6)
                       light:SetRadius(20)
                       light:SetFalloff(.6)
                       light:Enable(true)
                       light:SetColour(180/255, 195/255, 225/255)
                       owner.components.locomotor.walkspeed = 20
                       owner.components.locomotor.runspeed = 20
                       owner.components.health:DoDelta(owner.components.health.maxhealth)
                       owner.components.health:SetInvincible(true)
                       owner.components.hunger:DoDelta(owner.components.hunger.max)
                       owner.components.hunger:Pause()
                       owner.components.sanity:DoDelta(owner.components.sanity.max)
                       owner.components.sanity.ignore = true
                       owner.components.combat:SetDefaultDamage(1000)
                       owner:AddComponent("aura")
                       owner.components.aura.radius = 3
                       owner.components.aura.tickperiod = 0.5
                       owner.components.aura.ignoreallies = true
                       owner.components.aura.auratestfn = function(inst, target)
                           if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then
                              return true
                           end
                           return false
                       end
                       owner.components.temperature:SetTemp(20)
                       owner.components.playercontroller:Enable(true)
                   end )
                end
            end )
            ghostheart.components.equippable:SetOnUnequip( function(ghostheart, owner)
                SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                owner.components.locomotor:Stop()
                owner.components.playercontroller:Enable(false)
                owner:DoTaskInTime(0.3, function() 
                    owner.AnimState:SetBank("wilson")
                    if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end
                    if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end
                    if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end
                    if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end
                    if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end
                    if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end
                    if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end
                    if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end
                    if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end
                    if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end
                    if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end
                    owner:SetStateGraph("SGwilson")
                    owner.AnimState:PlayAnimation("idle")
                    owner.Transform:SetScale(1,1,1)
                    local shadow = owner.entity:AddDynamicShadow()
                    shadow:SetSize( 1.3, .6 )
                    owner.AnimState:SetBloomEffectHandle("")
                    owner.Light:Enable(false)
                    owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
                    owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
                    owner.components.health:SetInvincible(false)
                    owner.components.hunger:Resume()
                    owner.components.sanity.ignore = false
                    owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
                    owner.components.combat.hiteffectsymbol = "torso"
                    owner:RemoveComponent("aura")
                    owner.components.temperature:SetTemp(nil)
                    owner.components.playercontroller:Enable(true)
                    ghostheart:Remove()
                end )
            end )
            ghostheart.components.equippable.equipslot = EQUIPSLOTS.HANDS
            ghostheart:AddTag("ghostheart")
            GetPlayer().components.inventory:GiveItem(ghostheart)
        end
        inst:AddComponent("combat")
        inst.components.combat:SetDefaultDamage(3)
        inst.components.combat:SetAttackPeriod(1)
        inst.components.combat:SetRetargetFunction(2, function(inst)
            if not inst.components.health:IsDead() then
                return FindEntity(inst, 25, function(guy)
                    if guy:HasTag("monster") then return guy end
                    if guy:HasTag("player") and guy.components.inventory and not guy.components.inventory:FindItem(function(item) return item.prefab == "nightmarefuel" end ) then return guy end
                end )
            end
        end )
        inst:ListenForEvent("attacked", function(inst, data)
            inst.components.combat:SetTarget(data.attacker)
            inst.components.combat:ShareTarget(data.attacker, 35, function(dude) return dude:HasTag("ghostnpcs") and not dude.components.health:IsDead() end, 5)
        end )
        inst:AddComponent("aura")
        inst.components.aura.radius = 2
        inst.components.aura.tickperiod = 1
        inst.components.aura.ignoreallies = true
        inst.components.aura.auratestfn = function(inst, target)
          if target:HasTag("ghostnpcs") then return false end
          if target.components.combat.target == inst or inst.components.combat.target == target then
             return true
          end
        end
        inst:ListenForEvent("death", function()
            local gems = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem","thulecite","goldnugget"}
            local gem = gems[math.random(#gems)]
            SpawnPrefab(gem).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end )
        inst:ListenForEvent( "daytime", function() inst:Remove() end , GetWorld())
    end
    if data and data.ghostheart then
            inst.AnimState:SetBank("egg")
            inst.AnimState:SetBuild("tallbird_egg")
            inst.AnimState:PlayAnimation("cooked")
            inst.components.inventoryitem:ChangeImageName("tallbirdegg_cooked")
            inst:RemoveComponent("edible")
            inst:RemoveTag("meat")
            inst:AddComponent("equippable")
            inst.components.equippable:SetOnEquip( function(inst, owner)
                if owner == GetPlayer() and not GetPlayer():HasTag("poisoning") and not GetPlayer():HasTag("fever") then
                   owner.components.locomotor:Stop()
                   owner.components.playercontroller:Enable(false)
                   owner:DoTaskInTime(0.3, function()
                       SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                       owner.AnimState:SetBank("ghost")
                       owner.AnimState:SetBuild("ghost_build")
                       owner:SetStateGraph("SGghost")
                       owner.AnimState:PlayAnimation("idle", true)
                       owner.Transform:SetScale(1.2,1.2,1.2)
                       local shadow = owner.entity:AddDynamicShadow()
                       shadow:SetSize( 0, 0 )
                       owner.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                       local light = owner.entity:AddLight()
                       light:SetIntensity(.6)
                       light:SetRadius(20)
                       light:SetFalloff(.6)
                       light:Enable(true)
                       light:SetColour(180/255, 195/255, 225/255)
                       owner.components.locomotor.walkspeed = 20
                       owner.components.locomotor.runspeed = 20
                       owner.components.health:DoDelta(owner.components.health.maxhealth)
                       owner.components.health:SetInvincible(true)
                       owner.components.hunger:DoDelta(owner.components.hunger.max)
                       owner.components.hunger:Pause()
                       owner.components.sanity:DoDelta(owner.components.sanity.max)
                       owner.components.sanity.ignore = true
                       owner.components.combat:SetDefaultDamage(1000)
                       owner:AddComponent("aura")
                       owner.components.aura.radius = 3
                       owner.components.aura.tickperiod = 0.5
                       owner.components.aura.ignoreallies = true
                       owner.components.aura.auratestfn = function(ghostnpc, target)
                           if target.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == target then
                              return true
                           end
                           return false
                       end
                       owner.components.temperature:SetTemp(20)
                       owner.components.playercontroller:Enable(true)
                   end )
                end
            end )
            inst.components.equippable:SetOnUnequip( function(inst, owner)
                SpawnPrefab("collapse_big").Transform:SetPosition(owner.Transform:GetWorldPosition())
                owner.components.locomotor:Stop()
                owner.components.playercontroller:Enable(false)
                owner:DoTaskInTime(0.3, function() 
                    owner.AnimState:SetBank("wilson")
                    if GetPlayer().prefab == "wilson" then owner.AnimState:SetBuild("wilson") end
                    if GetPlayer().prefab == "wendy" then owner.AnimState:SetBuild("wendy") end
                    if GetPlayer().prefab == "wes" then owner.AnimState:SetBuild("wes") end
                    if GetPlayer().prefab == "wickerbottom" then owner.AnimState:SetBuild("wickerbottom") end
                    if GetPlayer().prefab == "willow" then owner.AnimState:SetBuild("willow") end
                    if GetPlayer().prefab == "wolfgang" then owner.AnimState:SetBuild("wolfgang") end
                    if GetPlayer().prefab == "wx78" then owner.AnimState:SetBuild("wx78") end
                    if GetPlayer().prefab == "woodie" then owner.AnimState:SetBuild("woodie") end
                    if GetPlayer().prefab == "waxwell" then owner.AnimState:SetBuild("waxwell") end
                    if GetPlayer().prefab == "wathgrithr" then owner.AnimState:SetBuild("wathgrithr") end
                    if GetPlayer().prefab == "webber" then owner.AnimState:SetBuild("webber") end
                    owner:SetStateGraph("SGwilson")
                    owner.AnimState:PlayAnimation("idle")
                    owner.Transform:SetScale(1,1,1)
                    local shadow = owner.entity:AddDynamicShadow()
                    shadow:SetSize( 1.3, .6 )
                    owner.AnimState:SetBloomEffectHandle("")
                    owner.Light:Enable(false)
                    owner.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
                    owner.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
                    owner.components.health:SetInvincible(false)
                    owner.components.hunger:Resume()
                    owner.components.sanity.ignore = false
                    owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
                    owner.components.combat.hiteffectsymbol = "torso"
                    owner:RemoveComponent("aura")
                    owner.components.temperature:SetTemp(nil)
                    owner.components.playercontroller:Enable(true)
                    inst:Remove()
                end )
            end )
            inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
            inst:AddTag("ghostheart")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ҹʱĹдε㣬ҿǻήԣɻñʯʯƽСͼʾΪ֩ͼꡣЯجȼϣͲ㣬30ƽŻƽɹ֮ģװɱ꣬ȫCtrl + κιĵ˶ᱻԶж֮ļɱˣͬʱ֮ʧٱͶһЩɡ޸ˡСС֡Ǹðʳжʱװ֮Ҳ




һ.ǶʯֽǶǶ׬Ҳɹۿ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\thulecite.luaļinst:AddComponent("inspectable")һвݣ

local names = {"swap_goldenaxe","swap_spear","swap_spike","swap_batbat","swap_ruins_bat"}
local weapon = names[math.random(#names)]
local items = { SWORD = weapon }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function fightgame(inst)
    local pt = inst:GetPosition()
    local gamehost = SpawnPrefab("thulecite")
    gamehost.Transform:SetPosition(pt.x, pt.y, pt.z)
    gamehost.AnimState:SetBank("wilson")
    gamehost.AnimState:SetBuild("wolfgang")
    gamehost.AnimState:OverrideSymbol("swap_hat", "hat_top", "swap_hat")
    gamehost.AnimState:Show("HAT")
    gamehost.AnimState:Show("HAT_HAIR")
    gamehost.AnimState:Hide("HAIR_NOHAT")
    gamehost.AnimState:Hide("HAIR")
    gamehost.AnimState:Hide("ARM_carry")
    gamehost.AnimState:Show("ARM_normal")
    gamehost.Transform:SetFourFaced()
    gamehost.AnimState:PlayAnimation("idle")
    gamehost:RemoveComponent("repairer")
    gamehost:RemoveComponent("edible")
    gamehost:RemoveComponent("tradable")
    gamehost:RemoveComponent("inventoryitem")
    gamehost:RemoveComponent("stackable")
    gamehost:RemoveComponent("deployable")
    gamehost:RemoveComponent("bait")
    gamehost:RemoveTag("molebait")
    gamehost:AddTag("gamehost")
    gamehost:AddComponent("workable")
    gamehost.components.workable:SetWorkAction(ACTIONS.HAMMER)
    gamehost.components.workable:SetWorkLeft(3)
    gamehost.components.workable:SetOnFinishCallback(function(gamehost)
        local pos = Vector3(gamehost.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 50)
        for k,v in pairs(ents) do
            if v:HasTag("candel") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               v:Remove()
            end
        end
        gamehost:Remove()
    end )
    local fountain = SpawnPrefab("thulecite")
    fountain.Transform:SetPosition(pt.x-11, 0, pt.z-11)
    fountain.AnimState:SetBank("staff_purple_base")
    fountain.AnimState:SetBuild("staff_purple_base")
    fountain.AnimState:PlayAnimation("idle_full_loop")
    fountain.Transform:SetScale(1.5, 1.5, 1.5)
    fountain.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    fountain.AnimState:SetLayer( LAYER_BACKGROUND )
    fountain.AnimState:SetSortOrder( 1 )
    fountain.Transform:SetRotation( 45 )
    fountain:AddTag("NOCLICK")
    fountain:RemoveComponent("repairer")
    fountain:RemoveComponent("edible")
    fountain:RemoveComponent("tradable")
    fountain:RemoveComponent("inventoryitem")
    fountain:RemoveComponent("stackable")
    fountain:RemoveComponent("deployable")
    fountain:RemoveComponent("bait")
    fountain:RemoveTag("molebait")
    local light = fountain.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(18)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    fountain:AddTag("candel")
    local pt0 = Vector3(fountain.Transform:GetWorldPosition())
    for k = 1, 60 do
        local result_offset = FindValidPositionByFan(1 * 2 * PI, 12, 60, function(offset)
            local x,y,z = (pt0 + offset):Get()
            local ents = TheSim:FindEntities(x,y,z , 1)
            return not next(ents) 
        end)
        if result_offset then
           local fence = SpawnPrefab("thulecite")
           fence.AnimState:SetBank("marble_pillar")
           fence.AnimState:SetBuild("marble_pillar")
           fence.AnimState:PlayAnimation("full")
           MakeObstaclePhysics(fence, 1)
           fence:RemoveComponent("repairer")
           fence:RemoveComponent("edible")
           fence:RemoveComponent("tradable")
           fence:RemoveComponent("inventoryitem")
           fence:RemoveComponent("stackable")
           fence:RemoveComponent("deployable")
           fence:RemoveComponent("bait")
           fence:RemoveTag("molebait")
           fence:AddTag("candel")
           fence.Transform:SetPosition((pt0 + result_offset):Get())
        end
    end
    gamehost:AddComponent("trader")
    gamehost.components.trader:SetAcceptTest(function(gamehost, item) 
      if not gamehost:HasTag("startgame") then
        if GetPlayer().components.inventory:Has("goldnugget", 100) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
      end
      return false
    end )
    gamehost.components.trader.onaccept = function(gamehost, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 99)
        GetPlayer().components.locomotor:Stop()
        GetPlayer().Transform:SetPosition(pt.x-11+5, 0, pt.z-11-5)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
        gamehost:AddTag("startgame")
        local warrior0 = SpawnPrefab("thulecite")
        warrior0.Transform:SetPosition(pt.x-11-5, 0, pt.z-11+5)
        warrior0.AnimState:SetBank("wilson")
        local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
        local buildname = names[math.random(#names)]
        warrior0.AnimState:SetBuild(buildname)
        local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"}
        local hat = hats[math.random(#hats)]
        warrior0.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
        local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"}
        local armor = armors[math.random(#armors)]
        warrior0.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
        warrior0.AnimState:Show("HAT")
        warrior0.AnimState:Show("HAT_HAIR")
        warrior0.AnimState:Hide("HAIR_NOHAT")
        warrior0.AnimState:Hide("HAIR")
        warrior0.AnimState:Hide("ARM_carry")
        warrior0.AnimState:Show("ARM_normal")
        warrior0.AnimState:PlayAnimation("idle")
        warrior0.Transform:SetFourFaced()
        local sound = warrior0.entity:AddSoundEmitter()
        local shadow = warrior0.entity:AddDynamicShadow()
        shadow:SetSize( 1.3, .6 )
        local brain = require "brains/frogbrain"
        warrior0:SetBrain(brain)
        warrior0:AddComponent("locomotor")
        warrior0.components.locomotor.walkspeed = 5
        warrior0.components.locomotor.runspeed = 10
        warrior0:SetStateGraph("SGshadowwaxwell")
        MakeCharacterPhysics(warrior0, 75, .5)
        warrior0:RemoveComponent("repairer")
        warrior0:RemoveComponent("edible")
        warrior0:RemoveComponent("tradable")
        warrior0:RemoveComponent("inventoryitem")
        warrior0:RemoveComponent("stackable")
        warrior0:RemoveComponent("deployable")
        warrior0:RemoveComponent("bait")
        warrior0:RemoveTag("molebait")
        warrior0:AddComponent("inventory")
        warrior0:AddComponent("knownlocations")
        warrior0:AddComponent("health")
        warrior0.components.health:SetMaxHealth(math.random(2500,5000))
        warrior0:AddComponent("combat")
        warrior0.components.combat:SetDefaultDamage(math.random(25,50))
        warrior0.components.combat:SetAttackPeriod(2)
        warrior0.components.combat:SetRetargetFunction(1, function(warrior0)
            if not warrior0.components.health:IsDead() then
                return FindEntity(warrior0, 30, function(guy)
                    return guy:HasTag("player")
                end )
            end
        end )
        warrior0:DoPeriodicTask(1, function(warrior0)
            if not warrior0:HasTag("noplay") then
               if warrior0.components.health.currenthealth <= 100 then
                  warrior0:AddTag("noplay")
                  warrior0.components.combat:SetTarget(nil)
                  warrior0.components.combat:SetRetargetFunction(100, nil )
               end
               if GetPlayer().components.health.currenthealth <= 51 then
                  warrior0.components.locomotor:Stop()
                  warrior0:SetBrain(nil)
                  warrior0:AddTag("noplay")
                  warrior0.components.combat:SetTarget(nil)
                  warrior0.components.combat:SetRetargetFunction(100, nil )
                  warrior0.components.health:SetInvincible(true)
                  warrior0.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  gamehost:DoTaskInTime(3, function()
                      warrior0:Remove()
                      GetPlayer().components.locomotor:Stop()
                      GetPlayer().Transform:SetPosition(pt.x-1, 0, pt.z+1)
                      if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end
                      gamehost:RemoveTag("startgame")
                  end )
               end
            end
        end )
        warrior0:ListenForEvent("death", function()
            GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
            gamehost:DoTaskInTime(3, function()
                GetPlayer().components.locomotor:Stop()
                GetPlayer().Transform:SetPosition(pt.x-1, 0, pt.z+1)
                for k = 1, 200 do
                    local goldnugget = SpawnPrefab("goldnugget")
                    GetPlayer().components.inventory:GiveItem(goldnugget)
                end
                if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end
                gamehost:RemoveTag("startgame")
            end )
        end )
        warrior0:AddTag("candel")
        gamehost.task = gamehost:DoPeriodicTask(1, function(gamehost)
            local target = FindEntity(fountain, 13, function(guy) 
                return guy:HasTag("player")
            end )
            if not target then
               GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
               warrior0:Remove()
               if gamehost.task then gamehost.task:Cancel() gamehost.task = nil end
               gamehost:RemoveTag("startgame")
            end
        end )
    end
    gamehost.components.inspectable.getstatus = function(gamehost)
        if not gamehost:HasTag("startgame") then
           if GetPlayer().components.inventory:Has("goldnugget", 20) then
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 20)
              GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
              gamehost:AddTag("startgame")
              local warrior1 = SpawnPrefab("thulecite")
              warrior1.Transform:SetPosition(pt.x-11+5, 0, pt.z-11-5)
              warrior1.AnimState:SetBank("wilson")
              local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
              local buildname = names[math.random(#names)]
              warrior1.AnimState:SetBuild(buildname)
              local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"}
              local hat = hats[math.random(#hats)]
              warrior1.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
              local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"}
              local armor = armors[math.random(#armors)]
              warrior1.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
              warrior1.AnimState:Show("HAT")
              warrior1.AnimState:Show("HAT_HAIR")
              warrior1.AnimState:Hide("HAIR_NOHAT")
              warrior1.AnimState:Hide("HAIR")
              warrior1.AnimState:Hide("ARM_carry")
              warrior1.AnimState:Show("ARM_normal")
              warrior1.AnimState:PlayAnimation("idle")
              warrior1.Transform:SetFourFaced()
              local sound = warrior1.entity:AddSoundEmitter()
              local shadow = warrior1.entity:AddDynamicShadow()
              shadow:SetSize( 1.3, .6 )
              local brain = require "brains/frogbrain"
              warrior1:SetBrain(brain)
              warrior1:AddComponent("locomotor")
              warrior1.components.locomotor.walkspeed = 5
              warrior1.components.locomotor.runspeed = 10
              warrior1:SetStateGraph("SGshadowwaxwell")
              MakeCharacterPhysics(warrior1, 75, .5)
              warrior1:RemoveComponent("repairer")
              warrior1:RemoveComponent("edible")
              warrior1:RemoveComponent("tradable")
              warrior1:RemoveComponent("inventoryitem")
              warrior1:RemoveComponent("stackable")
              warrior1:RemoveComponent("deployable")
              warrior1:RemoveComponent("bait")
              warrior1:RemoveTag("molebait")
              warrior1:AddComponent("inventory")
              warrior1:AddComponent("knownlocations")
              warrior1:AddComponent("health")
              warrior1.components.health:SetMaxHealth(math.random(200,500))
              warrior1:AddComponent("combat")
              warrior1.components.combat:SetDefaultDamage(math.random(25,100))
              warrior1.components.combat:SetAttackPeriod(3)
              warrior1.components.combat:SetRetargetFunction(1, function(warrior1)
                  if not warrior1.components.health:IsDead() then
                      return FindEntity(warrior1, 30, function(guy)
                          return guy:HasTag("warrior2")
                      end )
                  end
              end )
              warrior1:AddTag("warrior1")
              warrior1:AddTag("candel")
              local warrior2 = SpawnPrefab("thulecite")
              warrior2.Transform:SetPosition(pt.x-11-5, 0, pt.z-11+5)
              warrior2.AnimState:SetBank("wilson")
              local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
              local buildname = names[math.random(#names)]
              warrior2.AnimState:SetBuild(buildname)
              local hats = {"hat_beefalo","hat_feather","hat_football","hat_ruins","hat_slurper","hat_slurtle","hat_spider"}
              local hat = hats[math.random(#hats)]
              warrior2.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
              local armors = {"armor_grass","armor_marble","armor_ruins","armor_sanity","armor_slurper","armor_wood"}
              local armor = armors[math.random(#armors)]
              warrior2.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
              warrior2.AnimState:Show("HAT")
              warrior2.AnimState:Show("HAT_HAIR")
              warrior2.AnimState:Hide("HAIR_NOHAT")
              warrior2.AnimState:Hide("HAIR")
              warrior2.AnimState:Hide("ARM_carry")
              warrior2.AnimState:Show("ARM_normal")
              warrior2.AnimState:PlayAnimation("idle")
              warrior2.Transform:SetFourFaced()
              local sound = warrior2.entity:AddSoundEmitter()
              local shadow = warrior2.entity:AddDynamicShadow()
              shadow:SetSize( 1.3, .6 )
              local brain = require "brains/frogbrain"
              warrior2:SetBrain(brain)
              warrior2:AddComponent("locomotor")
              warrior2.components.locomotor.walkspeed = 5
              warrior2.components.locomotor.runspeed = 10
              warrior2:SetStateGraph("SGshadowwaxwell")
              MakeCharacterPhysics(warrior2, 75, .5)
              warrior2:RemoveComponent("repairer")
              warrior2:RemoveComponent("edible")
              warrior2:RemoveComponent("tradable")
              warrior2:RemoveComponent("inventoryitem")
              warrior2:RemoveComponent("stackable")
              warrior2:RemoveComponent("deployable")
              warrior2:RemoveComponent("bait")
              warrior2:RemoveTag("molebait")
              warrior2:AddComponent("inventory")
              warrior2:AddComponent("knownlocations")
              warrior2:AddComponent("health")
              warrior2.components.health:SetMaxHealth(math.random(200,500))
              warrior2:AddComponent("combat")
              warrior2.components.combat:SetDefaultDamage(math.random(25,100))
              warrior2.components.combat:SetAttackPeriod(3)
              warrior2.components.combat:SetRetargetFunction(1, function(warrior2)
                  if not warrior2.components.health:IsDead() then
                      return FindEntity(warrior2, 30, function(guy)
                          return guy:HasTag("warrior1")
                      end )
                  end
              end )
              warrior2:AddTag("warrior2")
              warrior2:AddTag("candel")
              warrior1:DoPeriodicTask(1, function(warrior1)
                  if not warrior1:HasTag("noplay") and not warrior2:HasTag("noplay") then
                     if warrior1.components.health.currenthealth <= 100 then
                        warrior1:AddTag("noplay")
                        warrior1.components.combat:SetTarget(nil)
                        warrior1.components.combat:SetRetargetFunction(100, nil )
                     end
                  end
              end )
              warrior2:DoPeriodicTask(1, function(warrior2)
                  if not warrior2:HasTag("noplay") and not warrior1:HasTag("noplay") then
                     if warrior2.components.health.currenthealth <= 100 then
                        warrior2:AddTag("noplay")
                        warrior2.components.combat:SetTarget(nil)
                        warrior2.components.combat:SetRetargetFunction(100, nil )
                     end
                  end
              end )
              warrior1:ListenForEvent("death", function()
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  warrior2.components.locomotor:Stop()
                  warrior2:SetBrain(nil)
                  warrior2.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                  gamehost:DoTaskInTime(3, function() warrior2:Remove() gamehost:RemoveTag("startgame") end )
              end )
              warrior2:ListenForEvent("death", function()
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  warrior1.components.locomotor:Stop()
                  warrior1:SetBrain(nil)
                  warrior1.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                  gamehost:DoTaskInTime(3, function() warrior1:Remove() gamehost:RemoveTag("startgame") end )
              end )
           end
        end
    end
end
local function OnDeploy (inst, pt)
    fightgame(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("candel") then
        data.candel = true
    end
    if inst:HasTag("gamehost") then
        data.gamehost = true
    end
end
local function onload(inst, data)
    if data and data.candel then
       inst:Remove()
    end
    if data and data.gamehost then
       fightgame(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڿĿյϣʯֽǶ1ʯԵҼŶʯ򲻻ֳ20ƽʱϰ壬ԹۿһǶμӽǶ͸ϰ100ƽŻƽϰ㽫ǶǶʿս֣ܶñӽ200ƽѪС50жʧܣֻ㲻𽫲˻أӳΧǽͬжʧܡÿսĶֶͬһʧܣ´βʤŶְҵĽǶʿ




һ.˶ħУӲͷ˶ħУÿ60һϮչɣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\boneshard.luaļinst:AddComponent("inspectable")һвݣ

local function makemagicbox(inst)
    local pt = inst:GetPosition()
    local magicbox = SpawnPrefab("boneshard")
    magicbox.Transform:SetPosition(pt.x, pt.y, pt.z)
    magicbox.AnimState:SetBank("pandoras_chest")
    magicbox.AnimState:SetBuild("pandoras_chest")
    magicbox.AnimState:PlayAnimation("closed")
    magicbox.AnimState:SetMultColour(255/255,0/255,0/255,1)
    magicbox.Transform:SetScale(0.8, 0.8, 0.8)
    magicbox.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    local minimap = magicbox.entity:AddMiniMapEntity()
    minimap:SetIcon( "pandoras_chest.png" )
    magicbox:RemoveComponent("inventoryitem")
    magicbox:RemoveComponent("stackable")
    magicbox:RemoveComponent("deployable")
    magicbox:AddTag("magicbox")
    magicbox:AddComponent("workable")
    magicbox.components.workable:SetWorkAction(ACTIONS.HAMMER)
    magicbox.components.workable:SetWorkLeft(3)
    magicbox.components.workable:SetOnFinishCallback(function(magicbox)
        local pos = Vector3(magicbox.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
        for k,v in pairs(ents) do
            if v:HasTag("bogey") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               v:Remove()
            end
        end
        SpawnPrefab("collapse_big").Transform:SetPosition(magicbox.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        magicbox:Remove()
    end )
    magicbox.components.inspectable.getstatus = function(magicbox)
        if not magicbox:HasTag("makebogey") then
           magicbox:AddTag("makebogey")
           magicbox.AnimState:PlayAnimation("open")
           magicbox:DoTaskInTime(0.5, function(magicbox)
               SpawnPrefab("collapse_small").Transform:SetPosition(magicbox.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
               GetPlayer().components.playercontroller:ShakeCamera(magicbox, "FULL", 2.5, 0.03, 2, 30)
               local pos = Vector3(magicbox.Transform:GetWorldPosition())
               local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
               for k,v in pairs(ents) do
                   if v:HasTag("bogey") then
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      v:Remove()
                   end
               end
               local names = {"spiderqueen","hound","firehound","icehound","killerbee","walrus","leif","leif_sparse","koalefant_summer","koalefant_winter","deerclops","merm","knight","bishop","bat"}
               magicbox.name = names[math.random(#names)]
               for k = 1,math.random(10,30) do
                   local pt0 = magicbox:GetPosition()
                   local ground = GetWorld()
                   local x = pt0.x+(math.random(50)-math.random(50))
                   local z = pt0.z+(math.random(50)-math.random(50))
                   local tile = ground.Map:GetTileAtPoint(x,0, z)
                   if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then
                      local bogey = SpawnPrefab(magicbox.name)
                      bogey.Transform:SetPosition(x,0,z)
                      bogey:AddTag("bogey")
                      bogey.components.combat:SetRetargetFunction(1, function(bogey)
                          if not bogey.components.health:IsDead() then
                              return FindEntity(bogey, 100, function(guy)
                                  if guy.components.health and not guy.components.health:IsDead() then
                                     return guy:HasTag("player")
                                  end
                              end )
                          end
                      end )
                      bogey.components.combat:SetKeepTargetFunction(function(bogey, target) return target and target:IsValid() end )
                      bogey:ListenForEvent("attacked", function(bogey, data)
                          bogey.components.combat:SetTarget(GetPlayer())
                      end )
                   end
               end
           end )
           magicbox.task = magicbox:DoPeriodicTask(60, function(magicbox)
               SpawnPrefab("collapse_small").Transform:SetPosition(magicbox.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
               GetPlayer().components.playercontroller:ShakeCamera(magicbox, "FULL", 2.5, 0.03, 2, 30)
               local pos = Vector3(magicbox.Transform:GetWorldPosition())
               local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
               for k,v in pairs(ents) do
                   if v:HasTag("bogey") then
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      v:Remove()
                   end
               end
               local names = {"spiderqueen","hound","firehound","icehound","killerbee","walrus","leif","leif_sparse","koalefant_summer","koalefant_winter","deerclops","merm","knight","bishop","bat"}
               magicbox.name = names[math.random(#names)]
               for k = 1,math.random(10,30) do
                   local pt0 = magicbox:GetPosition()
                   local ground = GetWorld()
                   local x = pt0.x+(math.random(50)-math.random(50))
                   local z = pt0.z+(math.random(50)-math.random(50))
                   local tile = ground.Map:GetTileAtPoint(x,0, z)
                   if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then
                      local bogey = SpawnPrefab(magicbox.name)
                      bogey.Transform:SetPosition(x,0,z)
                      bogey:AddTag("bogey")
                      bogey.components.combat:SetRetargetFunction(1, function(bogey)
                          if not bogey.components.health:IsDead() then
                              return FindEntity(bogey, 100, function(guy)
                                  if guy.components.health and not guy.components.health:IsDead() then
                                     return guy:HasTag("player")
                                  end
                              end )
                          end
                      end )
                      bogey.components.combat:SetKeepTargetFunction(function(bogey, target) return target and target:IsValid() end )
                      bogey:ListenForEvent("attacked", function(bogey, data)
                          bogey.components.combat:SetTarget(GetPlayer())
                      end )
                   end
               end
           end )
        else
           magicbox:RemoveTag("makebogey")
           magicbox.AnimState:PlayAnimation("close")
           GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
           if magicbox.task then magicbox.task:Cancel() magicbox.task = nil end
           local pos = Vector3(magicbox.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
           for k,v in pairs(ents) do
               if v:HasTag("bogey") then
                  SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                  v:Remove()
               end
           end
        end
    end
end
local function OnDeploy (inst, pt)
    makemagicbox(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("magicbox") then
       data.magicbox = true
    end
end
local function onload(inst, data)
    if data and data.magicbox then
       makemagicbox(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    Ӳͷ˶ħУ1ӲͷԵҼŶ򲻻ֳħУɴ򿪺ӣÿ60뽫һκŽǣԤʾһϮԴԴõҪٴεħУùصСΧħ޽ʩ塢۾ȣͦ60ġ˶ħСͼʾΪԶͼ꣬Ҫ˶ħˣôҵɡӲͷͼϵĹǼܻ




һ.Ѫ壨ռ涴ɵࡢװ˿˹ñô£

    1.ü±ϷĿ¼\data\scripts\prefabs\wormhole.luaļinst:AddComponent("inspectable")һвݣ

local function createsavage(inst)
  for k = 1,math.random(10,15) do
    local pt = inst:GetPosition()
    local savage = SpawnPrefab("hammer")
    savage.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 0, pt.z+(math.random(30)-math.random(30)))
    savage.AnimState:SetBank("wilson")
    savage.AnimState:SetBuild("wolfgang")
    savage.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
    savage.AnimState:OverrideSymbol("swap_body", "torso_rain", "swap_body")
    savage.AnimState:OverrideSymbol("swap_object", "swap_spear_wathgrithr", "swap_spear_wathgrithr")
    savage.AnimState:Show("HAT")
    savage.AnimState:Show("HAT_HAIR")
    savage.AnimState:Hide("HAIR_NOHAT")
    savage.AnimState:Hide("HAIR")
    savage.AnimState:Hide("ARM_normal")
    savage.AnimState:Show("ARM_carry")
    savage.AnimState:PlayAnimation("idle")
    savage.Transform:SetScale(1.2, 1.2, 1.2)
    local sound = savage.entity:AddSoundEmitter()
    local shadow = savage.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    savage.Transform:SetFourFaced()
    MakeCharacterPhysics(savage, 100, .5)
    local minimap = savage.entity:AddMiniMapEntity()
    minimap:SetIcon( "wolfgang.png" )
    savage:AddComponent("locomotor")
    savage.components.locomotor.walkspeed = 4
    savage.components.locomotor.runspeed = 8
    savage:SetStateGraph("SGshadowwaxwell")
    local brain = require "brains/leifbrain"
    savage:SetBrain(brain)
    savage:RemoveComponent("weapon")
    savage:RemoveComponent("tool")
    savage:RemoveComponent("finiteuses")
    savage:RemoveComponent("inventoryitem")
    savage:RemoveComponent("equippable")
    savage:RemoveTag("hammer")
    savage:AddComponent("inventory")
    savage:AddComponent("health")
    savage.components.health:SetMaxHealth(2000)
    savage:ListenForEvent("death", function()
        local pt1 = savage:GetPosition()
        for k = 1,math.random(5,10) do
            local meatnames = {"meat","smallmeat","drumstick"}
            local meatname = meatnames[math.random(#meatnames)]
            local meat = SpawnPrefab(meatname)
            meat.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
        end
        if math.random() < 0.01 then
            local lootnames = {"spear_wathgrithr","wathgrithrhat"}
            local lootname = lootnames[math.random(#lootnames)]
            local loot = SpawnPrefab(lootname)
            loot.Transform:SetPosition(pt1.x, 0, pt1.z)
        end
    end )
    savage:AddComponent("combat")
    savage.components.combat:SetDefaultDamage(30)
    savage.components.combat:SetAttackPeriod(1.5)
    savage.components.combat:SetRetargetFunction(3, function(savage)
        if not savage.components.health:IsDead() then
            return FindEntity(savage, 20, function(guy)
                return savage.components.combat:CanTarget(guy) and not guy:HasTag("savages") and not guy:HasTag("goodsavages")
            end )
        end
    end )
    savage.components.combat:SetKeepTargetFunction(function(savage, target) return target and target:IsValid() end )
    savage:ListenForEvent("attacked", function(savage, data)
        savage.components.combat:SetTarget(data.attacker)
        savage.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("savages") and not dude:HasTag("mysavage") and not dude.components.health:IsDead() end, 5)
    end )
    savage.Physics:SetCollisionCallback(function(savage, other)
        if other and other.components.workable and other.components.workable.workleft > 0 then
           other.components.workable:Destroy(savage)
        end
    end)
    savage:ListenForEvent( "nighttime", function() savage:Remove() end , GetWorld())
    savage:AddComponent("trader")
    savage.components.trader:SetAcceptTest(function(savage, item) 
        if GetPlayer():HasTag("goodsavages") then
           if GetPlayer().components.inventory:Has("meat", 10) then
              if item.prefab == "meat" then
                 return true
              end
           end
        end
        return false
    end )
    savage.components.trader.onaccept = function(savage, giver, item)
        GetPlayer().components.inventory:ConsumeByName("meat", 9)
        savage:AddTag("mysavage")
        savage.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        savage:AddComponent("follower")
        savage.components.follower:SetLeader(GetPlayer())
        local brain = require "brains/abigailbrain"
        savage:SetBrain(brain)
        savage:RestartBrain()
        savage.components.combat:SetAttackPeriod(1)
        savage.components.combat:SetRetargetFunction(1, function(savage)
            if not savage.components.health:IsDead() then
               return FindEntity(GetPlayer(), 20, function(guy)
                   if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end )
            end
        end )
        savage:RemoveAllEventCallbacks()
        savage:RemoveComponent("trader")
        savage:ListenForEvent( "daytime", function() savage.components.health:DoDelta(2000) end , GetWorld())
        savage:ListenForEvent("attacked", function(savage, data)
            savage.components.combat:SetTarget(data.attacker)
        end )
        savage.Physics:SetCollisionCallback( nil )
        savage.components.inspectable.getstatus = function(savage)
            if not savage:HasTag("stophere") then
               savage:AddTag("stophere")
               savage.components.locomotor:Stop()
               savage:SetBrain(nil)
               savage.components.follower:SetLeader(nil)
               savage.AnimState:SetBloomEffectHandle("")
            else
               savage:RemoveTag("stophere")
               local brain = require "brains/abigailbrain"
               savage:SetBrain(brain)
               savage:RestartBrain()
               savage.components.follower:SetLeader(GetPlayer())
               savage.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            end
        end
    end
    savage:AddTag("savages")
  end
end
    inst:ListenForEvent( "daytime", function() createsavage(inst) end , GetWorld())


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hammer.luaļinst:AddComponent("inspectable")һвݣ

local items = { SWORD = "swap_spear_wathgrithr" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function onsave(inst, data)
    if inst:HasTag("savages") then
        data.savages = true
    end
    if inst:HasTag("mysavage") then
        data.mysavage = true
    end
    if inst:HasTag("stophere") then
        data.stophere = true
    end
end
local function onload(inst, data)
  if data and data.savages then
    inst.AnimState:SetBank("wilson")
    inst.AnimState:SetBuild("wolfgang")
    inst.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
    inst.AnimState:OverrideSymbol("swap_body", "torso_rain", "swap_body")
    inst.AnimState:OverrideSymbol("swap_object", "swap_spear_wathgrithr", "swap_spear_wathgrithr")
    inst.AnimState:Show("HAT")
    inst.AnimState:Show("HAT_HAIR")
    inst.AnimState:Hide("HAIR_NOHAT")
    inst.AnimState:Hide("HAIR")
    inst.AnimState:Hide("ARM_normal")
    inst.AnimState:Show("ARM_carry")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(1.2, 1.2, 1.2)
    local sound = inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 1.3, .6 )
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 100, .5)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "wolfgang.png" )
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 4
    inst.components.locomotor.runspeed = 8
    inst:SetStateGraph("SGshadowwaxwell")
    local brain = require "brains/leifbrain"
    inst:SetBrain(brain)
    inst:RemoveComponent("weapon")
    inst:RemoveComponent("tool")
    inst:RemoveComponent("finiteuses")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    inst:RemoveTag("hammer")
    inst:AddComponent("inventory")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(2000)
    inst:ListenForEvent("death", function()
        local pt1 = inst:GetPosition()
        for k = 1,math.random(5,10) do
            local meatnames = {"meat","smallmeat","drumstick"}
            local meatname = meatnames[math.random(#meatnames)]
            local meat = SpawnPrefab(meatname)
            meat.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
        end
        if math.random() < 0.01 then
            local lootnames = {"spear_wathgrithr","wathgrithrhat"}
            local lootname = lootnames[math.random(#lootnames)]
            local loot = SpawnPrefab(lootname)
            loot.Transform:SetPosition(pt1.x, 0, pt1.z)
        end
    end )
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(30)
    inst.components.combat:SetAttackPeriod(1.5)
    inst.components.combat:SetRetargetFunction(3, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 20, function(guy)
                return inst.components.combat:CanTarget(guy) and not guy:HasTag("savages") and not guy:HasTag("goodsavages")
            end )
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:ListenForEvent("attacked", function(inst, data)
        inst.components.combat:SetTarget(data.attacker)
        inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("savages") and not dude:HasTag("mysavage") and not dude.components.health:IsDead() end, 5)
    end )
    inst.Physics:SetCollisionCallback(function(inst, other)
        if other and other.components.workable and other.components.workable.workleft > 0 then
           other.components.workable:Destroy(inst)
        end
    end)
    inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld())
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item) 
        if GetPlayer():HasTag("goodsavages") then
           if GetPlayer().components.inventory:Has("meat", 10) then
              if item.prefab == "meat" then
                 return true
              end
           end
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        GetPlayer().components.inventory:ConsumeByName("meat", 9)
        inst:AddTag("mysavage")
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        inst:AddComponent("follower")
        inst.components.follower:SetLeader(GetPlayer())
        local brain = require "brains/abigailbrain"
        inst:SetBrain(brain)
        inst:RestartBrain()
        inst.components.combat:SetAttackPeriod(1)
        inst.components.combat:SetRetargetFunction(1, function(inst)
            if not inst.components.health:IsDead() then
               return FindEntity(GetPlayer(), 20, function(guy)
                   if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end )
            end
        end )
        inst:RemoveAllEventCallbacks()
        inst:RemoveComponent("trader")
        inst:ListenForEvent( "daytime", function() inst.components.health:DoDelta(2000) end , GetWorld())
        inst:ListenForEvent("attacked", function(inst, data)
            inst.components.combat:SetTarget(data.attacker)
        end )
        inst.Physics:SetCollisionCallback( nil )
        inst.components.inspectable.getstatus = function(inst)
            if not inst:HasTag("stophere") then
               inst:AddTag("stophere")
               inst.components.locomotor:Stop()
               inst:SetBrain(nil)
               inst.components.follower:SetLeader(nil)
               inst.AnimState:SetBloomEffectHandle("")
            else
               inst:RemoveTag("stophere")
               local brain = require "brains/abigailbrain"
               inst:SetBrain(brain)
               inst:RestartBrain()
               inst.components.follower:SetLeader(GetPlayer())
               inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            end
        end
    end
    inst:AddTag("savages")
  end
  if data and data.mysavage then
     inst:AddTag("mysavage")
     inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
     inst:AddComponent("follower")
     inst.components.follower:SetLeader(GetPlayer())
     local brain = require "brains/abigailbrain"
     inst:SetBrain(brain)
     inst:RestartBrain()
     inst.components.combat:SetAttackPeriod(1)
     inst.components.combat:SetRetargetFunction(1, function(inst)
         if not inst.components.health:IsDead() then
            return FindEntity(GetPlayer(), 20, function(guy)
                if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                end
            end )
         end
     end )
     inst:RemoveAllEventCallbacks()
     inst:RemoveComponent("trader")
     inst:ListenForEvent( "daytime", function() inst.components.health:DoDelta(2000) end , GetWorld())
     inst:ListenForEvent("attacked", function(inst, data)
         inst.components.combat:SetTarget(data.attacker)
     end )
     inst.Physics:SetCollisionCallback( nil )
     inst.components.inspectable.getstatus = function(inst)
         if not inst:HasTag("stophere") then
            inst:AddTag("stophere")
            inst.components.locomotor:Stop()
            inst:SetBrain(nil)
            inst.components.follower:SetLeader(nil)
            inst.AnimState:SetBloomEffectHandle("")
         else
            inst:RemoveTag("stophere")
            local brain = require "brains/abigailbrain"
            inst:SetBrain(brain)
            inst:RestartBrain()
            inst.components.follower:SetLeader(GetPlayer())
            inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
         end
     end
  end
  if data and data.stophere then
     inst:AddTag("stophere")
     inst.components.locomotor:Stop()
     inst:SetBrain(nil)
     inst.components.follower:SetLeader(nil)
     inst.AnimState:SetBloomEffectHandle("")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload


    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļinst.components.armor:InitCondition(TUNING.ARMOR_WATHGRITHRHAT, TUNING.ARMOR_WATHGRITHRHAT_ABSORPTION)һвݣ

    inst.components.equippable:SetOnEquip(function(inst, owner)
        onequip(inst, owner)
        if owner == GetPlayer() then
           owner:AddTag("goodsavages")
        end
    end )
    inst.components.equippable:SetOnUnequip(function(inst, owner)
        onunequip(inst, owner)
        owner:RemoveTag("goodsavages")
    end )

    ռ涴򣬰ͰҹʧǻṥһٽͨСͼɲѯλãʾΪֶͼꡣսʱǻΧ㣬ɻЯ࣬һʻ˿˹ñ˿˹ìװ˿˹ñΪͬ࣬Ӷܹ10£Ŵ²ƻܶصˣÿ峿ָҪ¿ͣԭأٴεɼ档Ӵ˿Ѫ干ʱηĵˣ°




.֮ɫ֮ΧоȺǰɣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.AnimState:PlayAnimation("purpleamulet")һвݣ

local function makebananatree(inst)
    local pt = inst:GetPosition()
    local bananatree = SpawnPrefab("purpleamulet")
    bananatree.Transform:SetPosition(pt.x, pt.y, pt.z)
    bananatree.AnimState:SetBank("cave_banana_tree")
    bananatree.AnimState:SetBuild("cave_banana_tree")
    bananatree.AnimState:PlayAnimation("idle_loop",true)
    bananatree.Transform:SetScale(1.5, 1.5, 1.5)
    bananatree:AddComponent("named")
    bananatree.components.named:SetName("Banana Tree")
    bananatree:RemoveComponent("equippable")
    bananatree:RemoveComponent("inventoryitem")
    bananatree:RemoveComponent("fueled")
    bananatree:RemoveComponent("deployable")
    bananatree:AddComponent("workable")
    bananatree.components.workable:SetWorkAction(ACTIONS.CHOP)
    bananatree.components.workable:SetWorkLeft(10)
    bananatree.components.workable:SetOnFinishCallback(function()
        SpawnPrefab("collapse_big").Transform:SetPosition(bananatree.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        bananatree:Remove()
    end )
    bananatree:ListenForEvent( "daytime", function()
        local pos = Vector3(bananatree.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
        for k,v in pairs(ents) do
            if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
               if v.prefab == "cave_banana" then
                  v:Remove()
               end
            end
        end
        bananatree:DoTaskInTime(0.3, function(bananatree)
            bananatree:StartThread(function()
                for k = 1,math.random(4,8) do
                    local pt1 = bananatree:GetPosition()
                    local banana = SpawnPrefab("cave_banana")
                    banana.Transform:SetPosition(pt1.x+(math.random(5)-math.random(5)), 5, pt1.z+(math.random(5)-math.random(5)))
                    Sleep(0.3)
                end
            end )
        end )
        for k = 1,math.random(5,10) do
            local elephant = SpawnPrefab("purpleamulet")
            elephant.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 0, pt.z+(math.random(30)-math.random(30)))
            elephant.AnimState:SetBank("koalefant")
            elephant.AnimState:SetBuild("koalefant_winter_build")
            elephant.AnimState:PlayAnimation("idle_loop", true)
            local sound = elephant.entity:AddSoundEmitter()
            local shadow = elephant.entity:AddDynamicShadow()
            shadow:SetSize( 4.5, 2 )
            elephant.Transform:SetFourFaced()
            MakeCharacterPhysics(elephant, 500, 1.5)
            elephant:AddComponent("named")
            elephant.components.named:SetName("Elephant")
            elephant.Transform:SetScale(1.5, 1.5, 1.5)
            local minimap = elephant.entity:AddMiniMapEntity()
            minimap:SetIcon( "cave_banana_tree.png" )
            elephant:RemoveComponent("equippable")
            elephant:RemoveComponent("inventoryitem")
            elephant:RemoveComponent("fueled")
            elephant:RemoveComponent("deployable")
            elephant:AddComponent("knownlocations")
            elephant:AddComponent("health")
            elephant.components.health:SetMaxHealth(1000)
            elephant:AddComponent("combat")
            elephant.components.combat.hiteffectsymbol = "beefalo_body"
            elephant.components.combat:SetDefaultDamage(30)
            elephant.components.combat:SetAttackPeriod(2)
            elephant.components.combat:SetRetargetFunction(3, function(elephant)
                if not elephant.components.health:IsDead() then
                    return FindEntity(elephant, 25, function(guy)
                       return guy:HasTag("monster")
                    end )
                end
            end )
            elephant.components.combat:SetKeepTargetFunction(function(elephant, target) return target and target:IsValid() end )
            elephant:ListenForEvent("attacked", function(elephant, data)
                elephant.components.combat:SetTarget(data.attacker)
                elephant.components.combat:ShareTarget(data.attacker, 10, function(dude) return dude:HasTag("elephants") and not dude.components.health:IsDead() end, 1)
            end )
            elephant:AddComponent("lootdropper")
            elephant.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_winter"})
            elephant:AddComponent("locomotor")
            elephant.components.locomotor.walkspeed = 2
            elephant.components.locomotor.runspeed = 4
            elephant:SetStateGraph("SGkoalefant")
            local brain = require "brains/frogbrain"
            elephant:SetBrain(brain)
            elephant:ListenForEvent( "nighttime", function() elephant:Remove() end , GetWorld())
            elephant:DoPeriodicTask(math.random(30, 60), function(elephant)
                if not elephant.components.combat.target then
                   local sgnames = {"bellow","graze","alert","shake"}
                   local sgname = sgnames[math.random(#sgnames)]
                   elephant.sg:GoToState(sgname)
                end
            end )
            elephant:DoPeriodicTask(math.random(120, 240), function(inst)
                SpawnPrefab("poop").Transform:SetPosition(elephant.Transform:GetWorldPosition())
            end )
            if math.random() < 0.5 then
               elephant:AddTag("redelephants")
               elephant.AnimState:SetBuild("koalefant_summer_build")
               elephant.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_summer"})
            end
            elephant:AddTag("elephants")
        end
    end , GetWorld())
    bananatree:AddTag("bananatree")
end
local function OnDeploy (inst, pt)
    makebananatree(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("bananatree") then
        data.bananatree = true
    end
    if inst:HasTag("elephants") then
        data.elephants = true
    end
    if inst:HasTag("redelephants") then
        data.redelephants = true
    end
end
local function onload(inst, data)
    if data and data.bananatree then
       makebananatree(inst)
       inst:Remove()
    end
    if data and data.elephants then
       inst.AnimState:SetBank("koalefant")
       inst.AnimState:SetBuild("koalefant_winter_build")
       inst.AnimState:PlayAnimation("idle_loop", true)
       local sound = inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize( 4.5, 2 )
       inst.Transform:SetFourFaced()
       MakeCharacterPhysics(inst, 500, 1.5)
       inst:AddComponent("named")
       inst.components.named:SetName("Elephant")
       inst.Transform:SetScale(1.5, 1.5, 1.5)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "cave_banana_tree.png" )
       inst:RemoveComponent("equippable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("fueled")
       inst:RemoveComponent("deployable")
       inst:AddComponent("knownlocations")
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(1000)
       inst:AddComponent("combat")
       inst.components.combat.hiteffectsymbol = "beefalo_body"
       inst.components.combat:SetDefaultDamage(30)
       inst.components.combat:SetAttackPeriod(2)
       inst.components.combat:SetRetargetFunction(3, function(inst)
           if not inst.components.health:IsDead() then
               return FindEntity(inst, 25, function(guy)
                  return guy:HasTag("monster")
               end )
           end
       end )
       inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
       inst:ListenForEvent("attacked", function(inst, data)
           inst.components.combat:SetTarget(data.attacker)
           inst.components.combat:ShareTarget(data.attacker, 10, function(dude) return dude:HasTag("elephants") and not dude.components.health:IsDead() end, 1)
       end )
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_winter"})
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 2
       inst.components.locomotor.runspeed = 4
       inst:SetStateGraph("SGkoalefant")
       local brain = require "brains/frogbrain"
       inst:SetBrain(brain)
       inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld())
       inst:DoPeriodicTask(math.random(30, 60), function(inst)
           if not inst.components.combat.target then
              local sgnames = {"bellow","graze","alert","shake"}
              local sgname = sgnames[math.random(#sgnames)]
              inst.sg:GoToState(sgname)
           end
       end )
       inst:DoPeriodicTask(math.random(120, 240), function(inst)
           SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
       end )
       inst:AddTag("elephants")
    end
    if data and data.redelephants then
       inst:AddTag("redelephants")
       inst.AnimState:SetBuild("koalefant_summer_build")
       inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","meat","meat","meat","meat","trunk_summer"})
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɫ֮㽶оȺΧҹ뿪󲻻㣬ʱѡ䵥ľ󣬷һ𷴻СͼʾΪ㽶ͼ꣬Ȼ⣬ɱһֻɻ10⼰ǣһ᲻ϲ㣬ȱٷϵĻ֮ʰȡҪ֮ˣɣȺںҹȥɫħѡźã£6ƽ4جȼϡ2ϱʯ




һ.棨ǳԷǣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\meats.luaļinst.components.edible.sanityvalue = -TUNING.SANITY_MEDһݣ

local function item_oneaten(inst, eater)
    local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    inst.animname = names[math.random(#names)]
    if eater:HasTag("player") then
       eater.AnimState:SetBuild(inst.animname)
    SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end
end
    inst.components.edible:SetOnEatenFn(item_oneaten)

    뿪µԷǵ󣬱Сͼʾ䣬ԭǼҲ䣬óӵĻǻ᳤Ŷָԭ󣬴浵˳ٶɡ˹ϡҪ롰Ұ֮ǡһͬ޸




.Ǿ¹HOMEǱ¹ENDԭ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_HOME, function()
  if inst.components.inventory:Has("goldnugget", 30) then
    inst.components.inventory:ConsumeByName("goldnugget", 30)
    inst.components.locomotor:Stop()
    inst.components.playercontroller:Enable(false)
    inst.AnimState:PlayAnimation("idle_shiver_pre")
    inst.AnimState:PushAnimation("idle_shiver_loop")
    inst.AnimState:PushAnimation("idle_shiver_pst", false)
    inst:DoTaskInTime(1, function() 
        inst.AnimState:SetBank("deerclops")
        inst.AnimState:SetBuild("deerclops_build")
        inst:SetStateGraph("SGdeerclops")
        inst.AnimState:PlayAnimation("idle_loop", true)
        inst.Transform:SetScale(1.5,1.5,1.5)
        shadow:SetSize( 6, 3.5 )
        local pos = GetPlayer():GetPosition()
        GetSeasonManager():DoLightningStrike(pos)
        inst.components.health:SetInvincible(true)
        inst.components.hunger:Pause()
        inst.components.combat:SetDefaultDamage(500)
        inst.components.combat.hiteffectsymbol = "deerclops_body"
        inst.components.combat.onhitotherfn = function()
             inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/attack")
             inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40)
        end
        inst.components.combat.playerdamagepercent = 0
        inst.components.combat:SetAreaDamage(10, 1)
        inst.components.temperature:SetTemp(20)
        inst.components.playercontroller:Enable(true)
    end )
  end
end )
TheInput:AddKeyUpHandler(KEY_END, function()
    inst.components.locomotor:Stop()
    inst.components.playercontroller:Enable(false)
    inst.AnimState:PlayAnimation("taunt")
    inst:DoTaskInTime(1, function() 
        inst.AnimState:SetBank("wilson")
        inst.AnimState:SetBuild(name)
        inst:SetStateGraph("SGwilson")
        inst.AnimState:PlayAnimation("idle")
        inst.Transform:SetScale(1,1,1)
        shadow:SetSize( 1.3, .6 )
        local pos = GetPlayer():GetPosition()
        GetSeasonManager():DoLightningStrike(pos)
        inst.components.health:SetInvincible(false)
        inst.components.hunger:Resume()
        inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
        inst.components.combat.hiteffectsymbol = "torso"
        inst.components.combat.onhitotherfn = nil
        inst.components.combat:SetAreaDamage(0, 0)
        inst.components.temperature:SetTemp(nil)
        inst.components.playercontroller:Enable(true)
    end )
end )

    ݾ֮ʱԵĻ󺰡Ǿ¹ͬʱ¼HOMEǽ޵о¹Ѫ䣩ԵչֲıɣCtrl + ÿα30ƽϻƽʱҪʱENDɡע⣬ھ¹ʱ磬ұ߱ɱ˵ԶرҾҪͬ顣޸ĹԾĻҪڱ¹ʱԾ




.LǱ»ٰLˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_L, function()
    if not inst:HasTag("dragon") then
       if inst.components.inventory:Has("goldnugget", 30) then
          inst.components.inventory:ConsumeByName("goldnugget", 30)
          inst.components.locomotor:Stop()
          inst.components.playercontroller:Enable(false)
          inst.AnimState:PlayAnimation("idle_shiver_pre")
          inst.AnimState:PushAnimation("idle_shiver_loop")
          inst.AnimState:PushAnimation("idle_shiver_pst", false)
          inst:DoTaskInTime(1, function() 
              inst:AddTag("dragon")
              inst.AnimState:SetBank("krampus")
              inst.AnimState:SetBuild("krampus_build")
              inst:SetStateGraph("SGkrampus")
              inst.AnimState:PlayAnimation("idle", true)
              inst.AnimState:Hide("SACK")
              inst.AnimState:Show("ARM")
              inst.Transform:SetScale(1.8,1.8,1.8)
              shadow:SetSize( 6, 3.5 )
              local light = inst.entity:AddLight()
              light:SetIntensity(.8)
              light:SetRadius(20)
              light:SetFalloff(.6)
              light:Enable(true)
              light:SetColour(255/255, 0/255, 0/255)
              inst.components.locomotor.walkspeed = 10
              inst.components.locomotor.runspeed = 15
              local pos = GetPlayer():GetPosition()
              GetSeasonManager():DoLightningStrike(pos)
              inst.components.health:SetInvincible(true)
              inst.components.hunger:Pause()
              inst.components.combat:SetDefaultDamage(500)
              inst.components.combat.hiteffectsymbol = "krampus_torso"
              local pearl = SpawnPrefab("dragonfruit")
              pearl.entity:AddSoundEmitter()
              RemovePhysicsColliders(pearl)
              pearl:AddTag("projectile")
              pearl:AddTag("pearl")
              pearl:RemoveComponent("edible")
              pearl:RemoveComponent("stackable")
              pearl:RemoveComponent("tradable")
              pearl:RemoveComponent("perishable")
              pearl:RemoveComponent("cookable")
              pearl:RemoveComponent("bait")
              pearl:RemoveComponent("plantable")
              pearl:RemoveComponent("burnable")
              pearl:RemoveComponent("propagator")
              pearl:AddComponent("burnable")
              pearl.components.burnable:SetFXLevel(3)
              pearl.components.burnable:AddBurnFX("character_fire", Vector3(0,0,0) )
              pearl:AddComponent("weapon")
              pearl.components.weapon:SetDamage(500)
              pearl.components.weapon:SetRange(20, 25)
              pearl:AddComponent("equippable")
              pearl.components.equippable.equipslot = EQUIPSLOTS.HANDS
              pearl.components.equippable:SetOnEquip(function(pearl)
                  pearl.components.burnable:Extinguish()
              end )
              pearl:AddComponent("projectile")
              pearl.components.projectile:SetSpeed(50)
              pearl.components.projectile:SetOnHitFn(function(pearl, owner, target)
                  inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                  SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition())
                  SpawnPrefab("explode_small").Transform:SetPosition(target.Transform:GetWorldPosition())
                  inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .5, 40)
                  if target.components.burnable then
                     target.components.burnable:Ignite()
                  end
                  owner.components.inventory:Equip(pearl)
              end )
              pearl.components.projectile:SetOnMissFn(function(pearl, owner)
                  owner.components.inventory:Equip(pearl)
              end )
              pearl:ListenForEvent("onthrown", function(pearl)
                  local pt = pearl:GetPosition()
                  pearl.Transform:SetPosition(pt.x, 2, pt.z)
                  pearl.SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo")
                  pearl.components.burnable:Ignite(true)
              end )
              inst.components.inventory:Equip(pearl)
              inst.components.temperature:SetTemp(20)
              inst.components.playercontroller:Enable(true)
          end )
        end
    else
        inst.components.locomotor:Stop()
        inst.components.playercontroller:Enable(false)
        inst.AnimState:PlayAnimation("taunt")
        inst:DoTaskInTime(1, function()
            inst:RemoveTag("dragon")
            inst.AnimState:SetBank("wilson")
            inst.AnimState:SetBuild(name)
            inst:SetStateGraph("SGwilson")
            inst.AnimState:PlayAnimation("idle")
            inst.Transform:SetScale(1,1,1)
            shadow:SetSize( 1.3, .6 )
            inst.Light:Enable(false)
            inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
            inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
            local pos = GetPlayer():GetPosition()
            GetSeasonManager():DoLightningStrike(pos)
            inst.components.health:SetInvincible(false)
            inst.components.hunger:Resume()
            inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
            inst.components.combat.hiteffectsymbol = "torso"
            local pos0 = Vector3(inst.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 3000)
            for k,v in pairs(ents) do
                if v:HasTag("pearl") then
                   v:Remove()
                end
            end
            inst.components.temperature:SetTemp(nil)
            inst.components.playercontroller:Enable(true)
        end )
    end
end )

    30ƽʱL漴30ƽϻƽʱԶװԵ˰ɷжΪ񶷣Ctrl + סFֹȼֲҹӣἢѪԵϵƷɼҪʱٴΰLɣʧ




.磨UǱ磬ӹ֮٣˿ᱻˣٰUˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_U, function()
    if not inst:HasTag("windman") then
       inst.components.locomotor:Stop()
       inst.components.playercontroller:Enable(false)
       inst.AnimState:PlayAnimation("idle_shiver_pre")
       inst.AnimState:PushAnimation("idle_shiver_loop")
       inst.AnimState:PushAnimation("idle_shiver_pst", false)
       GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
       inst:DoTaskInTime(0.3, function() 
           inst:AddTag("windman")
           inst.AnimState:SetBank("tornado")
           inst.AnimState:SetBuild("tornado")
           inst:SetStateGraph("SGtornado")
           inst.AnimState:PlayAnimation("tornado_pre")
           inst.AnimState:PushAnimation("tornado_loop")
           inst.Transform:SetScale(1.8,1.8,1.8)
           local light = inst.entity:AddLight()
           light:SetIntensity(.8)
           light:SetRadius(10)
           light:SetFalloff(.6)
           light:Enable(true)
           light:SetColour(255/255,255/255,255/255)
           inst.components.locomotor.walkspeed = 20
           inst.components.locomotor.runspeed = 30
           inst.components.health:SetInvincible(true)
           inst.components.hunger:Pause()
           inst.components.temperature:SetTemp(20)
           inst.Physics:SetCollisionCallback(function(inst, other)
               if other and other.components.health and other.components.combat then
                  if other.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == other or other:HasTag("monster") then
                     other.components.health:DoDelta(-100)
                     if other.components.freezable then
                        other.components.freezable:AddColdness(10)
                        other.components.freezable:SpawnShatterFX()
                     end
                  end
               end
               if other and other.components.workable and other.components.workable.workleft > 0 then
                  GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
                  other.components.workable:Destroy(inst)
               end
           end )
           inst.components.playercontroller:Enable(true)
       end )
    else
        inst.components.locomotor:Stop()
        inst.components.playercontroller:Enable(false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
        inst.AnimState:PlayAnimation("tornado_pst")
        inst:DoTaskInTime(0.3, function()
            inst:RemoveTag("windman")
            inst.AnimState:SetBank("wilson")
            inst.AnimState:SetBuild(name)
            inst:SetStateGraph("SGwilson")
            inst.AnimState:PlayAnimation("idle")
            inst.Transform:SetScale(1,1,1)
            inst.Light:Enable(false)
            inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
            inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
            inst.components.health:SetInvincible(false)
            inst.components.hunger:Resume()
            inst.components.temperature:SetTemp(nil)
            inst.Physics:SetCollisionCallback( nil )
            inst.components.playercontroller:Enable(true)
        end )
    end
end )

    ɰUǱ磬ӹ֮һнֲﾡ٣˿ˡҹӣἢѪȥϯ½ɡٴΰUɱ




.Ұ֮ǣţճҺǣܱǳΪ䣩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\slurtleslime.luaļinst:AddComponent("inspectable")һвݣ

local function item_oneaten(inst, eater)
    if eater:HasTag("player") then
        local pos = GetPlayer():GetPosition()
        GetSeasonManager():DoLightningStrike(pos)
        eater.components.locomotor:Stop()
        eater.components.playercontroller:Enable(false)
        eater:DoTaskInTime(1, function() 
            eater.AnimState:SetBank("hound")
            eater.AnimState:SetBuild("hound_red")
            eater.AnimState:PlayAnimation("idle")
            eater:SetStateGraph("SGhound")
            eater:RemoveTag("scarytoprey")
            eater:AddTag("monster")
            local light = eater.entity:AddLight()
            light:SetFalloff(1)
            light:SetIntensity(.8)
            light:SetRadius(20)
            light:Enable(true)
            light:SetColour(0/255, 255/255, 0/255)
            eater:ListenForEvent("attacked", function(eater)
                local pt = eater:GetPosition()
                eater.Transform:SetPosition(pt.x+(math.random(5)-math.random(5)), 0, pt.z+(math.random(5)-math.random(5)))
            end )
            eater.components.locomotor.runspeed = 25
            eater.components.sanity:DoDelta(eater.components.sanity.max)
            eater.components.sanity.ignore = true
            eater.components.health:StartRegen(100, 10)
            eater.components.combat:SetDefaultDamage(500)
            eater.components.combat:SetAttackPeriod(0.1)
            eater.components.eater:SetCarnivore()
            eater.components.temperature:SetTemp(20)
            eater.components.playercontroller:Enable(true)
            GetPlayer().HUD.controls.crafttabs:Hide()
            GetPlayer().HUD.controls.inv:Hide()
            GetPlayer().HUD.controls.mapcontrols.minimapBtn:Hide()
            local head = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
            GetPlayer().components.inventory:DropItem(head)
            local hands = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
            GetPlayer().components.inventory:DropItem(hands)
            local body = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
            GetPlayer().components.inventory:DropItem(body)
            eater.components.playeractionpicker.leftclickoverride = function(eater, target_ent, pos)
                if eater.components.combat:CanTarget(target_ent) then
                   return eater.components.playeractionpicker:SortActionList({ACTIONS.ATTACK}, target_ent, nil)
                end
                if target_ent and target_ent.components.edible and eater.components.eater:CanEat(target_ent) then
                   return eater.components.playeractionpicker:SortActionList({ACTIONS.EAT}, target_ent, nil)
                end
            end
            eater:DoPeriodicTask(3, function(eater)
              if math.random() < 0.05 then
                if eater.components.hunger:GetPercent() > 0.995 then
                   local pt1 = eater:GetPosition()
                   local wolf = SpawnPrefab("slurtleslime")
                   wolf.Transform:SetPosition(pt1.x+(math.random(10)-math.random(10)), 0, pt1.z+(math.random(10)-math.random(10)))
                   wolf.AnimState:SetBank("hound")
                   wolf.AnimState:SetBuild("hound")
                   wolf.AnimState:PlayAnimation("idle")
                   wolf.Transform:SetFourFaced()
                   local sound = wolf.entity:AddSoundEmitter()
                   local shadow = wolf.entity:AddDynamicShadow()
                   shadow:SetSize( 2.5, 1.5 )
                   MakeCharacterPhysics(wolf, 10, .5)
                   wolf:AddComponent("locomotor")
                   wolf.components.locomotor.runspeed = 25
                   wolf:SetStateGraph("SGhound")
                   local brain = require "brains/frogbrain"
                   wolf:SetBrain(brain)
                   wolf:RemoveComponent("stackable")
                   wolf:RemoveComponent("fuel")
                   wolf:RemoveComponent("inventoryitem")
                   wolf:RemoveComponent("explosive")
                   wolf:RemoveComponent("burnable")
                   wolf:RemoveComponent("propagator")
                   wolf:RemoveComponent("edible")
                   wolf:AddComponent("follower")
                   wolf:AddComponent("knownlocations")
                   wolf:AddComponent("lootdropper")
                   wolf.components.lootdropper:SetLoot({"meat", "meat"})
                   wolf:AddComponent("health")
                   wolf.components.health:SetMaxHealth(2000)
                   wolf.components.health:StartRegen(100, 10)
                   wolf:AddComponent("combat")
                   wolf.components.combat:SetDefaultDamage(20)
                   wolf.components.combat:SetAttackPeriod(0.1)
                   wolf.components.combat:SetTarget(eater)
                   wolf.AnimState:SetMultColour(255/255,0/255,0/255,1)
                   wolf.components.combat:SetRetargetFunction(1, function(wolf)
                       if not wolf.components.health:IsDead() then
                          return FindEntity(wolf, 300, function(guy)
                                 return guy:HasTag("player")
                          end )
                       end
                   end )
                   wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end )
                   wolf.task = wolf:DoPeriodicTask(1, function(customer)
                       if wolf.components.health.currenthealth < 1000 then
                          wolf.components.combat:SetTarget(nil)
                          wolf:RemoveTag("goodbye")
                          local brain = require "brains/abigailbrain"
                          wolf:SetBrain(brain)
                          wolf:RestartBrain()
                          wolf.components.follower:SetLeader(GetPlayer())
                          wolf.AnimState:SetMultColour(255/255,255/255,255/255,1)
                          wolf.components.combat:SetRetargetFunction(2, function(wolf)
                              if not wolf.components.health:IsDead() then
                                 return FindEntity(wolf, 20, function(guy)
                                     if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then
                                        return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy
                                     end
                                 end )
                              end
                          end )
                          wolf.components.combat:SetKeepTargetFunction(function(wolf, target) return target and target:IsValid() end )
                          if wolf.task then wolf.task:Cancel() wolf.task = nil end
                       end
                   end )
                   wolf:AddTag("monster")
                   wolf:AddTag("wolfs")
                   wolf:AddTag("goodbye")
                end
              end
            end )
        end )
    end
end
    inst:AddComponent("edible")
    inst.components.edible:SetOnEatenFn(item_oneaten)
    inst.components.edible.hungervalue = 1
    inst.components.edible.foodtype = "VEGGIE"
local function onsave(inst, data)
    if inst:HasTag("wolfs") then
        data.wolfs = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.wolfs then
       inst.AnimState:SetBank("hound")
       inst.AnimState:SetBuild("hound")
       inst.AnimState:PlayAnimation("idle")
       inst.Transform:SetFourFaced()
       local sound = inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize( 2.5, 1.5 )
       MakeCharacterPhysics(inst, 10, .5)
       inst:AddComponent("locomotor")
       inst.components.locomotor.runspeed = 25
       inst:SetStateGraph("SGhound")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("fuel")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("explosive")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveComponent("edible")
       inst:AddComponent("follower")
       inst:AddComponent("knownlocations")
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"meat", "meat"})
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(2000)
       inst.components.health:StartRegen(100, 10)
       inst:AddComponent("combat")
       inst.components.combat:SetDefaultDamage(20)
       inst.components.combat:SetAttackPeriod(0.1)
       local brain = require "brains/abigailbrain"
       inst:SetBrain(brain)
       inst.components.follower:SetLeader(GetPlayer())
       inst.components.combat:SetRetargetFunction(2, function(inst)
           if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                  if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("wolfs") then
                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy
                  end
              end )
           end
       end )
       inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
       inst:AddTag("monster")
       inst:AddTag("wolfs")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɳţճҺǱǣҰϲǣ㽫ӵǿԶѪܶٶȺͿֲҧҹҲӰ㿴ǰû˵ζһЩСｫ޷㡣ɱǣ֮ǰеĻ飬񡱶㣬뿪ڻĽҰ⡣սУرᣬʱᱻ˦ȥҪѧﳤ̣ܶٶȺ͹ƣܹȥҧһھͶ㣬ǧҪԭⲫʳʱһʳֱǣȫɫս㣬ϲٳʺɫ򽫳ΪСܣ÷ݷչȺɡʵܲ˻Ұˣ浵˳ٶɱˣСܽ㡣ʹôʿʱôҪ롰桱Ķͯһͬ޸ġţճҺɴţţѻ




.IǱС˻ʧȥĿٰ꣬Iˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_I, function()
    if not inst:HasTag("chameleon") then
       inst.components.locomotor:Stop()
       inst.components.talker:ShutUp()
       inst.components.playercontroller:Enable(false)
       local head = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
       GetPlayer().components.inventory:DropItem(head)
       local hands = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
       GetPlayer().components.inventory:DropItem(hands)
       local body = GetPlayer().components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
       GetPlayer().components.inventory:DropItem(body)
       inst.components.health:SetInvincible(true)
       inst.components.hunger:Pause()
       inst.components.sanity.ignore = true
       inst.components.temperature:SetTemp(20)
       SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
       inst:DoTaskInTime(0.3, function() 
           inst:AddTag("chameleon")
           inst.chameleon = inst:DoPeriodicTask(.5, function()
               local pos = Vector3(inst.Transform:GetWorldPosition())
               local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 25)
               for k,v in pairs(ents) do
                   if v.components.combat and v.components.combat.target and v.components.combat.target == inst then
                      v.components.combat:SetTarget(nil)
                   end
               end
           end )
           if math.random()<.18 then
              inst.AnimState:SetBank("rabbit")
              inst.AnimState:SetBuild("rabbit_build")
              inst.AnimState:PlayAnimation("idle")
              local rabbitsounds = { scream = "dontstarve/rabbit/scream", hurt = "dontstarve/rabbit/scream_short", }
              inst.sounds = rabbitsounds
              inst.data = {}
              inst:SetStateGraph("SGrabbit")
              shadow:SetSize( 1, .75 )
           elseif math.random()<.36 then
              inst.AnimState:SetBank("perd")
              inst.AnimState:SetBuild("perd")
              inst.AnimState:PlayAnimation("idle_loop")
              inst:SetStateGraph("SGperd")
              shadow:SetSize( 1.5, .75 )
           elseif math.random()<.54 then
              inst.AnimState:SetBank("frog")
              inst.AnimState:SetBuild("frog")
              inst.AnimState:PlayAnimation("idle")
              inst:SetStateGraph("SGfrog")
              shadow:SetSize( 1.5, .75 )
           elseif math.random()<.72 then
              inst.AnimState:SetBank("butterfly")
              inst.AnimState:SetBuild("butterfly_basic")
              inst.AnimState:PlayAnimation("idle")
              inst:SetStateGraph("SGbutterfly")
              shadow:SetSize( .8, .5 )
           else
              inst.AnimState:SetBank("bee")
              inst.AnimState:SetBuild("bee_build")
              inst.AnimState:PlayAnimation("idle")
              local workersounds = { takeoff = "dontstarve/bee/bee_takeoff", attack = "dontstarve/bee/bee_attack", buzz = "dontstarve/bee/bee_fly_LP", hit = "dontstarve/bee/bee_hurt", death = "dontstarve/bee/bee_death", }
              inst.sounds = workersounds
              inst:SetStateGraph("SGbee")
              shadow:SetSize( .8, .5 )
           end
           inst.components.playercontroller:Enable(true)
       end )
    else
        inst.components.locomotor:Stop()
        inst.components.talker:ShutUp()
        inst.components.playercontroller:Enable(false)
        SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst:DoTaskInTime(0.3, function()
            inst:RemoveTag("chameleon")
            if inst.chameleon then inst.chameleon:Cancel() inst.chameleon = nil end
            inst.AnimState:SetBank("wilson")
            inst.AnimState:SetBuild(name)
            inst.AnimState:PlayAnimation("idle")
            inst:SetStateGraph("SGwilson")
            shadow:SetSize( 1.3, .6 )
            inst.components.health:SetInvincible(false)
            inst.components.hunger:Resume()
            inst.components.sanity.ignore = false
            inst.components.temperature:SetTemp(nil)
            inst.components.playercontroller:Enable(true)
        end )
    end
end )

    ڱ׷;ĩ·ʱѽѽʹöIΪӡ𼦡ܡ۷С˻ᱻԻ󣬴ӶʧȥĿ꣬ԳɹÿСɫ𼦿Կٲժֲ۷ݵ˵ȣһСĸоɡöʱѪԻװڵϣ䣬ǰж¡ٴΰIɱ




.˹ˮꡢѩ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rainometer.luaļinst:AddComponent("inspectable")滻Ϊݣ

function firefn(inst)
    local range = 3000
    local pos = Vector3(inst.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        local pt = v:GetPosition()
        if v.components.burnable and v.components.burnable:IsBurning() then
           if v.prefab == "grass" then
              v:Remove()
              SpawnPrefab("grass").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
           if v.prefab == "sapling" then
              v:Remove()
              SpawnPrefab("sapling").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
           if v.prefab == "reeds" then
              v:Remove()
              SpawnPrefab("reeds").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
           if v.prefab == "berrybush" then
              v:Remove()
              SpawnPrefab("berrybush").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
           if v.prefab == "marsh_bush" then
              v:Remove()
              SpawnPrefab("marsh_bush").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
              if v.prefab == "flower_cave_triple" then
              v:Remove()
           SpawnPrefab("flower_cave_triple").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
           if v.prefab == "lichen" then
              v:Remove()
              SpawnPrefab("lichen").Transform:SetPosition(pt.x, pt.y, pt.z)
           end
        end
    end
end
local function GetStatus(inst, viewer)
    if GetWorld().components.seasonmanager.precip then
       GetWorld().components.seasonmanager:StopPrecip()
       if inst.fire then inst.fire:Cancel() inst.fire = nil end
    else
       GetWorld().components.seasonmanager:ForcePrecip()
       inst.fire = inst:DoPeriodicTask(8, function() firefn(inst) end)
    end
end
	inst:AddComponent("inspectable")
	inst.components.inspectable.getstatus = GetStatus

    ϰʼˮٰһֹͣˮꡢѩԽ󲿷ֲŵĻ𣬰ݡ֦«έԡ̹ľ䶴Ѩ̦޺




.˹㺮¶ȼлڣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\winterometer.luaļinst:AddComponent("inspectable")滻Ϊݣ

local function GetStatus(inst, viewer)
    if GetWorld().components.seasonmanager:IsWinter() then
       GetWorld().components.seasonmanager:StartSpring()
    elseif GetWorld().components.seasonmanager:IsSpring() then
       GetWorld().components.seasonmanager:StartSummer()
    elseif GetWorld().components.seasonmanager:IsSummer() then
       GetWorld().components.seasonmanager:StartAutumn()
    else
       GetWorld().components.seasonmanager:StartWinter()
    end
    GetWorld().components.seasonmanager:UpdateSegs()
end
	inst:AddComponent("inspectable")
	inst.components.inspectable.getstatus = GetStatus

    㺮¶ȼлڣÿһл¸




.Ƽָ밴Ҽ¸ʱΣ

    ü±ϷĿ¼\data\scripts\prefabs\compass.luaļlocal function GetStatus(inst, viewer)һвGetClock():NextPhase()

    ɶָ밴Ҽ¸ʱΣҹҹ죬Ģ׽өʱҪ飬ٵȴ




.ľ䣨Ҷֱӿľɫľɰᶯ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\treasurechest.luaļݣ

		inst.OnSave = onsave 
        inst.OnLoad = onload

    滻Ϊ

local colours=
{
    {198/255,43/255,43/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {233/255,208/255,69/255},
    {109/255,50/255,163/255},
    {222/255,126/255,39/255},
}
local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_body", "swap_backpack", "swap_body")
end
local function onunequip(inst, owner) 
    owner.AnimState:ClearOverrideSymbol("swap_body")
end
local function turnon(inst)
    inst.components.machine.ison = true
    if inst.prefab == "treasurechest" then
       inst:AddComponent("inventoryitem")
    end
end
local function turnoff(inst)
    inst.components.machine.ison = false
    if inst.prefab == "treasurechest" then
       inst:RemoveComponent("inventoryitem")
    end
end
local function onsave2(inst, data)
    data.num = inst.balloon_num
    data.colour_idx = inst.colour_idx
end
local function onload2(inst, data)
    if data then
        if data.num then
            inst.balloon_num = data.num
            inst.AnimState:OverrideSymbol("swap_balloon", "balloon_shapes", "balloon_" .. tostring(inst.balloon_num))
        end
        if data.colour_idx then
            inst.colour_idx = math.min(#colours, data.colour_idx)
            inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
        end
    end
end
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )
    inst.colour_idx = math.random(#colours)
    inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
    inst.OnSave = onsave2
    inst.OnLoad = onload2

    ʹľ߱ͬɫҶֱӿɫҲ÷䵹ˡľɰᶯԵϵľ䰴Ҽľ䡣ľڵϺ󣬶䰴Ҽڵ




һ.ͿѻħΪƷͿɫʣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļlocal inst = commonfn("blue")һвݣ

local function cancreatecolour(staff, caster, target, pos)
    return true
end
local function createcolour(staff, target, pos)
    local caster = staff.components.inventoryitem.owner
    if caster.components.sanity then
       caster.components.sanity:DoDelta(5)
    end
    local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255}, }
    inst.colour_idx = math.random(#colours)
    target.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(createcolour)
    inst.components.spellcaster:SetSpellTestFn(cancreatecolour)
    inst.components.spellcaster.canuseontargets = true
    inst.components.spellcaster.canusefrominventory = false

    ħҼκƷΪͿɫʣ浵˳ʧÿͿѻһβ5㡣ͿõͷͼƬ




.ƶͰɾƷťͰ

    ü±ϷĿ¼\data\scripts\prefabs\chester.luaļinst:AddComponent("container")һвݣ

local widgetbuttoninfo = {
    text = "Delete",
    position = Vector3(0, -195, 0),
    fn = function(inst)
        inst.components.container:DestroyContents()
        inst.SoundEmitter:PlaySound("dontstarve/common/destroy_stone")
    end }
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo

    ˹عĸ·һDeleteťҪƷ빷䣬DeleteťϷ̫ԽԽťĻճԴƷǧҪѹ۷빷Ŷ




.üҪƷӽȥ٣ҹȼϨ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\armor_slurper.luaļinst:AddComponent("inspectable")һвݣ

local function wastehole(inst)
    local pt = inst:GetPosition()
    local wastehole = SpawnPrefab("armorslurper")
    wastehole.Transform:SetPosition(pt.x, pt.y, pt.z)
    wastehole.AnimState:SetBank("tentaclepillar")
    wastehole.AnimState:SetBuild("tentacle_pillar")
    wastehole.AnimState:PlayAnimation("idle_hole",true)
    wastehole.Transform:SetScale(0.5, 0.5, 0.5)
    wastehole.entity:AddSoundEmitter()
    MakeObstaclePhysics(wastehole, .5)
    wastehole:RemoveComponent("inventoryitem")
    wastehole:RemoveComponent("equippable")
    wastehole:RemoveComponent("fueled")
    wastehole:RemoveComponent("deployable")
    wastehole:RemoveTag("fur")
    wastehole:RemoveTag("ruins")
    local minimap = wastehole.entity:AddMiniMapEntity()
    minimap:SetIcon( "firepit.png" )
    wastehole:AddComponent("burnable")
    wastehole.components.burnable:SetFXLevel(5)
    wastehole.components.burnable:AddBurnFX("character_fire", Vector3(0,1.5,0) )
    wastehole:ListenForEvent("onignite", function()
        wastehole:AddComponent("heater")
        wastehole.components.heater.heat = 50
    end )
    wastehole:ListenForEvent("onextinguish", function()
        wastehole.SoundEmitter:PlaySound("dontstarve/common/fireOut")  
        if wastehole.components.heater then wastehole:RemoveComponent("heater") end
    end )
    wastehole:ListenForEvent( "daytime", function() wastehole.components.burnable:Extinguish() end , GetWorld())
    wastehole:ListenForEvent( "dusktime", function() wastehole.components.burnable:Ignite(true) end , GetWorld())
    wastehole:ListenForEvent( "nighttime", function() wastehole.components.burnable:Ignite(true) end , GetWorld())
    if GetClock():IsDay() then
       wastehole.components.burnable:Extinguish()
    else
       wastehole.components.burnable:Ignite(true)
    end
    wastehole:AddComponent("workable")
    wastehole.components.workable:SetWorkAction(ACTIONS.HAMMER)
    wastehole.components.workable:SetWorkLeft(3)
    wastehole.components.workable:SetOnFinishCallback(function(wastehole)
        SpawnPrefab("collapse_big").Transform:SetPosition(wastehole.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        wastehole:Remove()
    end )
    local slotpos = { Vector3(0,-75,0)}
    wastehole:AddComponent("container")
    wastehole.components.container:SetNumSlots(#slotpos)
    wastehole.components.container.widgetslotpos = slotpos
    wastehole.components.container.widgetpos = Vector3(0,600,0)
    wastehole.components.container.side_align_tip = 160
    wastehole.components.container.itemtestfn = function(wastehole, item, slot)
        if item.prefab == "teleportato_ring" or item.prefab == "teleportato_box" or item.prefab == "teleportato_crank" or item.prefab == "teleportato_potato" or item.prefab == "chester_eyebone" or item.prefab == "abigail_flower" or item.prefab == "lucy" or item.prefab == "balloons_empty" or item.prefab == "lighter" or item.prefab == "waxwelljournal" then
           return false
        end
        return true
    end
    wastehole:DoPeriodicTask(0.25, function(wastehole)
       if not wastehole.components.container:IsEmpty() then
          wastehole.components.container:DestroyContents()
          wastehole.SoundEmitter:PlaySound("dontstarve/common/destroy_stone")
          local pt0 = wastehole:GetPosition()
          SpawnPrefab("collapse_small").Transform:SetPosition(pt0.x, 1, pt0.z)
       end
    end )
    wastehole:AddTag("wastehole")
end
local function OnDeploy (inst, pt)
    wastehole(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("wastehole") then
        data.wastehole = true
    end
end
local function onload(inst, data)
    if data and data.wastehole then
       wastehole(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    üҪƷ⣨¶ӵȣκβҪƷӽȥ٣ƷҲ÷ԽԽˡҹʱȼϨ𣬿ȡůʳСͼʾΪʯͷӪͼ꣬Ҫʱôһټɡħѡźã£6ʳƤ2ӡ2جȼ




.ﴫͻ̽Ҽ͵ص㣩

    ü±ϷĿ¼\data\scripts\prefabs\diviningrod.luaļinst:AddComponent("inspectable")һвݣ

local function onattack(inst, owner, target)
    SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
    target:AddTag("send")
end
local function canteleport(inst)
    return true
end
local function teleport(inst)
    local player = GetPlayer()
    local range = 3000
    local pos = Vector3(player.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v:HasTag("send") then
            v.Transform:SetPosition(TheInput:GetWorldPosition():Get())
            v:RemoveTag("send")
        end
    end
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(teleport)
    inst.components.spellcaster:SetSpellTestFn(canteleport)
    inst.components.spellcaster.canusefrominventory = false
    inst.components.spellcaster.canuseonpoint = true
    inst:AddComponent("weapon")
    inst.components.weapon:SetDamage(0)
    inst.components.weapon:SetRange(30, 35)
    inst.components.weapon:SetOnAttack(onattack)
    inst.components.weapon:SetProjectile("bishop_charge")

    װ̽ʱԣߵͼδװ̽Ҽ棬ɽѡеﴫ͹ﴫͻȺԶ䵥òĶ棬ػĳĵ˵ȡ̽ڿѧѡԭӣ£1֦4جȼϡ1




.ٿݣűԵҼͻؼң

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luaļinst.components.inventoryitem.cangoincontainer = false滻Ϊݣ

    inst.components.inventoryitem.cangoincontainer = true
local function OnDeploy (inst, pt)
    SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
    local pos = Vector3(inst.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
    for k,v in pairs(ents) do
        if v.prefab == "firepit" then
           inst.Transform:SetPosition(v.Transform:GetWorldPosition())
        end
    end
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddTag("fridge")

    ɽòµĶͨűԵҼԶ͵ʯͷӪԣٶսƷԿݻؼҡͬʱ߱عܣʳԳñʡֻͬһز񣨲ܴӵ´͵棩Ϊ֤Ͷ׼ȷͬһزֻһʯͷӪ𣨶ദĻͶ֮ͣǰ޸ĹͬʱЯͲҲinst.components.inventoryitem.cangoincontainer = false䣬inst.components.inventoryitem.cangoincontainer = true滻Ϊݼ




.ñϷñڵʮֱ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļinst.components.fueled:InitializeFuelLevel(TUNING.TOPHAT_PERISHTIME)һвݣ

local function ondropped(inst)
    local names = 
{"bedroll_furry","gunpowder","panflute","onemanband","armor_sanity","nightsword","batbat","armorslurper","amulet","blueamulet","purpleamulet","firestaff","icestaff","telestaff","blowdart_sleep","blowdart_fire","blowdart_pipe","featherhat","cane","trunkvest_summer","trunkvest_winter","nightmare_timepiece","orangeamulet","yellowamulet","greenamulet","orangestaff","yellowstaff","greenstaff","ruinshat","armorruins","ruins_bat","eyeturret_item","trunk_summer","trunk_winter","deerclops_eyeball","gears","nightmarefuel","livinglog","marble","minotaurhorn","krampus_sack","butter","tallbirdegg","honeyham","dragonpie","taffy","mandrakesoup","perogies","waffles","turkeydinner","honeynuggets","wormlight","beefalo","perd","koalefant_summer","koalefant_winter","lureplantbulb","slurtlehat","armorsnurtleshell","bonestew","butterflymuffin","frogglebunwich","pumpkincookie","baconeggs","fruitmedley","fishtacos","fishsticks","stuffedeggplant","meatballs","jammypreserves","bandage","healingsalve","spider_warrior","tentacle","monkey","killerbee","worm"}
    inst.name = names[math.random(#names)]
    SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
    SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
end
    inst:ListenForEvent("ondropped",  ondropped)

    ɽñڵϣʮֱҲһʱŶɡñڴѡñӣ£6˿




.񻨣ȼӫ񻨣

    ü±ϷĿ¼\data\scripts\prefabs\lightbulb.luaļinst:AddComponent("inventoryitem")һвݣ

local function OnIgniteFn(inst)
    GetPlayer().SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo")
    inst:DoTaskInTime(1.5, function() inst.Physics:SetMotorVelOverride(0,42,0) end)
end
local function OnExplodeFn(inst)
    GetPlayer().components.sanity:DoDelta(5)
    inst:StartThread(function()
       for k = 1,3 do
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           TheCamera:Shake("FULL", 0.3, 0.02, .5, 40)
           Sleep(.1)
       end
    end)
end
    inst:AddComponent("explosive")
    inst.components.explosive:SetOnExplodeFn(OnExplodeFn)
    inst.components.explosive:SetOnIgniteFn(OnIgniteFn)

    ûȼڵϵӫӫձըÿһŲ5ԣΪĽһհɡڵض񻨿ȼţͽӫڳһţҪһЩȼһͻ½ȼ




.꣨Զſ10ƽӫΪ³꣩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\armor_ruins.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if GetPlayer().components.inventory:Has("goldnugget", 10) then
       if item.prefab == "goldnugget" then
          return true
       end
    end
    if GetPlayer().components.inventory:Has("lightbulb", 10) then
       if item.prefab == "lightbulb" then
          return true
       end
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item.prefab == "goldnugget" then
       giver.components.inventory:ConsumeByName("goldnugget", 9)
    elseif item.prefab == "lightbulb" then
       giver.components.inventory:ConsumeByName("lightbulb", 9)
    end
    local bullet = SpawnPrefab("trinket_5")
    bullet.Transform:SetPosition(inst.Transform:GetWorldPosition())
    bullet.components.inventoryitem.canbepickedup = false
    bullet.Physics:SetMotorVelOverride(0,20,0)
    giver.components.sanity:DoDelta(10)
    GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
    inst:DoTaskInTime(1, function() bullet:Remove() end )
    inst:DoTaskInTime(1.5, function()
       inst:StartThread(function()
           for k = 1, 200 do
               local pt = Vector3(GetPlayer().Transform:GetWorldPosition())
               local rain = SpawnPrefab("lightbulb")
               rain:RemoveComponent("edible")
               rain.components.inventoryitem.canbepickedup = false
               if item.prefab == "goldnugget" then
                  rain.AnimState:SetMultColour(math.random(255)/255,math.random(255)/255,math.random(255)/255,1)
               end
               rain.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 20, pt.z+(math.random(30)-math.random(30)))
               inst:DoTaskInTime(5, function()
                    local pt2 = rain:GetPosition()
                    SpawnPrefab("explode_small").Transform:SetPosition(pt2.x, 0, pt2.z)
                    rain:Remove()
               end)
               Sleep(0.2)
           end
       end)
    end)
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ŻƽӫԷڵϵԶſ׵зꡣÿη10ƽӫʱ޷䡣Զſ׵ǻƽ²ɫ꣬ӫ°ɫꡣ䣬Ҫ̫࣬ļӲ㹻ǿÿɲ10㡣⴩ԶſףûƽӫװҼͬԷ䡣ԶſԶѡԶż̳£6ʯ4جȼ죬ʱҪԶż̳




.߶ţƬָ߶򣬴ˣӶɣ

    ü±ϷĿ¼\data\scripts\prefabs\slurtle_shellpieces.luaļinst:AddComponent("inventoryitem")һвݣ

local function OnDeploy (inst, pt)
    local golf = SpawnPrefab("slurtle_shellpieces")
    golf.Transform:SetPosition(pt.x, pt.y, pt.z)
    golf.AnimState:SetBank("bulb")
    golf.AnimState:SetBuild("bulb")
    golf.AnimState:PlayAnimation("idle")
    golf.Transform:SetScale(0.8, 0.8, 0.8)
    golf.components.inventoryitem.canbepickedup = false
    MakeSmallBurnable(golf)
    golf:AddComponent("perishable")
    golf.components.perishable:SetPerishTime(TUNING.PERISH_ONE_DAY)
    golf.components.perishable:StartPerishing()
    golf.components.perishable.onperishreplacement = "ash"
    golf:AddComponent("workable")
    golf.components.workable:SetWorkAction(ACTIONS.HAMMER)
    golf.components.workable:SetWorkLeft(10)
    golf.components.workable:SetOnFinishCallback(function(golf)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(golf.Transform:GetWorldPosition())
        golf:Remove()
    end )
    golf.components.workable:SetOnWorkCallback(function(golf)
        local pt2 = Vector3(golf.Transform:GetWorldPosition())
        local pos = Vector3(GetPlayer().Transform:GetWorldPosition())
        golf.Physics:SetMotorVelOverride((pt2.x-pos.x)*13,0,(pt2.z-pos.z)*13)
        golf:DoTaskInTime(0.2, function() golf.Physics:ClearMotorVelOverride() end )
        GetPlayer().components.sanity:DoDelta(5)
    end )
    golf:DoPeriodicTask(.05, function(golf)
        local pos2 = Vector3(golf.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 0.5)
        for k,v in pairs(ents) do
            if v.prefab == "rabbithole" then
               GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/use_axe_tree")
               golf:Remove()
               GetPlayer().components.sanity:DoDelta(50)
            end
        end
    end )
    golf:AddTag("golfs")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("golfs") then
        data.golfs = true
    end
end
local function onload(inst, data)
  if data and data.golfs then
    inst.AnimState:SetBank("bulb")
    inst.AnimState:SetBuild("bulb")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.components.inventoryitem.canbepickedup = false
    MakeSmallBurnable(inst)
    inst:AddComponent("perishable")
    inst.components.perishable:SetPerishTime(TUNING.PERISH_ONE_DAY)
    inst.components.perishable:StartPerishing()
    inst.components.perishable.onperishreplacement = "ash"
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(10)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst:Remove()
    end )
    inst.components.workable:SetOnWorkCallback(function(inst)
        local pt2 = Vector3(inst.Transform:GetWorldPosition())
        local pos = Vector3(GetPlayer().Transform:GetWorldPosition())
        inst.Physics:SetMotorVelOverride((pt2.x-pos.x)*13,0,(pt2.z-pos.z)*13)
        inst:DoTaskInTime(0.2, function() inst.Physics:ClearMotorVelOverride() end )
        GetPlayer().components.sanity:DoDelta(5)
    end )
    inst:DoPeriodicTask(.05, function(inst)
        local pos2 = Vector3(inst.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 0.5)
        for k,v in pairs(ents) do
            if v.prefab == "rabbithole" then
               GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/use_axe_tree")
               inst:Remove()
               GetPlayer().components.sanity:DoDelta(50)
            end
        end
    end )
    inst:AddTag("golfs")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ţƬָ߶ӶװӶԸ߶һҼעⲻҪסţԻվԽԽСվԽԶԽÿλӸ˽5ԣӶ50ԣᱻߣ򣩡׼ȷ붴ľڣˡ򡢶һߡÿ߶Ի10Σ10˶ûн˵ļ̫ˣһɡҪ߶ʱյɣȼܱƷ̫ԶҲˣ1ԶΪҽȾţƬͨţţѵõͬʱ޸ˡͳСҲԻ1-2ƽ𹺵




ģ.ɫħȿ޸Ʒظʶȡȼϼͬ飩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\staff.luaļlocal inst = commonfn("red")һвݣ

local function canbeback(staff, caster, target, pos)
    if caster.components.inventory:Has("goldnugget", 1) then
       return true
    end
    return false
end
local function beback(staff, target, pos)
    local player = GetPlayer()
    SpawnPrefab("book_fx").Transform:SetPosition(target.Transform:GetWorldPosition())
    if target.components.fueled then
       target.components.fueled.currentfuel = target.components.fueled.maxfuel
       player.components.inventory:ConsumeByName("goldnugget", 1)
    end
    if target.components.finiteuses then
       target.components.finiteuses.current = target.components.finiteuses.total
       player.components.inventory:ConsumeByName("goldnugget", 1)
    end
    if target.components.armor then
       target.components.armor.condition = target.components.armor.maxcondition
       player.components.inventory:ConsumeByName("goldnugget", 1)
    end
    if target.components.perishable then
       target.components.perishable.perishremainingtime = target.components.perishable.perishtime
       player.components.inventory:ConsumeByName("goldnugget", 1)
    end
    if target.components.health then
       target.components.health.currenthealth = target.components.health.maxhealth
       player.components.inventory:ConsumeByName("goldnugget", 1)
    end
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(beback)
    inst.components.spellcaster:SetSpellTestFn(canbeback)
    inst.components.spellcaster.canuseontargets = true
    inst.components.spellcaster.canusefrominventory = false

    ɽҪ޸ƷڵϣװɫħҼϵƷ޸װʹðٷֱȣظʳʶȣΪƷȼϣҲͬ顣ÿʹ֧1ƽûлƽʱ޷ʹáɶѵƷһ޸ֻҪ1ƽ𼴿




һ.ҵСݣþ¹Сݣ˯Ҽ򿪿ⷿ㰴ťװָʳʡƷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\deerclops_eyeball.luaļinst:AddComponent("inspectable")һвݣ

local slotpos = {}
for y = 2, 0, -1 do
    for x = 0, 11 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2-175,0))
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2-425,0))
    end
end
local widgetbuttoninfo = {
    text = "Repair",
    position = Vector3(741, 135, 0),
    fn = function(inst)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        inst.components.container:Close(GetPlayer())
        for k,v in pairs(inst.components.container.slots) do
            if v.components.fueled then
               v.components.fueled.currentfuel = v.components.fueled.maxfuel
            end
            if v.components.finiteuses then
               v.components.finiteuses.current = v.components.finiteuses.total
            end
            if v.components.armor then
               v.components.armor.condition = v.components.armor.maxcondition
            end
            if v.components.perishable then
               v.components.perishable.perishremainingtime = v.components.perishable.perishtime
            end
            if v.components.moisturelistener then
               v.components.moisturelistener.wet = false
            end
        end
        inst:DoTaskInTime(0.1, function() inst.components.container:Open(GetPlayer()) end )
end }
local function OnDeploy (inst, pt)
    local house = SpawnPrefab("deerclops_eyeball")
    house.Transform:SetPosition(pt.x, pt.y, pt.z)
    house.AnimState:SetBank("walrus_house")
    house.AnimState:SetBuild("walrus_house")
    house.AnimState:PlayAnimation("lit", true)
    house.Transform:SetScale(1.5, 1.5, 1.5)
    MakeObstaclePhysics(house, 1)
    local minimap = house.entity:AddMiniMapEntity()
    minimap:SetIcon( "igloo.png" )
    house:RemoveComponent("inventoryitem")
    house:RemoveComponent("edible")
    house:RemoveComponent("stackable")
    house:RemoveComponent("deployable")
    local light = house.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:Enable(true)
    light:SetColour(180/255, 195/255, 50/255)
    house:AddComponent("named")
    house.components.named:SetName("My House")
    house:AddComponent("workable")
    house.components.workable:SetWorkAction(ACTIONS.HAMMER)
    house.components.workable:SetWorkLeft(3)
    house.components.workable:SetOnFinishCallback(function(house)
        house.Light:Enable(false)
        SpawnPrefab("collapse_big").Transform:SetPosition(house.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
	house.components.container:DropEverything()
        house:Remove()
    end )
    house:AddComponent("machine")
    house.components.machine.turnonfn = function() house.components.container:Open(GetPlayer()) end
    house.components.machine.turnofffn = function() house.components.container:Open(GetPlayer()) end
    house:AddComponent("sleepingbag")
    house.components.sleepingbag.onsleep = function(house, sleeper)
        sleeper.components.health:SetInvincible(true)
        sleeper.components.playercontroller:Enable(false)
        GetPlayer().HUD:Hide()
        TheFrontEnd:Fade(false,1)
        house:DoTaskInTime(1.2, function() 
           GetPlayer().HUD:Show()
           TheFrontEnd:Fade(true,1) 
           GetClock():MakeNextDay()
           sleeper.components.health:SetInvincible(false)
           sleeper.components.playercontroller:Enable(true)
           sleeper.components.sanity:DoDelta(sleeper.components.sanity.max)
           sleeper.components.hunger:DoDelta(sleeper.components.hunger.max)
           sleeper.components.health:DoDelta(sleeper.components.health.maxhealth)
           sleeper.components.temperature:SetTemperature(20)
           if sleeper.components.moisture then sleeper.components.moisture:SetMoistureLevel(0) end
        end)
    end
    house:AddTag("houses")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("houses") then
        data.houses = true
    end
end
local function onload(inst, data)
  if data and data.houses then
    inst.AnimState:SetBank("walrus_house")
    inst.AnimState:SetBuild("walrus_house")
    inst.AnimState:PlayAnimation("lit", true)
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    MakeObstaclePhysics(inst, 1)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "igloo.png" )
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("deployable")
    local light = inst.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:Enable(true)
    light:SetColour(180/255, 195/255, 50/255)
    inst:AddComponent("named")
    inst.components.named:SetName("My House")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        inst.Light:Enable(false)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
	inst.components.container:DropEverything()
        inst:Remove()
    end )
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = function() inst.components.container:Open(GetPlayer()) end
    inst.components.machine.turnofffn = function() inst.components.container:Open(GetPlayer()) end
    inst:AddComponent("sleepingbag")
    inst.components.sleepingbag.onsleep = function(inst, sleeper)
        sleeper.components.health:SetInvincible(true)
        sleeper.components.playercontroller:Enable(false)
        GetPlayer().HUD:Hide()
        TheFrontEnd:Fade(false,1)
        inst:DoTaskInTime(1.2, function() 
           GetPlayer().HUD:Show()
           TheFrontEnd:Fade(true,1) 
           GetClock():MakeNextDay()
           sleeper.components.health:SetInvincible(false)
           sleeper.components.playercontroller:Enable(true)
           sleeper.components.sanity:DoDelta(sleeper.components.sanity.max)
           sleeper.components.hunger:DoDelta(sleeper.components.hunger.max)
           sleeper.components.health:DoDelta(sleeper.components.health.maxhealth)
           sleeper.components.temperature:SetTemperature(20)
           if sleeper.components.moisture then sleeper.components.moisture:SetMoistureLevel(0) end
        end)
    end
    inst:AddTag("houses")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-150,300,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.canbeopened = false
    inst:AddTag("fridge")

    þ¹СݣСݿ˯Ҳ˯˯ѺὫԡȫȥʪȣ״̬ҼСݣ򿪿ⷿԶСԶرգ108洢ռ䣬عܡϽǵġRepairťСеװָʳʶȡƷСҹƻܱͨߡҪСʱôҵɣⷿûգƷڵ




Ķ.ԶţľԶţԶأ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\armor_wood.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local door1 = SpawnPrefab("armorwood")
    door1.Transform:SetPosition(pt.x+0.55, pt.y, pt.z-0.55)
    door1.AnimState:SetBank("winter_meter")
    door1.AnimState:SetBuild("winter_meter")
    door1.AnimState:SetPercent("meter", 1)
    door1.Transform:SetScale(1, 0.7, 1)
    MakeObstaclePhysics(door1, 0.48)
    door1:RemoveComponent("inventoryitem")
    door1:RemoveComponent("fuel")
    door1:RemoveComponent("armor")
    door1:RemoveComponent("equippable")
    door1:RemoveComponent("burnable")
    door1:RemoveComponent("propagator")
    door1:RemoveComponent("deployable")
    door1:RemoveTag("wood")
    door1:AddComponent("workable")
    door1.components.workable:SetWorkAction(ACTIONS.HAMMER)
    door1.components.workable:SetWorkLeft(2)
    door1.components.workable:SetOnFinishCallback(function(door1)
        SpawnPrefab("collapse_big").Transform:SetPosition(door1.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        door1:Remove()
    end )
    door1:AddComponent( "playerprox" )
    door1.components.playerprox:SetDist(2,3)
    door1.components.playerprox:SetOnPlayerNear(function(door1)
        door1.Transform:SetScale(0.1, 0.7, 1)
        door1.Physics:SetActive(false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    door1.components.playerprox:SetOnPlayerFar(function(door1)
        door1.Transform:SetScale(1, 0.7, 1)
        door1.Physics:SetActive(true)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    door1.components.inspectable.getstatus = function(door1)
        door1.Transform:SetScale(0.1, 0.7, 1)
        door1.Physics:SetActive(false)
        door1:DoTaskInTime(3, function(door1)
            door1.Transform:SetScale(1, 0.7, 1)
            door1.Physics:SetActive(true)
        end )
    end
    door1:AddTag("doors")
    local door2 = SpawnPrefab("armorwood")
    door2.Transform:SetPosition(pt.x-0.55, pt.y, pt.z+0.55)
    door2.AnimState:SetBank("winter_meter")
    door2.AnimState:SetBuild("winter_meter")
    door2.AnimState:SetPercent("meter", 1)
    door2.Transform:SetScale(1, 0.7, 1)
    MakeObstaclePhysics(door2, 0.48)
    door2:RemoveComponent("inventoryitem")
    door2:RemoveComponent("fuel")
    door2:RemoveComponent("armor")
    door2:RemoveComponent("equippable")
    door2:RemoveComponent("burnable")
    door2:RemoveComponent("propagator")
    door2:RemoveComponent("deployable")
    door2:RemoveTag("wood")
    door2:AddComponent("workable")
    door2.components.workable:SetWorkAction(ACTIONS.HAMMER)
    door2.components.workable:SetWorkLeft(2)
    door2.components.workable:SetOnFinishCallback(function(door2)
        SpawnPrefab("collapse_big").Transform:SetPosition(door2.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        door2:Remove()
    end )
    door2:AddComponent( "playerprox" )
    door2.components.playerprox:SetDist(2,3)
    door2.components.playerprox:SetOnPlayerNear(function(door2)
        door2.Transform:SetScale(0.1, 0.7, 1)
        door2.Physics:SetActive(false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    door2.components.playerprox:SetOnPlayerFar(function(door2)
        door2.Transform:SetScale(1, 0.7, 1)
        door2.Physics:SetActive(true)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    door2.components.inspectable.getstatus = function(door2)
        door2.Transform:SetScale(0.1, 0.7, 1)
        door2.Physics:SetActive(false)
        door2:DoTaskInTime(3, function(door2)
            door2.Transform:SetScale(1, 0.7, 1)
            door2.Physics:SetActive(true)
        end )
    end
    door2:AddTag("doors")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("doors") then
        data.doors = true
    end
end
local function onload(inst, data)
  if data and data.doors then
    inst.AnimState:SetBank("winter_meter")
    inst.AnimState:SetBuild("winter_meter")
    inst.AnimState:SetPercent("meter", 1)
    inst.Transform:SetScale(1, 0.7, 1)
    MakeObstaclePhysics(inst, 0.48)
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("armor")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("wood")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(2)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:AddComponent( "playerprox" )
    inst.components.playerprox:SetDist(2,3)
    inst.components.playerprox:SetOnPlayerNear(function(inst)
        inst.Transform:SetScale(0.1, 0.7, 1)
        inst.Physics:SetActive(false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    inst.components.playerprox:SetOnPlayerFar(function(inst)
        inst.Transform:SetScale(1, 0.7, 1)
        inst.Physics:SetActive(true)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
    end )
    inst.components.inspectable.getstatus = function(inst)
        inst.Transform:SetScale(0.1, 0.7, 1)
        inst.Physics:SetActive(false)
        inst:DoTaskInTime(3, function(inst)
            inst.Transform:SetScale(1, 0.7, 1)
            inst.Physics:SetActive(true)
        end )
    end
    inst:AddTag("doors")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ľԶţʱԶأΪҲֶأɿţ3ԶšʱȽһǽȻҵ2£µĿյмԶţǽϡԶзƣֻǽ֮䣨ϷĬϵķ򣩣ڲǽ֮䡣ҪԶʱôһټɡľսѡѽ£8ľͷ2




.񣨰ʯͷӪ𸽽Զ֣

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\firepit.luaļinst:AddComponent("inspectable")һвݣ

local function createnpc(inst)
  for k = 1,math.random(10,25) do
    local pt = inst:GetPosition()
    local npc = SpawnPrefab("frog")
    npc.Transform:SetPosition(pt.x+(math.random(50)-math.random(50)), 0, pt.z+(math.random(50)-math.random(50)))
    npc.AnimState:SetBank("wilson")
    local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    local buildname = names[math.random(#names)]
    npc.AnimState:SetBuild(buildname)
    local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"}
    local hat = hats[math.random(#hats)]
    npc.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
    local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"}
    local armor = armors[math.random(#armors)]
    npc.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
    npc.AnimState:Show("HAT")
    npc.AnimState:Show("HAT_HAIR")
    npc.AnimState:Hide("HAIR_NOHAT")
    npc.AnimState:Hide("HAIR")
    npc.AnimState:Hide("ARM_carry")
    npc.AnimState:Show("ARM_normal")
    npc.AnimState:PlayAnimation("idle")
    MakeCharacterPhysics(npc, 75, .5)
    local minimap = npc.entity:AddMiniMapEntity()
    minimap:SetIcon( "lighter.png" )
    npc:RemoveComponent("sleeper")
    npc:RemoveComponent("thief")
    npc:RemoveComponent("lootdropper")
    npc:RemoveTag("animal")
    npc:RemoveTag("prey")
    npc:RemoveTag("smallcreature")
    npc:RemoveTag("frog")
    npc:RemoveTag("canbetrapped")
    npc:RemoveAllEventCallbacks()
    npc:SetStateGraph("SGshadowwaxwell")
    npc.components.health:SetMaxHealth(1000)
    npc:RemoveComponent("combat")
    npc:AddComponent("combat")
    npc.components.combat:SetDefaultDamage(10)
    npc.components.combat:SetAttackPeriod(1)
    npc.components.combat:SetRetargetFunction(3, function(npc)
        if not npc.components.health:IsDead() then
            return FindEntity(npc, 20, function(guy)
                if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == npc or npc.components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    npc.components.combat:SetKeepTargetFunction(function(npc, target) return target and target:IsValid() end )
    npc:ListenForEvent("attacked", function(npc, data)
        npc.components.combat:SetTarget(data.attacker)
        npc.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("npcs") and not dude.components.health:IsDead() end, 5)
    end )
    npc:AddComponent("trader")
    npc.components.trader:SetAcceptTest(function(npc, item) 
        if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" or item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" or item.prefab == "butter" or item.prefab == "butterflywings" or item.prefab == "cutlichen" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" then
           return true
        end
        return false
    end )
    npc.components.trader.onaccept = function(npc, giver, item)
        for k = 1, 2 do
            local goldnugget = SpawnPrefab("goldnugget")
            GetPlayer().components.inventory:GiveItem(goldnugget)
        end
    end
    npc:ListenForEvent( "nighttime", function() npc:Remove() end , GetWorld())
    npc:AddComponent("talker")
    npc:DoPeriodicTask(math.random(30,60), function()
        local words = {"Good day","I'm happy","I like here","Thank you","Where's the enemy","I'm hungry","Too hot","Too cold","Hello","Bye","Sorry","Good morning","Good afternoon","Good evening","I'll go home","I want to go hunting","I'm going to mining","I want to go to the farm","I want to pick","I want to go fishing","I'm going to catch","I want to fight","I want to have a rest","I was a good man","I want to be rich","I was lucky","I want to make friends"}
        local word = words[math.random(#words)]
        npc.components.talker:Say(word, 4, false)
    end)
    npc:AddTag("npcs")
  end
end
    inst:ListenForEvent( "daytime", function() createnpc(inst) end , GetWorld())


    2.ü±ϷĿ¼\data\scripts\prefabs\frog.luaļinst:AddComponent("inspectable")һвݣ

local names = {"swap_axe","swap_batbat","swap_cane","swap_diviningrod","swap_ruins_bat","swap_fishingrod","swap_goldenaxe","swap_goldenpickaxe","swap_goldenshovel","swap_ham_bat","swap_hammer","swap_lucy_axe","swap_nightmaresword","swap_pickaxe","swap_pitchfork","swap_ruins_bat","swap_shovel","swap_spear","swap_spike","swap_umbrella","swap_spear_wathgrithr","swap_parasol"}
local weapon = names[math.random(#names)]
local items = { SWORD = weapon }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function onsave(inst, data)
    if inst:HasTag("npcs") then
        data.npcs = true
    end
end
local function onload(inst, data)
  if data and data.npcs then
    inst.AnimState:SetBank("wilson")
    local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    local buildname = names[math.random(#names)]
    inst.AnimState:SetBuild(buildname)
    local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"}
    local hat = hats[math.random(#hats)]
    inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
    local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"}
    local armor = armors[math.random(#armors)]
    inst.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
    inst.AnimState:Show("HAT")
    inst.AnimState:Show("HAT_HAIR")
    inst.AnimState:Hide("HAIR_NOHAT")
    inst.AnimState:Hide("HAIR")
    inst.AnimState:Hide("ARM_carry")
    inst.AnimState:Show("ARM_normal")
    inst.AnimState:PlayAnimation("idle")
    MakeCharacterPhysics(inst, 75, .5)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "lighter.png" )
    inst:RemoveComponent("sleeper")
    inst:RemoveComponent("thief")
    inst:RemoveComponent("lootdropper")
    inst:RemoveTag("animal")
    inst:RemoveTag("prey")
    inst:RemoveTag("smallcreature")
    inst:RemoveTag("frog")
    inst:RemoveTag("canbetrapped")
    inst:RemoveAllEventCallbacks()
    inst:SetStateGraph("SGshadowwaxwell")
    inst.components.health:SetMaxHealth(1000)
    inst:RemoveComponent("combat")
    inst:AddComponent("combat")
    inst.components.combat:SetDefaultDamage(10)
    inst.components.combat:SetAttackPeriod(1)
    inst.components.combat:SetRetargetFunction(3, function(inst)
        if not inst.components.health:IsDead() then
            return FindEntity(inst, 20, function(guy)
                if guy.components.combat and guy.components.health and not guy.components.health:IsDead() then
                   return guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster")
                end
            end )
        end
    end )
    inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
    inst:ListenForEvent("attacked", function(inst, data)
        inst.components.combat:SetTarget(data.attacker)
        inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("npcs") and not dude.components.health:IsDead() end, 5)
    end )
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item) 
        if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" or item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" or item.prefab == "butter" or item.prefab == "butterflywings" or item.prefab == "cutlichen" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" then
           return true
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        for k = 1, 2 do
            local goldnugget = SpawnPrefab("goldnugget")
            GetPlayer().components.inventory:GiveItem(goldnugget)
        end
    end
    inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld())
    inst:AddComponent("talker")
    inst:DoPeriodicTask(math.random(30,60), function()
        local words = {"Good day","I'm happy","I like here","Thank you","Where's the enemy","I'm hungry","Too hot","Too cold","Hello","Bye","Sorry","Good morning","Good afternoon","Good evening","I'll go home","I want to go hunting","I'm going to mining","I want to go to the farm","I want to pick","I want to go fishing","I'm going to catch","I want to fight","I want to have a rest","I was a good man","I want to be rich","I was lucky","I want to make friends"}
        local word = words[math.random(#words)]
        inst.components.talker:Say(word, 4, false)
    end)
    inst:AddTag("npcs")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڰʱʯͷӪ𸽽߶ҹȥǵĵطǰȫġԸ⹺ࡢ߲˺ͱʯƷÿƷ2ƽ㹥񣬸˽ΧŹ㡣Ƕ˵ЩʲôɡڵͼʯͷӪͻγС򣬼Ӵ˲塣СͼʾΪͼ꣨ϣͨ鿴Сͼ˽С˿




.ԾRǿǰԾ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("resurrectable")һвݣ

TheInput:AddKeyUpHandler(KEY_R, function()
   inst.Physics:SetCollides(false)
   inst:DoTaskInTime(0, function()
        inst.AnimState:PlayAnimation("give")
        inst.components.playercontroller:Enable(false)
        inst.components.locomotor:Stop()
        inst.Physics:SetMotorVelOverride(50,45,0) end )
   inst:DoTaskInTime(0.2, function()
        inst.Physics:ClearMotorVelOverride()
        inst.Physics:SetMotorVelOverride(50,0,0) end )
   inst:DoTaskInTime(0.3, function()
        inst.Physics:ClearMotorVelOverride()
        inst.Physics:SetMotorVelOverride(50,-25,0) end )
   inst:DoTaskInTime(0.5, function()
        inst.Physics:ClearMotorVelOverride()
        inst.components.locomotor:Stop()
        local pt = inst:GetPosition()
        inst.Transform:SetPosition(pt.x, 0, pt.z)
        inst.components.playercontroller:Enable(true)
        inst.Physics:SetCollides(true)
        inst.AnimState:PlayAnimation("idle")
        inst.SoundEmitter:PlaySound("dontstarve/movement/bodyfall_dirt", "bodyfall") end )
end )

    ɰRǰԾԷԽ֡ǽϰҲϣɺСϰʱӰԾ߶ȡKEY_R滻ΪKEY_CͿ԰CԾ




.ƣJǷ棬޴ĵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_J, function()
    if not inst:HasTag("jump") then
       inst.components.hunger:DoDelta(-50)
       inst.components.playercontroller:Enable(false)
       inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
       shadow:SetSize( 0, 0 )
       inst:AddTag("jump")
       inst.jump = inst:DoPeriodicTask(.01, function() inst.Physics:SetMotorVelOverride(0,15,0) end)
       inst:DoTaskInTime(5, function()
            if inst.jump then inst.jump:Cancel() inst.jump = nil end
            local pos = inst:GetPosition()
            GetSeasonManager():DoLightningStrike(pos)
            inst.sg:GoToState("hit")
            inst.jump2 = inst:DoPeriodicTask(.01, function() inst.Physics:SetMotorVelOverride(0,-55,0) end)
       end )
       inst:DoTaskInTime(6.35, function()
            if inst.jump2 then inst.jump2:Cancel() inst.jump2 = nil end
            inst.sg:GoToState("hit")
            inst.AnimState:SetBloomEffectHandle("")
            shadow:SetSize( 1.3, .6 )
            SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
            GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
            for k = 1,math.random(5) do
                local pt = Vector3(inst.Transform:GetWorldPosition())
                SpawnPrefab("rocks").Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3)))
            end
            inst.components.playercontroller:ShakeCamera(inst, "FULL", 2.5, 0.03, 2, 30)
       end )
       inst:DoTaskInTime(6.5, function()
            local pos = Vector3(inst.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 30)
            for k,v in pairs(ents) do
                if v.components.workable and v.components.workable.workleft > 0 and not v.components.inventoryitem then
                   v.components.workable:Destroy(inst)
                end
                if v:HasTag("monster") or v.prefab == "beefalo" or v.prefab == "babybeefalo" or v.prefab == "bunnyman" or v.prefab == "pigman" or v.prefab == "pigguard"
                   or v.prefab == "merm" or v.prefab == "monkey" or v.prefab == "tallbird" or v.prefab == "walrus" or v.prefab == "little_walrus" or v.prefab == "wasphive"
                   or v.prefab == "beehive" or v.prefab == "koalefant_summer" or v.prefab == "koalefant_winter" or v.prefab == "lureplant" or v.prefab == "penguin"
                   or v.prefab == "perd" or v.prefab == "rocky" or v.prefab == "slurper" or v.prefab == "snurtle" or v.prefab == "slurtle" or v.prefab == "slurtlehole"
                   or v.prefab == "spiderden" or v.prefab == "spiderden_2" or v.prefab == "spiderden_3" then
                   v.components.health:DoDelta(-3000)
                end
            end
            inst:RemoveTag("jump")
            inst.components.playercontroller:Enable(true)
       end )
    end
end )

    ɰ¼Jʹƣ㽫ڿն棨ѪҵĵΧһнʯͷľ˳ͬ飩Ϊֹ־ѧ׷гϷáÿη50㼢ֵ




.ģʽF8ԶѲ߲սٰF8ֶָƣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

local items = { SWORD = "swap_spear" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
TheInput:AddKeyUpHandler(KEY_F8, function()
     if not inst:HasTag("patrol") then
        inst.components.locomotor:Stop()
        inst:SetBrain(nil)
        inst.components.talker:ShutUp()
        inst.components.playercontroller:Enable(false)
        inst:DoTaskInTime(0.3, function() 
            inst:AddTag("patrol")
            inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
            inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            inst:AddComponent("knownlocations")
            local brain = require "brains/frogbrain"
            inst:SetBrain(brain)
            inst:RestartBrain()
            local head = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
            inst.components.inventory:DropItem(head)
            local hands = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
            inst.components.inventory:DropItem(hands)
            local body = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
            inst.components.inventory:DropItem(body)
            inst.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
            inst.AnimState:Show("ARM_carry")
            inst.AnimState:Hide("ARM_normal")
            inst.HUD.controls.crafttabs:Hide()
            inst.HUD.controls.inv:Hide()
            local light = inst.entity:AddLight()
            light:SetIntensity(.8)
            light:SetRadius(20)
            light:SetFalloff(.6)
            light:Enable(true)
            light:SetColour(255/255,255/255,0/255)
            inst.components.locomotor.walkspeed = 10
            inst.components.locomotor.runspeed = 15
            inst:SetStateGraph("SGshadowwaxwell")
            inst.components.health:SetInvincible(true)
            inst.components.hunger:Pause()
            inst.components.sanity.ignore = true
            inst.components.temperature:SetTemp(20)
            inst.components.combat:SetDefaultDamage(200)
            inst.components.combat:SetAttackPeriod(0.25)
            inst.components.combat:SetRange(3)
            inst.components.combat:SetRetargetFunction(1, function(inst)
                if not inst.components.health:IsDead() then
                    return FindEntity(inst, 50, function(guy)
                        if guy.components.health and not guy.components.health:IsDead() then
                           return guy.components.combat.target == inst or inst.components.combat.target == guy or guy:HasTag("monster")
                        end
                    end )
                end
            end )
            inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
        end )
     else
        inst.components.locomotor:Stop()
        inst:SetBrain(nil)
        inst.components.talker:ShutUp()
        inst:DoTaskInTime(0.3, function() 
            inst:RemoveTag("patrol")
            inst.SoundEmitter:PlaySound("dontstarve/HUD/research_available")
            inst.AnimState:SetBloomEffectHandle("")
            local brain = require "brains/wilsonbrain"
            inst:SetBrain(brain)
            inst:RestartBrain()
            inst:RemoveComponent("knownlocations")
            inst.AnimState:Hide("ARM_carry")
            inst.AnimState:Show("ARM_normal")
            inst.HUD.controls.crafttabs:Show()
            inst.HUD.controls.inv:Show()
            inst.Light:Enable(false)
            inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
            inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
            inst:SetStateGraph("SGwilson")
            inst.components.health:SetInvincible(false)
            inst.components.hunger:Resume()
            inst.components.sanity.ignore = false
            inst.components.temperature:SetTemp(nil)
            inst.components.hunger:DoDelta(-inst.components.hunger.max*.5)
            inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
            inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
            inst.components.combat:SetRange(2)
            inst.components.combat:SetTarget(nil)
            inst.components.combat:SetRetargetFunction(nil, nil )
            inst.components.combat:SetKeepTargetFunction(nil)
            inst.components.playercontroller:Enable(true)
        end )
    end
end )

    ɰF8ǾģʽCPUӹǵĿȨԶѲ߲ڵҹվڣһֵˣսǵԡֵȫ޾庮ͺڰ뵣ǵİȫٴΰF8ɻֶָۼһ뼢ֵע⼰ʱʳģʽǰ뽫ϵװȫж£򽫵ڵ




.ͺգ˿еͺգιʳӣι񵰣

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\spoiledfood.luaļinst:AddComponent("inspectable")һвinst:AddComponent("tradable")


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\silk.luaļinst:AddComponent("inspectable")һвݣ

local function makecage(inst)
    local pt = inst:GetPosition()
    local cage = SpawnPrefab("silk")
    cage.Transform:SetPosition(pt.x, pt.y, pt.z)
    cage.AnimState:SetBank("birdcage")
    cage.AnimState:SetBuild("bird_cage")
    cage.AnimState:PlayAnimation("idle")
    cage.AnimState:SetMultColour(0/255,255/255,0/255,1)
    MakeObstaclePhysics(cage, .5 )
    cage:RemoveComponent("tradable")
    cage:RemoveComponent("stackable")
    cage:RemoveComponent("inventoryitem")
    cage:RemoveComponent("upgrader")
    cage:RemoveComponent("deployable")
    cage:RemoveTag("cattoy")
    cage:AddComponent("named")
    cage.components.named:SetName("Buzzard")
    cage:AddComponent("lootdropper")
    cage:AddComponent("workable")
    cage.components.workable:SetWorkAction(ACTIONS.HAMMER)
    cage.components.workable:SetWorkLeft(3)
    cage.components.workable:SetOnFinishCallback(function(cage, worker)
        SpawnPrefab("collapse_big").Transform:SetPosition(cage.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos = Vector3(cage.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)
        for k,v in pairs(ents) do
            if v:HasTag("cageanimal") then
               v:Remove()
            end
        end
        cage:Remove()
    end )
    cage:AddComponent("trader")
    cage.components.trader:SetAcceptTest(function(cage, item) 
        if item.prefab == "spoiled_food" or item.prefab == "meat" or item.prefab == "smallmeat" then
           return true
        end
        return false
    end )
    cage.components.trader.onaccept = function(cage, giver, item)
        GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/buzzard/taunt")
        if item.prefab == "spoiled_food" then
           for k = 1, math.random(5) do
               local names = {"carrot_seeds","corn_seeds","pumpkin_seeds","eggplant_seeds","durian_seeds","pomegranate_seeds","dragonfruit_seeds","watermelon_seeds","seeds"}
               local name = names[math.random(#names)]
               cage.components.lootdropper:SpawnLootPrefab(name)
           end
        end
        if item.prefab == "meat" or item.prefab == "smallmeat" then
           cage.components.lootdropper:SpawnLootPrefab("tallbirdegg")
        end
    end
    cage:AddTag("cages")
    local animal = SpawnPrefab("silk")
    animal.AnimState:SetBank("buzzard")
    animal.AnimState:SetBuild("buzzard_build")
    animal.AnimState:PlayAnimation("idle", true)
    animal.Transform:SetFourFaced()
    animal.Physics:SetActive(false)
    animal.entity:AddSoundEmitter()
    animal:AddTag("NOCLICK")
    animal:RemoveComponent("tradable")
    animal:RemoveComponent("stackable")
    animal:RemoveComponent("inventoryitem")
    animal:RemoveComponent("upgrader")
    animal:RemoveComponent("deployable")
    animal:RemoveTag("cattoy")
    local follower = animal.entity:AddFollower()
    follower:FollowSymbol( cage.GUID, "swap_object", -10, -220, -0.1 )
    animal:DoPeriodicTask(10, function(animal)
        animal.AnimState:PlayAnimation("caw")
        animal.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/buzzard/taunt")
        animal:DoTaskInTime(1.5, function() animal.AnimState:PlayAnimation("idle", true) end )
    end )
    animal:AddTag("cageanimal")
end
local function OnDeploy (inst, pt)
    makecage(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("cages") then
       data.cages = true
    end
    if inst:HasTag("cageanimal") then
       data.cageanimal = true
    end
end
local function onload(inst, data)
    if data and data.cages then
       makecage(inst)
       inst:Remove()
    end
    if data and data.cageanimal then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ˿ֹеͺգ1˿ԵҼŶ򲻻ֳιʳƷֲֵӣι⡢С񵰡Ҫͺˣôҵ




İ.㻨̳ʯֻ̳ӳ䣬ÿө棩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\flint.luaļinst:AddComponent("inspectable")һвݣ

local names = {"f1","f2","f3","f4","f5","f6","f7","f8","f9","f10"}
local function OnDeploy (inst, pt)
    local flowerpot = SpawnPrefab("flint")
    flowerpot.Transform:SetPosition(pt.x, pt.y, pt.z)
    flowerpot.AnimState:SetBank("firepit")
    flowerpot.AnimState:SetBuild("firepit")
    flowerpot.AnimState:PlayAnimation("idle",false)
    flowerpot.Transform:SetScale(0.5, 0.8, 0.5)
    flowerpot:RemoveComponent("edible")
    flowerpot:RemoveComponent("tradable")
    flowerpot:RemoveComponent("stackable")
    flowerpot:RemoveComponent("inventoryitem")
    flowerpot:RemoveComponent("bait")
    flowerpot:RemoveTag("molebait")
    flowerpot:AddTag("flowerpot")
    flowerpot:AddComponent("workable")
    flowerpot.components.workable:SetWorkAction(ACTIONS.HAMMER)
    flowerpot.components.workable:SetWorkLeft(3)
    flowerpot.components.workable:SetOnFinishCallback(function(flowerpot)
        SpawnPrefab("collapse_big").Transform:SetPosition(flowerpot.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
        local pos1 = Vector3(flowerpot.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 0.5)
        for k,v in pairs(ents) do
            if v:HasTag("newflower") then
               v:Remove()
            end
        end
        flowerpot:Remove()
    end )
    flowerpot:ListenForEvent( "dusktime", function()
        if flowerpot:HasTag("flowering") then
           for k = 1,math.random(2,5) do
               local pt1 = flowerpot:GetPosition()
               local fireflies = SpawnPrefab("fireflies")
               fireflies.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
           end
        end
    end , GetWorld() )
    flowerpot:ListenForEvent( "daytime", function()
        local pos = Vector3(flowerpot.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
        for k,v in pairs(ents) do
            if v.prefab == "fireflies" and not v.components.inventoryitem:IsHeld() then
               v:Remove()
            end
        end
    end , GetWorld() )
    flowerpot:AddComponent("trader")
    flowerpot.components.trader:SetAcceptTest(function(flowerpot, item)
        if not flowerpot:HasTag("flowering") then
           if item.prefab == "seeds" then
              return true
           end
        end
        return false
    end )
    flowerpot.components.trader.onaccept = function(flowerpot, giver, item)
        local flower = SpawnPrefab("flint")
        flower.AnimState:SetBank("flowers")
        flower.AnimState:SetBuild("flowers")
        flower.animname = names[math.random(#names)]
        flower.AnimState:PlayAnimation(flower.animname)
        flower.AnimState:SetRayTestOnBB(true)
        flower.Transform:SetScale(1.5, 1.5, 1.5)
        flower.Physics:SetActive(false)
        local follower = flower.entity:AddFollower()
        follower:FollowSymbol( flowerpot.GUID, "swap_object", 0, -50, 0 )
        flower:RemoveComponent("edible")
        flower:RemoveComponent("tradable")
        flower:RemoveComponent("stackable")
        flower:RemoveComponent("inventoryitem")
        flower:RemoveComponent("bait")
        flower:RemoveTag("molebait")
        flower:AddComponent("sanityaura")
        flower.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
        flower:AddComponent("pickable")
        flower.components.pickable.picksound = "dontstarve/wilson/pickup_plants"
        flower.components.pickable:SetUp("petals", 0.1)
	flower.components.pickable.onpickedfn = function(flower)
            flower:Remove()
            flower = nil
            flowerpot:RemoveTag("flowering")
        end
        flower:AddTag("newflower")
        flower:AddTag("goodbye")
        flowerpot:AddTag("flowering")
    end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("flowerpot") then
        data.flowerpot = true
    end
    if inst:HasTag("flowering") then
        data.flowering = true
    end
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.flowerpot then
       inst.AnimState:SetBank("firepit")
       inst.AnimState:SetBuild("firepit")
       inst.AnimState:PlayAnimation("idle",false)
       inst.Transform:SetScale(0.5, 0.8, 0.5)
       inst:RemoveComponent("edible")
       inst:RemoveComponent("tradable")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("bait")
       inst:RemoveTag("molebait")
       inst:AddTag("flowerpot")
       inst:AddComponent("workable")
       inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
       inst.components.workable:SetWorkLeft(3)
       inst.components.workable:SetOnFinishCallback(function(inst)
           SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
           GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
           local pos1 = Vector3(inst.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 0.5)
           for k,v in pairs(ents) do
               if v:HasTag("newflower") then
                  v:Remove()
               end
           end
           inst:Remove()
       end )
       inst:ListenForEvent( "dusktime", function()
           if inst:HasTag("flowering") then
              for k = 1,math.random(2,5) do
                  local pt1 = inst:GetPosition()
                  local fireflies = SpawnPrefab("fireflies")
                  fireflies.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
              end
           end
       end , GetWorld() )
       inst:ListenForEvent( "daytime", function()
           local pos = Vector3(inst.Transform:GetWorldPosition())
           local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
           for k,v in pairs(ents) do
               if v.prefab == "fireflies" and not v.components.inventoryitem:IsHeld() then
                  v:Remove()
               end
           end
       end , GetWorld() )
       inst:AddComponent("trader")
       inst.components.trader:SetAcceptTest(function(inst, item)
           if not inst:HasTag("flowering") then
              if item.prefab == "seeds" then
                 return true
              end
           end
           return false
       end )
       inst.components.trader.onaccept = function(inst, giver, item)
           local flower = SpawnPrefab("flint")
           flower.AnimState:SetBank("flowers")
           flower.AnimState:SetBuild("flowers")
           flower.animname = names[math.random(#names)]
           flower.AnimState:PlayAnimation(flower.animname)
           flower.AnimState:SetRayTestOnBB(true)
           flower.Transform:SetScale(1.5, 1.5, 1.5)
           flower.Physics:SetActive(false)
           local follower = flower.entity:AddFollower()
           follower:FollowSymbol( inst.GUID, "swap_object", 0, -50, 0 )
           flower:RemoveComponent("edible")
           flower:RemoveComponent("tradable")
           flower:RemoveComponent("stackable")
           flower:RemoveComponent("inventoryitem")
           flower:RemoveComponent("bait")
           flower:RemoveTag("molebait")
           flower:AddComponent("sanityaura")
           flower.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
           flower:AddComponent("pickable")
           flower.components.pickable.picksound = "dontstarve/wilson/pickup_plants"
           flower.components.pickable:SetUp("petals", 0.1)
	   flower.components.pickable.onpickedfn = function(flower)
               flower:Remove()
               flower = nil
               inst:RemoveTag("flowering")
           end
           flower:AddTag("newflower")
           flower:AddTag("goodbye")
           inst:AddTag("flowering")
       end
    end
    if data and data.flowering then
       local flower = SpawnPrefab("flint")
       flower.AnimState:SetBank("flowers")
       flower.AnimState:SetBuild("flowers")
       flower.animname = names[math.random(#names)]
       flower.AnimState:PlayAnimation(flower.animname)
       flower.AnimState:SetRayTestOnBB(true)
       flower.Transform:SetScale(1.5, 1.5, 1.5)
       flower.Physics:SetActive(false)
       local follower = flower.entity:AddFollower()
       follower:FollowSymbol( inst.GUID, "swap_object", 0, -50, 0 )
       flower:RemoveComponent("edible")
       flower:RemoveComponent("tradable")
       flower:RemoveComponent("stackable")
       flower:RemoveComponent("inventoryitem")
       flower:RemoveComponent("bait")
       flower:RemoveTag("molebait")
       flower:AddComponent("sanityaura")
       flower.components.sanityaura.aura = TUNING.SANITYAURA_SMALL
       flower:AddComponent("pickable")
       flower.components.pickable.picksound = "dontstarve/wilson/pickup_plants"
       flower.components.pickable:SetUp("petals", 0.1)
       flower.components.pickable.onpickedfn = function(flower)
           flower:Remove()
           flower = nil
           inst:RemoveTag("flowering")
       end
       flower:AddTag("newflower")
       flower:AddTag("goodbye")
       inst:AddTag("flowering")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ʯ㻨̳ڻ̳з1ӣӶԻ̳ɿһ仨Ʒ㻨䣬ժû̳꣩лʱԲԣÿө棨ʱʧ鲶׽ɡͬʱ޸ˡϳꡱͿԽץөƽ𡣲Ҫ㻨̳ʱôҵ




ľ.ԣûԣÿɲԣҶɱɫ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\fertilizer.luaļinst:AddComponent("inspectable")һвݣ

local function createoak(inst)
    local pt = inst:GetPosition()
    local oak = SpawnPrefab("fertilizer")
    oak.Transform:SetPosition(pt.x, pt.y, pt.z)
    oak.AnimState:SetBank("fertilizer")
    oak.AnimState:SetBuild("fertilizer")
    oak.AnimState:PlayAnimation("idle")
    oak.Transform:SetScale(1.2, 1.2, 1.2)
    oak:RemoveComponent("inventoryitem")
    oak:RemoveComponent("finiteuses")
    oak:RemoveComponent("fertilizer")
    oak:RemoveComponent("smotherer")
    oak:RemoveComponent("deployable")
    oak:AddTag("NOCLICK")
    oak:ListenForEvent( "daytime", function()
        local pos = Vector3(oak.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)
        for k,v in pairs(ents) do
            if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
               if v.prefab == "acorn" then
                  v:Remove()
               end
            end
        end
        oak:DoTaskInTime(0.3, function(oak)
            oak:StartThread(function()
                for k = 1,math.random(3,6) do
                    local pt1 = oak:GetPosition()
                    local acorn = SpawnPrefab("acorn")
                    acorn.Transform:SetPosition(pt1.x+(math.random(2)-math.random(2)), 5, pt1.z+(math.random(2)-math.random(2)))
                    Sleep(0.3)
                end
            end )
        end )
    end , GetWorld() )
    oak:AddTag("oak")
    oak.tree = SpawnPrefab("fertilizer")
    oak.tree.AnimState:SetBank("tree_leaf")
    oak.tree.AnimState:SetBuild("tree_leaf_trunk_build")
    local names = {"tree_leaf_green_build","tree_leaf_red_build","tree_leaf_orange_build","tree_leaf_yellow_build"}
    local name = names[math.random(#names)]
    oak.tree.AnimState:OverrideSymbol("swap_leaves", name, "swap_leaves")
    oak.tree.AnimState:PlayAnimation("idle_tall")
    oak.tree.Transform:SetScale(0.8, 0.8, 0.8)
    oak.tree.Physics:SetActive(false)
    oak.tree:RemoveComponent("inventoryitem")
    oak.tree:RemoveComponent("finiteuses")
    oak.tree:RemoveComponent("fertilizer")
    oak.tree:RemoveComponent("smotherer")
    oak.tree:RemoveComponent("deployable")
    local follower = oak.tree.entity:AddFollower()
    follower:FollowSymbol( oak.GUID, "swap_object", -1, -115, 0 )
    oak.tree:AddComponent("sanityaura")
    oak.tree.components.sanityaura.aura = TUNING.SANITYAURA_MED
    oak.tree:AddComponent("workable")
    oak.tree.components.workable:SetWorkAction(ACTIONS.CHOP)
    oak.tree.components.workable:SetWorkLeft(1)
    oak.tree.components.workable:SetOnFinishCallback(function()
        SpawnPrefab("collapse_big").Transform:SetPosition(oak.tree.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos = Vector3(oak.tree.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 1)
        for k,v in pairs(ents) do
            if v:HasTag("oak") then
               v:Remove()
            end
        end
        oak.tree:Remove()
    end )
    oak.tree.components.inspectable.getstatus = function()
        local names = {"tree_leaf_green_build","tree_leaf_red_build","tree_leaf_orange_build","tree_leaf_yellow_build"}
        local name = names[math.random(#names)]
        oak.tree.AnimState:OverrideSymbol("swap_leaves", name, "swap_leaves")
    end
    oak.tree:AddTag("goodbye")
end
local function OnDeploy (inst, pt)
    createoak(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("oak") then
        data.oak = true
    end
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.oak then
       createoak(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ûԣļ࣬ÿ峿ɲԡɸıҶɫҪˣøӿɡֲѡźܲ£3㡢2Ӳͷ4ľͷ




声.С͵ƣ֩С͵ƣڵԶȼȼգ̿ʳȡů

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\log.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("cookable")
    inst.components.cookable.product = "charcoal"


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\spidergland.luaļinst:AddComponent("inspectable")һвݣ

local colours=
{
    {198/255,43/255,43/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {233/255,208/255,69/255},
    {109/255,50/255,163/255},
    {222/255,126/255,39/255},
}
local function OnDeploy (inst, pt)
    local lamp = SpawnPrefab("spidergland")
    lamp.Transform:SetPosition(pt.x, pt.y, pt.z)
    lamp.AnimState:SetBank("trinkets")
    lamp.AnimState:SetBuild("trinkets")
    lamp.AnimState:PlayAnimation(tostring(2))
    lamp.components.inventoryitem:ChangeImageName("trinket_2")
    lamp.entity:AddSoundEmitter()
    lamp.Transform:SetScale(1.2,1.2,1.2)
    lamp.colour_idx = math.random(#colours)
    lamp.AnimState:SetMultColour(colours[lamp.colour_idx][1],colours[lamp.colour_idx][2],colours[lamp.colour_idx][3],1)
    lamp:RemoveComponent("stackable")
    lamp:RemoveComponent("tradable")
    lamp:RemoveComponent("healer")
    lamp:RemoveComponent("burnable")
    lamp:RemoveComponent("propagator")
    lamp:RemoveComponent("deployable")
    lamp:RemoveTag("cattoy")
    lamp:AddComponent("cooker")
    lamp:AddComponent("burnable")
    lamp.components.burnable:SetFXLevel(3)
    lamp.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) )
    lamp.components.burnable:Ignite(true)
    lamp.components.inventoryitem:SetOnDroppedFn(function() lamp.components.burnable:Ignite(true) lamp:AddTag("ontheground") end )
    lamp.components.inventoryitem:SetOnPickupFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end )
    lamp.components.inventoryitem:SetOnPutInInventoryFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end )
    lamp:ListenForEvent("onignite", function()
        if not lamp.components.cooker then lamp:AddComponent("cooker") end
    end )
    lamp:ListenForEvent("onextinguish", function()
        lamp.SoundEmitter:PlaySound("dontstarve/common/fireOut")  
        if lamp.components.cooker then lamp:RemoveComponent("cooker") end
    end )
    lamp:AddComponent("workable")
    lamp.components.workable:SetWorkAction(ACTIONS.HAMMER)
    lamp.components.workable:SetWorkLeft(3)
    lamp.components.workable:SetOnFinishCallback(function(lamp)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(lamp.Transform:GetWorldPosition())
        lamp:Remove()
    end )
    lamp:AddTag("ontheground")
    lamp:AddTag("light")
    lamp:AddTag("lamps")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

local function onsave(inst, data)
    if inst:HasTag("lamps") then
       data.lamps = true
    end
    if inst:HasTag("ontheground") then
       data.ontheground = true
    end
    data.colour_idx = inst.colour_idx
end
local function onload(inst, data)
  if data and data.lamps then
    inst.AnimState:SetBank("trinkets")
    inst.AnimState:SetBuild("trinkets")
    inst.AnimState:PlayAnimation(tostring(2))
    inst.components.inventoryitem:ChangeImageName("trinket_2")
    inst.entity:AddSoundEmitter()
    inst.Transform:SetScale(1.2,1.2,1.2)
    inst.colour_idx = math.random(#colours)
    inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("healer")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("cattoy")
    inst:AddComponent("burnable")
    inst.components.burnable:SetFXLevel(3)
    inst.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) )
    inst.components.inventoryitem:SetOnDroppedFn(function() inst.components.burnable:Ignite(true) inst:AddTag("ontheground") end )
    inst.components.inventoryitem:SetOnPickupFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end )
    inst.components.inventoryitem:SetOnPutInInventoryFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end )
    inst:ListenForEvent("onignite", function()
        if not inst.components.cooker then inst:AddComponent("cooker") end
    end )
    inst:ListenForEvent("onextinguish", function()
        inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")  
        if inst.components.cooker then inst:RemoveComponent("cooker") end
    end )
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst:Remove()
    end )
    inst:AddTag("light")
    inst:AddTag("lamps")
  end
  if data and data.ontheground then
    inst.components.burnable:Ignite(true)
    inst:AddComponent("cooker")
    inst:AddTag("ontheground")
  end
  if data and data.colour_idx then
     inst.colour_idx = math.min(#colours, data.colour_idx)
     inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ֩С͵ƣɫκȼϣڵԶȼԶϨľͷ͵ưɽľͷճ̿ҲɿʳȡůбرҪС͵ʱôҵ




һ.ҵԶŶֹ̰񣬿ɻ˰գоѲ߲ǲ

    ü±ϷĿ¼\data\scripts\prefabs\ruins_bat.luaļinst:AddComponent("inspectable")һвݣ

local items = { SWORD = "swap_spear" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function createguru(inst)
    local pt = inst:GetPosition()
    local guru = SpawnPrefab("ruins_bat")
    guru.Transform:SetPosition(pt.x, pt.y, pt.z)
    guru.AnimState:SetBank("wilson")
    if GetPlayer().prefab == "wilson" then guru.AnimState:SetBuild("wilson") end
    if GetPlayer().prefab == "wendy" then guru.AnimState:SetBuild("wendy") end
    if GetPlayer().prefab == "wes" then guru.AnimState:SetBuild("wes") end
    if GetPlayer().prefab == "wickerbottom" then guru.AnimState:SetBuild("wickerbottom") end
    if GetPlayer().prefab == "willow" then guru.AnimState:SetBuild("willow") end
    if GetPlayer().prefab == "wolfgang" then guru.AnimState:SetBuild("wolfgang") end
    if GetPlayer().prefab == "wx78" then guru.AnimState:SetBuild("wx78") end
    if GetPlayer().prefab == "woodie" then guru.AnimState:SetBuild("woodie") end
    if GetPlayer().prefab == "waxwell" then guru.AnimState:SetBuild("waxwell") end
    if GetPlayer().prefab == "wathgrithr" then guru.AnimState:SetBuild("wathgrithr") end
    if GetPlayer().prefab == "webber" then guru.AnimState:SetBuild("webber") end
    guru.AnimState:PlayAnimation("idle")
    guru.AnimState:OverrideSymbol("swap_object", "swap_cane", "swap_cane")
    guru.AnimState:Hide("ARM_normal") 
    guru.AnimState:Show("ARM_carry")
    guru.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat")
    guru.AnimState:Show("HAT")
    guru.AnimState:Show("HAT_HAIR")
    guru.AnimState:Hide("HAIR_NOHAT")
    guru.AnimState:Hide("HAIR")
    guru.Transform:SetFourFaced()
    guru.Transform:SetRotation( 0 )
    guru.Transform:SetScale(3.5, 3.5, 3.5)
    local shadow = guru.entity:AddDynamicShadow()
    shadow:SetSize( 6, 3.5 )
    local minimap = guru.entity:AddMiniMapEntity()
    minimap:SetIcon( "obelisk.png" )
    guru.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    guru:AddTag("guru")
    guru:RemoveTag("sharp")
    guru:RemoveComponent("weapon")
    guru:RemoveComponent("finiteuses")
    guru:RemoveComponent("inventoryitem")
    guru:RemoveComponent("equippable")
    guru:RemoveComponent("deployable")
    local light = guru.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    guru:AddComponent("workable")
    guru.components.workable:SetWorkAction(ACTIONS.HAMMER)
    guru.components.workable:SetWorkLeft(5)
    guru.components.workable:SetOnFinishCallback(function(guru)
        SpawnPrefab("collapse_big").Transform:SetPosition(guru.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        guru:Remove()
    end )
    guru:AddComponent("pickable")
    guru.components.pickable:SetUp("goldnugget", 480, math.random(15,25))
    guru.components.pickable:SetOnPickedFn(function(guru) guru.AnimState:SetBloomEffectHandle("") end )
    guru.components.pickable:SetOnRegenFn(function(guru) guru.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end )
    guru:ListenForEvent( "daytime", function()
        for k = 1,math.random(10,25) do
            local pt0 = guru:GetPosition()
            local ground = GetWorld()
            local x = pt0.x+(math.random(50)-math.random(50))
            local z = pt0.z+(math.random(50)-math.random(50))
            local tile = ground.Map:GetTileAtPoint(x,0, z)
            if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then
               local militia = SpawnPrefab("ruins_bat")
               militia.Transform:SetPosition(x,0,z)
               militia.AnimState:SetBank("wilson")
               local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
               local buildname = buildnames[math.random(#buildnames)]
               militia.AnimState:SetBuild(buildname)
               militia.AnimState:OverrideSymbol("swap_hat", "hat_walrus", "swap_hat")
               militia.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body")
               militia.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
               militia.AnimState:Show("HAT")
               militia.AnimState:Show("HAT_HAIR")
               militia.AnimState:Hide("HAIR_NOHAT")
               militia.AnimState:Hide("HAIR")
               militia.AnimState:Hide("ARM_normal")
               militia.AnimState:Show("ARM_carry")
               militia.AnimState:PlayAnimation("idle")
               militia.Transform:SetFourFaced()
               local shadow = militia.entity:AddDynamicShadow()
               shadow:SetSize( 1.3, .6 )
               MakeCharacterPhysics(militia, 75, .5)
               local minimap = militia.entity:AddMiniMapEntity()
               minimap:SetIcon( "statue_small.png" )
               militia:AddTag("militia")
               militia:AddComponent("locomotor")
               militia.components.locomotor.walkspeed = 5
               militia.components.locomotor.runspeed = 10
               militia:SetStateGraph("SGshadowwaxwell")
               local brain = require "brains/frogbrain"
               militia:SetBrain(brain)
               militia:RemoveTag("sharp")
               militia:RemoveComponent("weapon")
               militia:RemoveComponent("finiteuses")
               militia:RemoveComponent("inventoryitem")
               militia:RemoveComponent("equippable")
               militia:RemoveComponent("deployable")
               militia:AddComponent("follower")
               militia:AddComponent("knownlocations")
               militia:AddComponent("health")
               militia.components.health:SetMaxHealth(1200)
               militia.components.health.nofadeout = true
               militia:AddComponent("combat")
               militia.components.combat:SetDefaultDamage(20)
               militia.components.combat:SetAttackPeriod(1)
               militia.components.combat.hiteffectsymbol = "torso"
               militia.components.combat:SetRange(2, 3)
               militia.components.combat:SetRetargetFunction(2, function(militia)
                   if not militia.components.health:IsDead() then
                       return FindEntity(militia, 25, function(guy)
                           if guy.components.health and not guy.components.health:IsDead() then
                              return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                           end
                       end )
                   end
               end )
               militia.components.combat:SetKeepTargetFunction(function(militia, target) return target and target:IsValid() end )
               militia:ListenForEvent("attacked", function(militia, data)
                   militia.components.combat:SetTarget(data.attacker)
               end )
               militia.components.inspectable.getstatus = function(militia)
                   if not militia:HasTag("letsgo") then
                      local brain = require "brains/abigailbrain"
                      militia:SetBrain(brain)
                      militia:RestartBrain()
                      militia.components.follower:SetLeader(GetPlayer())
                      militia:AddTag("letsgo")
                   else
                      local brain = require "brains/frogbrain"
                      militia:SetBrain(brain)
                      militia:RestartBrain()
                      militia.components.follower:SetLeader(nil)
                      militia:RemoveTag("letsgo")
                   end
               end
               militia:ListenForEvent( "nighttime", function() militia:Remove() end , GetWorld())
            end
        end
    end , GetWorld())
end
local function OnDeploy (inst, pt)
    if GetPlayer().components.inventory:Has("goldnugget", 1000) then 
       GetPlayer().components.inventory:ConsumeByName("goldnugget", 1000)
       createguru(inst)
       inst:Remove()
    end
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("guru") then
        data.guru = true
    end
    if inst:HasTag("militia") then
        data.militia = true
    end
    if inst:HasTag("letsgo") then
        data.letsgo = true
    end
end
local function onload(inst, data)
    if data and data.guru then
       createguru(inst)
       inst:Remove()
    end
    if data and data.militia then
       inst.AnimState:SetBank("wilson")
       local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
       local buildname = buildnames[math.random(#buildnames)]
       inst.AnimState:SetBuild(buildname)
       inst.AnimState:OverrideSymbol("swap_hat", "hat_walrus", "swap_hat")
       inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body")
       inst.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
       inst.AnimState:Show("HAT")
       inst.AnimState:Show("HAT_HAIR")
       inst.AnimState:Hide("HAIR_NOHAT")
       inst.AnimState:Hide("HAIR")
       inst.AnimState:Hide("ARM_normal")
       inst.AnimState:Show("ARM_carry")
       inst.AnimState:PlayAnimation("idle")
       inst.Transform:SetFourFaced()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize( 1.3, .6 )
       MakeCharacterPhysics(inst, 75, .5)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "statue_small.png" )
       inst:AddTag("militia")
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 5
       inst.components.locomotor.runspeed = 10
       inst:SetStateGraph("SGshadowwaxwell")
       local brain = require "brains/frogbrain"
       inst:SetBrain(brain)
       inst:RemoveTag("sharp")
       inst:RemoveComponent("weapon")
       inst:RemoveComponent("finiteuses")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("equippable")
       inst:RemoveComponent("deployable")
       inst:AddComponent("follower")
       inst:AddComponent("knownlocations")
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(1200)
       inst.components.health.nofadeout = true
       inst:AddComponent("combat")
       inst.components.combat:SetDefaultDamage(20)
       inst.components.combat:SetAttackPeriod(1)
       inst.components.combat.hiteffectsymbol = "torso"
       inst.components.combat:SetRange(2, 3)
       inst.components.combat:SetRetargetFunction(2, function(inst)
           if not inst.components.health:IsDead() then
              return FindEntity(inst, 25, function(guy)
                  if guy.components.health and not guy.components.health:IsDead() then
                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                  end
              end )
           end
       end )
       inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
       inst:ListenForEvent("attacked", function(inst, data)
           inst.components.combat:SetTarget(data.attacker)
       end )
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("letsgo") then
              local brain = require "brains/abigailbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
              inst:AddTag("letsgo")
           else
              local brain = require "brains/frogbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(nil)
              inst:RemoveTag("letsgo")
           end
       end
       inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld())
    end
    if data and data.letsgo then
       local brain = require "brains/abigailbrain"
       inst:SetBrain(brain)
       inst:RestartBrain()
       inst.components.follower:SetLeader(GetPlayer())
       inst:AddTag("letsgo")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    1000ƽʱԶŶֹ̰Լ󣩣½ϵȨ1000ƽϻƽʱֳ񡣵񷢹ʱص˰ѾϽɣÿһΣ񣬿յ˰ÿ죬ΧоѲߣҹȥǻṥκĵˡ㾯죨Ҫˣ㣨ҹȥٴεɽ档ڴ½񣬽ͳ½ɡͨСͼ鿴ΧСͼʾΪⱮͼ꣬ʾΪʹͼꡣҪʱôҵɡԶŶ̰ԶѡԶż̳£3ľͷ4ʯ4جȼ죬ʱ뿿Զż̳




.ʹÿˮ

    ü±ϷĿ¼\data\scripts\prefabs\batbat.luaļinst:AddComponent("inspectable")һвݣ

local colours=
{
    {198/255,43/255,43/255},
    {0/255,255/255,0/255},
    {0/255,0/255,255/255},
    {255/255,255/255,0/255},
    {109/255,50/255,163/255},
    {255/255,0/255,0/255},
    {255/255,255/255,255/255},
}
local function createtree(inst)
    local pt = inst:GetPosition()
    local phantom = SpawnPrefab("batbat")
    phantom.Transform:SetPosition(pt.x, pt.y, pt.z)
    phantom.AnimState:SetBank("firepit")
    phantom.AnimState:SetBuild("firepit")
    phantom.AnimState:PlayAnimation("idle",false)
    phantom.Transform:SetScale(0.8, 0.8, 0.8)
    phantom:RemoveComponent("weapon")
    phantom:RemoveComponent("finiteuses")
    phantom:RemoveComponent("inventoryitem")
    phantom:RemoveComponent("equippable")
    phantom:RemoveComponent("deployable")
    phantom:RemoveTag("dull")
    phantom:AddTag("NOCLICK")
    local light = phantom.entity:AddLight()
    phantom.Light:SetFalloff(0.6)
    phantom.Light:SetIntensity(.8)
    phantom.Light:SetRadius(5)
    phantom.colour_idx = math.random(#colours)
    phantom.Light:SetColour(colours[phantom.colour_idx][1],colours[phantom.colour_idx][2],colours[phantom.colour_idx][3])
    phantom.Light:Enable(true)
    phantom:DoPeriodicTask(15, function()
        phantom.colour_idx = math.random(#colours)
        phantom.Light:SetColour(colours[phantom.colour_idx][1],colours[phantom.colour_idx][2],colours[phantom.colour_idx][3])
    end )
    phantom:ListenForEvent( "daytime", function()
        local pos = Vector3(phantom.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
        for k,v in pairs(ents) do
            if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
               if v.prefab == "durian" or v.prefab == "pomegranate" or v.prefab == "dragonfruit" then
                  v:Remove()
               end
            end
        end
        phantom:DoTaskInTime(0.3, function(phantom)
            phantom:StartThread(function()
                for k = 1,math.random(3,7) do
                    local pt1 = phantom:GetPosition()
                    local names = {"durian","pomegranate","dragonfruit"}
                    local name = names[math.random(#names)]
                    local fruit = SpawnPrefab(name)
                    fruit.Transform:SetPosition(pt1.x+(math.random(5)-math.random(5)), 5, pt1.z+(math.random(5)-math.random(5)))
                    Sleep(0.3)
                end
            end )
        end )
    end , GetWorld() )
    phantom:AddTag("phantom")
    phantom.long = SpawnPrefab("batbat")
    phantom.long.AnimState:SetBank("worm")
    phantom.long.AnimState:SetBuild("worm")
    phantom.long.AnimState:SetPercent("atk", 0.40)
    phantom.long.Transform:SetScale(1.5, 1.5, 1.5)
    phantom.long.Physics:SetActive(false)
    phantom.long:RemoveComponent("weapon")
    phantom.long:RemoveComponent("finiteuses")
    phantom.long:RemoveComponent("inventoryitem")
    phantom.long:RemoveComponent("equippable")
    phantom.long:RemoveComponent("deployable")
    phantom.long:RemoveTag("dull")
    local follower = phantom.long.entity:AddFollower()
    follower:FollowSymbol( phantom.GUID, "swap_object", 10, -90, 0 )
    phantom.long.components.inspectable.getstatus = function()
        if not GetPlayer():HasTag("climbtree") then
           GetPlayer():AddTag("climbtree")
           GetPlayer().components.playercontroller:Enable(false)
           local pt0 = phantom:GetPosition()
           GetPlayer().Transform:SetPosition(pt0.x, 10.2, pt0.z)
           GetPlayer():DoTaskInTime(5, function()
               GetPlayer().Transform:SetPosition(pt0.x, 0, pt0.z)
               GetPlayer():RemoveTag("climbtree")
               GetPlayer().components.playercontroller:Enable(true)
           end )
        end
    end
    phantom.long:AddTag("lightningrod")
    phantom.long:ListenForEvent("lightningstrike", function()
        phantom.long.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
        phantom.long:DoTaskInTime(60, function()
            phantom.long.AnimState:SetBloomEffectHandle("")
        end )
    end )
    phantom.long:AddComponent("sanityaura")
    phantom.long.components.sanityaura.aura = TUNING.SANITYAURA_MED
    phantom.long:AddTag("goodbye")
    phantom.guo1 = SpawnPrefab("batbat")
    phantom.guo1.AnimState:SetBank("durian")
    phantom.guo1.AnimState:SetBuild("durian")
    phantom.guo1.AnimState:PlayAnimation("idle")
    phantom.guo1.Transform:SetScale(1.5, 1.5, 1.5)
    phantom.guo1.Physics:SetActive(false)
    phantom.guo1:RemoveComponent("weapon")
    phantom.guo1:RemoveComponent("finiteuses")
    phantom.guo1:RemoveComponent("inventoryitem")
    phantom.guo1:RemoveComponent("equippable")
    phantom.guo1:RemoveComponent("deployable")
    phantom.guo1:RemoveTag("dull")
    local follower = phantom.guo1.entity:AddFollower()
    follower:FollowSymbol( phantom.GUID, "swap_object", -550, -580, 0 )
    phantom.guo1:AddTag("NOCLICK")
    phantom.guo1:AddTag("goodbye")
    phantom.guo2 = SpawnPrefab("batbat")
    phantom.guo2.AnimState:SetBank("pomegranate")
    phantom.guo2.AnimState:SetBuild("pomegranate")
    phantom.guo2.AnimState:PlayAnimation("idle")
    phantom.guo2.Transform:SetScale(1.5, 1.5, 1.5)
    phantom.guo2.Physics:SetActive(false)
    phantom.guo2:RemoveComponent("weapon")
    phantom.guo2:RemoveComponent("finiteuses")
    phantom.guo2:RemoveComponent("inventoryitem")
    phantom.guo2:RemoveComponent("equippable")
    phantom.guo2:RemoveComponent("deployable")
    phantom.guo2:RemoveTag("dull")
    local follower = phantom.guo2.entity:AddFollower()
    follower:FollowSymbol( phantom.GUID, "swap_object", 610, -690, 0 )
    phantom.guo2:AddTag("NOCLICK")
    phantom.guo2:AddTag("goodbye")
    phantom.guo3 = SpawnPrefab("batbat")
    phantom.guo3.AnimState:SetBank("dragonfruit")
    phantom.guo3.AnimState:SetBuild("dragonfruit")
    phantom.guo3.AnimState:PlayAnimation("idle")
    phantom.guo3.Transform:SetScale(1.5, 1.5, 1.5)
    phantom.guo3.Physics:SetActive(false)
    phantom.guo3:RemoveComponent("weapon")
    phantom.guo3:RemoveComponent("finiteuses")
    phantom.guo3:RemoveComponent("inventoryitem")
    phantom.guo3:RemoveComponent("equippable")
    phantom.guo3:RemoveComponent("deployable")
    phantom.guo3:RemoveTag("dull")
    local follower = phantom.guo3.entity:AddFollower()
    follower:FollowSymbol( phantom.GUID, "swap_object", -290, -1385, 0 )
    phantom.guo3:AddTag("NOCLICK")
    phantom.guo3:AddTag("goodbye")
end
local function OnDeploy (inst, pt)
    createtree(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("phantom") then
        data.phantom = true
    end
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.phantom then
       createtree(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)

    ɲԣÿˮ磬𵽱á羰5¡᲻ϱ仯߲ʹ⣬ҹҪʱյɡħѡźã£52ľͷ1ϱʯ




.СС֣ǻðʳжݿȬ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("eater")һвݣ

local function OnEat(inst, food)
    if food and food.prefab ~= "mandrake" then
        if math.random()<0.1 then
           if not inst:HasTag("poisoning") and not inst:HasTag("fever") then
              inst:AddTag("poisoning")
              inst.AnimState:SetMultColour(0/255,255/255,0/255,1)
              inst.components.health:DoDelta(-inst.components.health.maxhealth*.2)
              inst.components.sanity:DoDelta(-inst.components.sanity.max*.5)
              inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*.3
              inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*.3
              inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD*5)
              inst.poison = inst:DoPeriodicTask(10, function()
                  inst.components.hunger:DoDelta(-20)
                  inst.components.locomotor:Stop()
                  inst.AnimState:PlayAnimation("pickup")
                  SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
               end )
           end
        end
    end
    if food.prefab == "mandrake" then
        if inst:HasTag("poisoning") then inst:RemoveTag("poisoning") end
        if inst:HasTag("fever") then inst:RemoveTag("fever") end
        if inst.poison then inst.poison:Cancel() inst.poison = nil end
        if inst.fever then inst.fever:Cancel() inst.fever = nil end
        inst.AnimState:SetMultColour(255/255,255/255,255/255,1)
        inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
        inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
        inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
    end
end
    inst.components.eater:SetOnEatFn(OnEat)
local function OnDay(inst)
    if inst:HasTag("poisoning") then
       inst:RemoveTag("poisoning")
       inst.AnimState:SetMultColour(255/255,255/255,255/255,1)
       inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
       inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
       inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
       if inst.poison then inst.poison:Cancel() inst.poison = nil end
    end
    if not inst:HasTag("fever") then
       if math.random()<0.1 then
          inst:AddTag("fever")
          inst.AnimState:SetMultColour(255/255,0/255,0/255,1)
          inst.components.sanity:DoDelta(-inst.components.sanity.max*.5)
          inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*.3
          inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*.3
          inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD*5)
          inst.fever = inst:DoPeriodicTask(15, function()
              inst.components.health:DoDelta(-inst.components.health.maxhealth*.05)
              inst.components.locomotor:Stop()
              inst.AnimState:PlayAnimation("idle_shiver_pre")
              inst.AnimState:PushAnimation("idle_shiver_loop")
              inst.AnimState:PushAnimation("idle_shiver_pst", false)
          end )
       end
    else
       inst:RemoveTag("fever")
       inst.AnimState:SetMultColour(255/255,255/255,255/255,1)
       inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
       inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
       inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
       if inst.fever then inst.fever:Cancel() inst.fever = nil end
    end
end
    inst:ListenForEvent( "daytime", function() OnDay(inst) end, GetWorld())

    Ϸиʵ飬ǻðնʺɫжٻֵ½粻עⲹѪΣա⣬ڳʳʱҲһʷʳжɫжٻҲϳָкֵ½ٶȼӿ졣۸ðʳжֻҪ㿹һ죬ȬݣȬ޸ˡСҲԸʿ5ƽƼҪ롰ϳԷ亣Ʒ䡱һͬ޸




.جβݣجβݣɲجȼϣһʳֵ¾ˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\guano.luaļinst:AddComponent("inspectable")һвݣ

local items = { SWORD = "swap_ham_bat" }
local function EquipItem(inst, item)
    if item then
       inst.AnimState:OverrideSymbol("swap_object", item, item)
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
    end
end
    inst.items = items
    inst.equipfn = EquipItem
    EquipItem(inst)
local function OnDeploy (inst, pt)
    local darkgrass = SpawnPrefab("guano")
    darkgrass.Transform:SetPosition(pt.x, pt.y, pt.z)
    darkgrass.AnimState:SetBank("marsh_plant")
    darkgrass.AnimState:SetBuild("marsh_plant")
    darkgrass.AnimState:PlayAnimation("idle")
    darkgrass.Transform:SetScale(1.8, 1.8, 1.8)
    darkgrass.AnimState:SetMultColour(255/255,255/255,0/255,1)
    darkgrass:RemoveComponent("stackable")
    darkgrass:RemoveComponent("inventoryitem")
    darkgrass:RemoveComponent("fertilizer")
    darkgrass:RemoveComponent("smotherer")
    darkgrass:RemoveComponent("fuel")
    darkgrass:RemoveComponent("burnable")
    darkgrass:RemoveComponent("propagator")
    darkgrass:RemoveComponent("deployable")
    MakeMediumBurnable(darkgrass)
    MakeSmallPropagator(darkgrass)
    if darkgrass.flies then darkgrass.flies:Remove() darkgrass.flies = nil end
    darkgrass:AddComponent("workable")
    darkgrass.components.workable:SetWorkAction(ACTIONS.DIG)
    darkgrass.components.workable:SetWorkLeft(1)
    darkgrass.components.workable:SetOnFinishCallback(function(darkgrass)
        SpawnPrefab("nightmarefuel").Transform:SetPosition(darkgrass.Transform:GetWorldPosition())
        darkgrass:Remove()
    end )
    darkgrass:AddComponent("pickable")
    darkgrass.components.pickable:SetUp("nightmarefuel", 480)
    darkgrass.components.pickable:SetOnRegenFn(function(darkgrass) darkgrass.AnimState:SetMultColour(255/255,255/255,0/255,1) end )
    darkgrass.components.pickable:SetOnPickedFn(function(darkgrass)
        darkgrass.AnimState:SetMultColour(255/255,255/255,255/255,1)
        if math.random()<0.05 then
           GetPlayer().components.playercontroller:ShakeCamera(darkgrass, "FULL", 1.5, 0.03, 2, 30)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           SpawnPrefab("collapse_big").Transform:SetPosition(darkgrass.Transform:GetWorldPosition())
           local giant = SpawnPrefab("guano")
           giant.Transform:SetPosition(darkgrass.Transform:GetWorldPosition())
           giant.entity:AddSoundEmitter()
           giant.AnimState:SetBank("wilson")
           giant.AnimState:SetBuild("wolfgang")
           giant.AnimState:PlayAnimation("idle")
           giant.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat")
           giant.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")
           giant.AnimState:Show("ARM_carry") 
           giant.AnimState:Hide("ARM_normal")
           giant.Transform:SetFourFaced()
           giant.Transform:SetScale(3.5,3.5,3.5)
           local sound = giant.entity:AddSoundEmitter()
           local shadow = giant.entity:AddDynamicShadow()
           shadow:SetSize( 6, 3.5 )
           MakeCharacterPhysics(giant, 200, 1)
           local minimap = giant.entity:AddMiniMapEntity()
           minimap:SetIcon("wolfgang.png")
           local brain = require "brains/leifbrain"
           giant:SetBrain(brain)
           giant:AddComponent("locomotor")
           giant.components.locomotor.walkspeed = 1
           giant.components.locomotor.runspeed = 2
           giant:SetStateGraph("SGshadowwaxwell")
           giant:RemoveComponent("stackable")
           giant:RemoveComponent("inventoryitem")
           giant:RemoveComponent("fertilizer")
           giant:RemoveComponent("smotherer")
           giant:RemoveComponent("fuel")
           giant:RemoveComponent("burnable")
           giant:RemoveComponent("propagator")
           giant:RemoveComponent("deployable")
           if giant.flies then giant.flies:Remove() giant.flies = nil end
           giant:AddComponent("follower")
           giant:AddComponent("inventory")
           giant:AddComponent("combat")
           giant.components.combat.hiteffectsymbol = "torso"
           giant.components.combat:SetDefaultDamage(70)
           giant.components.combat:SetAttackPeriod(3)
           giant.components.combat.onhitotherfn = function()
               giant.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
               GetPlayer().components.playercontroller:ShakeCamera(giant, "FULL", 0.5, 0.05, 2, 40)
           end
           giant.components.combat:SetAreaDamage(5, 0.8)
           giant.components.combat:SetRetargetFunction(3, function(giant)
               if not giant.components.health:IsDead() then
                  return FindEntity(giant, 20, function(guy)
                      return giant.components.combat:CanTarget(guy) and not guy:HasTag("giant")
                  end )
               end
           end )
           giant:ListenForEvent("attacked", function(giant, data)
               giant.components.combat:SetTarget(data.attacker)
           end )
           giant.Physics:SetCollisionCallback(function(giant, other)
               if other and other.components.workable and other.components.workable.workleft > 0 then
                  other.components.workable:Destroy(giant)
               end
           end )
           giant:AddComponent("health")
           giant.components.health:SetMaxHealth(8000)
           giant.components.health.nofadeout = true
           giant:AddComponent("sanityaura")
           giant.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE
           giant:ListenForEvent("death", function()
               local pt1 = giant:GetPosition()
               for k = 1,math.random(20,35) do
                   local gold = SpawnPrefab("goldnugget")
                   gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
               end
               local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"}
               local reward = rewards[math.random(#rewards)]
               SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z)
           end )
           giant:DoTaskInTime(480, function(giant)
               giant:Remove()
           end )
           giant:AddTag("monster")
           giant:AddTag("giant")
        end
    end )
    darkgrass:AddTag("darkgrass")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("darkgrass") then
       data.darkgrass = true
    end
    if inst:HasTag("giant") then
       data.giant = true
    end
end
local function onload(inst, data)
    if data and data.darkgrass then
       inst.AnimState:SetBank("marsh_plant")
       inst.AnimState:SetBuild("marsh_plant")
       inst.AnimState:PlayAnimation("idle")
       inst.Transform:SetScale(1.8, 1.8, 1.8)
       inst.AnimState:SetMultColour(255/255,255/255,0/255,1)
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("fertilizer")
       inst:RemoveComponent("smotherer")
       inst:RemoveComponent("fuel")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveComponent("deployable")
       MakeMediumBurnable(inst)
       MakeSmallPropagator(inst)
       if inst.flies then inst.flies:Remove() inst.flies = nil end
       inst:AddComponent("workable")
       inst.components.workable:SetWorkAction(ACTIONS.DIG)
       inst.components.workable:SetWorkLeft(1)
       inst.components.workable:SetOnFinishCallback(function(inst)
           SpawnPrefab("nightmarefuel").Transform:SetPosition(inst.Transform:GetWorldPosition())
           inst:Remove()
       end )
       inst:AddComponent("pickable")
       inst.components.pickable:SetUp("nightmarefuel", 480)
       inst.components.pickable:SetOnRegenFn(function(inst) inst.AnimState:SetMultColour(255/255,255/255,0/255,1) end )
       inst.components.pickable:SetOnPickedFn(function(inst)
           inst.AnimState:SetMultColour(255/255,255/255,255/255,1)
           if math.random()<0.05 then
              GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 1.5, 0.03, 2, 30)
              GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
              SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
              local giant = SpawnPrefab("guano")
              giant.Transform:SetPosition(inst.Transform:GetWorldPosition())
              giant.entity:AddSoundEmitter()
              giant.AnimState:SetBank("wilson")
              giant.AnimState:SetBuild("wolfgang")
              giant.AnimState:PlayAnimation("idle")
              giant.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat")
              giant.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")
              giant.AnimState:Show("ARM_carry") 
              giant.AnimState:Hide("ARM_normal")
              giant.Transform:SetFourFaced()
              giant.Transform:SetScale(3.5,3.5,3.5)
              local sound = giant.entity:AddSoundEmitter()
              local shadow = giant.entity:AddDynamicShadow()
              shadow:SetSize( 6, 3.5 )
              MakeCharacterPhysics(giant, 200, 1)
              local minimap = giant.entity:AddMiniMapEntity()
              minimap:SetIcon("wolfgang.png")
              local brain = require "brains/leifbrain"
              giant:SetBrain(brain)
              giant:AddComponent("locomotor")
              giant.components.locomotor.walkspeed = 1
              giant.components.locomotor.runspeed = 2
              giant:SetStateGraph("SGshadowwaxwell")
              giant:RemoveComponent("stackable")
              giant:RemoveComponent("inventoryitem")
              giant:RemoveComponent("fertilizer")
              giant:RemoveComponent("smotherer")
              giant:RemoveComponent("fuel")
              giant:RemoveComponent("burnable")
              giant:RemoveComponent("propagator")
              giant:RemoveComponent("deployable")
              if giant.flies then giant.flies:Remove() giant.flies = nil end
              giant:AddComponent("follower")
              giant:AddComponent("inventory")
              giant:AddComponent("combat")
              giant.components.combat.hiteffectsymbol = "torso"
              giant.components.combat:SetDefaultDamage(70)
              giant.components.combat:SetAttackPeriod(3)
              giant.components.combat.onhitotherfn = function()
                  giant.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                  GetPlayer().components.playercontroller:ShakeCamera(giant, "FULL", 0.5, 0.05, 2, 40)
              end
              giant.components.combat:SetAreaDamage(5, 0.8)
              giant.components.combat:SetRetargetFunction(3, function(giant)
                  if not giant.components.health:IsDead() then
                     return FindEntity(giant, 20, function(guy)
                         return giant.components.combat:CanTarget(guy) and not guy:HasTag("giant")
                     end )
                  end
              end )
              giant:ListenForEvent("attacked", function(giant, data)
                  giant.components.combat:SetTarget(data.attacker)
              end )
              giant.Physics:SetCollisionCallback(function(giant, other)
                  if other and other.components.workable and other.components.workable.workleft > 0 then
                     other.components.workable:Destroy(giant)
                  end
              end )
              giant:AddComponent("health")
              giant.components.health:SetMaxHealth(8000)
              giant.components.health.nofadeout = true
              giant:AddComponent("sanityaura")
              giant.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE
              giant:ListenForEvent("death", function()
                  local pt1 = giant:GetPosition()
                  for k = 1,math.random(20,35) do
                      local gold = SpawnPrefab("goldnugget")
                      gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
                  end
                  local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"}
                  local reward = rewards[math.random(#rewards)]
                  SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z)
              end )
              giant:DoTaskInTime(480, function(giant)
                  giant:Remove()
              end )
              giant:AddTag("monster")
              giant:AddTag("giant")
           end
       end )
       inst:AddTag("darkgrass")
     end
    if data and data.giant then
       inst.entity:AddSoundEmitter()
       inst.AnimState:SetBank("wilson")
       inst.AnimState:SetBuild("wolfgang")
       inst.AnimState:PlayAnimation("idle")
       inst.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat")
       inst.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body")
       inst.AnimState:Show("ARM_carry") 
       inst.AnimState:Hide("ARM_normal")
       inst.Transform:SetFourFaced()
       inst.Transform:SetScale(3.5,3.5,3.5)
       local sound = inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize( 6, 3.5 )
       MakeCharacterPhysics(inst, 200, 1)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon("wolfgang.png")
       local brain = require "brains/leifbrain"
       inst:SetBrain(brain)
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 1
       inst.components.locomotor.runspeed = 2
       inst:SetStateGraph("SGshadowwaxwell")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("fertilizer")
       inst:RemoveComponent("smotherer")
       inst:RemoveComponent("fuel")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveComponent("deployable")
       if inst.flies then inst.flies:Remove() inst.flies = nil end
       inst:AddComponent("follower")
       inst:AddComponent("inventory")
       inst:AddComponent("combat")
       inst.components.combat.hiteffectsymbol = "torso"
       inst.components.combat:SetDefaultDamage(70)
       inst.components.combat:SetAttackPeriod(3)
       inst.components.combat.onhitotherfn = function()
           inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40)
       end
       inst.components.combat:SetAreaDamage(5, 0.8)
       inst.components.combat:SetRetargetFunction(3, function(inst)
           if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                  return inst.components.combat:CanTarget(guy) and not guy:HasTag("giant")
              end )
           end
       end )
       inst:ListenForEvent("attacked", function(inst, data)
           inst.components.combat:SetTarget(data.attacker)
       end )
       inst.Physics:SetCollisionCallback(function(inst, other)
           if other and other.components.workable and other.components.workable.workleft > 0 then
              other.components.workable:Destroy(inst)
           end
       end )
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(8000)
       inst.components.health.nofadeout = true
       inst:AddComponent("sanityaura")
       inst.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE
       inst:ListenForEvent("death", function()
           local pt1 = inst:GetPosition()
           for k = 1,math.random(20,35) do
               local gold = SpawnPrefab("goldnugget")
               gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
           end
           local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"}
           local reward = rewards[math.random(#rewards)]
           SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z)
       end )
       inst:DoTaskInTime(480, function(inst)
           inst:Remove()
       end )
       inst:AddTag("monster")
       inst:AddTag("giant")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ࣨɫ㣩جβݣԶֲɲժجȼϣÿ춼ܲһΡժʱһʳֵ¾ˣ㣬˿ɻûƽ𡢾¹Զػ߽ǡȱ˵Ѫǿ򲻹ܱܱܷͷһ˽ص¡СͼʾΪʿͼ꣬ŵ߰




.ȻȪôƤȪɻָԣץ㣩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tentaclespots.luaļinst:AddComponent("inspectable")һвݣ

local function spa(inst)
    local pt = inst:GetPosition()
    local spa = SpawnPrefab("tentaclespots")
    spa.Transform:SetPosition(pt.x, pt.y, pt.z)
    spa.AnimState:SetBank("marsh_tile")
    spa.AnimState:SetBuild("marsh_tile")
    spa.AnimState:PlayAnimation("idle_cave",true)
    spa.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    spa.AnimState:SetLayer( LAYER_BACKGROUND )
    spa.AnimState:SetSortOrder( 3 )
    spa.Transform:SetScale(1.5, 1.5, 1.5)
    spa:RemoveComponent("inventoryitem")
    spa:RemoveComponent("stackable")
    spa:RemoveComponent("fuel")
    spa:RemoveComponent("burnable")
    spa:RemoveComponent("propagator")
    spa:RemoveComponent("deployable")
    if spa.components.edible then spa:RemoveComponent("edible") end
    spa:AddTag("NOCLICK")
    spa:AddTag("spa")
    spa:DoPeriodicTask(math.random(10,20), function(spa)
        local pt1 = spa:GetPosition()
        local names = {"fish","eel"}
        local name = names[math.random(#names)]
        local fish = SpawnPrefab(name)
        fish.Transform:SetPosition(pt1.x+(math.random(4)-math.random(4)), 0, pt1.z+(math.random(4)-math.random(4)))
        SpawnPrefab("splash").Transform:SetPosition(fish.Transform:GetWorldPosition())
        spa:DoTaskInTime(0.5, function(spa)
            local pos = Vector3(spa.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
            for k,v in pairs(ents) do
                if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
                   if v.prefab == "fish" or v.prefab == "eel" then
                      SpawnPrefab("splash").Transform:SetPosition(v.Transform:GetWorldPosition())
                      v:Remove()
                   end
                end
            end
        end )
    end )
    spa:DoPeriodicTask(3, function(spa)
        local pos2 = Vector3(spa.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 4.8)
        for k,v in pairs(ents) do
            if v:HasTag("player") then
               v.components.health:DoDelta(v.components.health.maxhealth*.02)
               v.components.sanity:DoDelta(v.components.sanity.max*.02)
            end
        end
    end )
    local rock1 = SpawnPrefab("tentaclespots")
    rock1.Transform:SetPosition(pt.x-3.3-0.5, 0, pt.z-3.3+0.5)
    rock1.AnimState:SetBank("rock")
    rock1.AnimState:SetBuild("rock")
    rock1.AnimState:PlayAnimation("full")
    rock1.Transform:SetScale(2, 2, 2)
    rock1:AddTag("sparock")
    rock1:RemoveComponent("inventoryitem")
    rock1:RemoveComponent("stackable")
    rock1:RemoveComponent("fuel")
    rock1:RemoveComponent("burnable")
    rock1:RemoveComponent("propagator")
    rock1:RemoveComponent("deployable")
    if rock1.components.edible then rock1:RemoveComponent("edible") end
    rock1:AddComponent("workable")
    rock1.components.workable:SetWorkAction(ACTIONS.HAMMER)
    rock1.components.workable:SetWorkLeft(3)
    rock1.components.workable:SetOnFinishCallback(function(rock1)
        SpawnPrefab("collapse_big").Transform:SetPosition(rock1.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
        local pos3 = Vector3(rock1.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos3.x,pos3.y,pos3.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("spa") then
               v:Remove()
            end
            if v:HasTag("sparock") then
               v:Remove()
            end
        end
        rock1:Remove()
    end )
    local rock2 = SpawnPrefab("tentaclespots")
    rock2.Transform:SetPosition(pt.x-2.1-2.8, 0, pt.z-2.1+2.8)
    rock2.AnimState:SetBank("firepit")
    rock2.AnimState:SetBuild("firepit")
    rock2.AnimState:PlayAnimation("idle",false)
    rock2.Transform:SetScale(0.6, 1, 0.6)
    rock2:AddTag("sparock")
    rock2:RemoveComponent("inventoryitem")
    rock2:RemoveComponent("stackable")
    rock2:RemoveComponent("fuel")
    rock2:RemoveComponent("burnable")
    rock2:RemoveComponent("propagator")
    rock2:RemoveComponent("deployable")
    if rock2.components.edible then rock2:RemoveComponent("edible") end
    rock2:AddComponent("burnable")
    rock2.components.burnable:SetFXLevel(5)
    rock2.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.6,0) )
    rock2.components.burnable:Ignite(true)
    rock2:AddComponent("cooker")
    local rock3 = SpawnPrefab("tentaclespots")
    rock3.Transform:SetPosition(pt.x+2.1+2.1, 0, pt.z-2.1+2.1)
    rock3.AnimState:SetBank("flowers")
    rock3.AnimState:SetBuild("flowers")
    rock3.AnimState:PlayAnimation("f10")
    rock3.Transform:SetScale(1.8, 1.8, 1.8)
    rock3:AddTag("sparock")
    rock3:RemoveComponent("inventoryitem")
    rock3:RemoveComponent("stackable")
    rock3:RemoveComponent("fuel")
    rock3:RemoveComponent("burnable")
    rock3:RemoveComponent("propagator")
    rock3:RemoveComponent("deployable")
    if rock3.components.edible then rock3:RemoveComponent("edible") end
end
local function OnDeploy (inst, pt)
    spa(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("spa") then
        data.spa = true
    end
    if inst:HasTag("sparock") then
        data.sparock = true
    end
end
local function onload(inst, data)
    if data and data.spa then
       spa(inst)
       inst:Remove()
    end
    if data and data.sparock then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ôƤȪ1ƤԵҼŶƤ򲻻ֳվˮȡůֵֵȪˮ棬ס̿ոţлץס㣬ȪԵĻ￾԰ɡҪȪʱôҵʯͷ




.СɽƬСɽɽ޿ɱܽ£

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\thulecite_pieces.luaļinst:AddComponent("inspectable")һвݣ

local function makeiceberg(inst)
    local pt = inst:GetPosition()
    local iceberg = SpawnPrefab("thulecite_pieces")
    iceberg.Transform:SetPosition(pt.x, pt.y, pt.z)
    iceberg.AnimState:SetBank("ice_boulder")
    iceberg.AnimState:SetBuild("ice_boulder")
    iceberg.AnimState:PlayAnimation("full")
    iceberg.Transform:SetScale(2, 2, 2)
    iceberg:AddComponent("named")
    iceberg.components.named:SetName("Ice")
    local minimap = iceberg.entity:AddMiniMapEntity()
    minimap:SetIcon( "iceboulder.png" )
    MakeObstaclePhysics(iceberg, 1)
    MakeLargeBurnable(iceberg)
    iceberg.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    iceberg.entity:AddLight()
    iceberg.Light:SetFalloff(1)
    iceberg.Light:SetIntensity(.8)
    iceberg.Light:SetRadius(7)
    iceberg.Light:SetColour(255/255,255/255,255/255)
    iceberg.Light:Enable(true)
    iceberg:RemoveComponent("edible")
    iceberg:RemoveComponent("tradable")
    iceberg:RemoveComponent("inventoryitem")
    iceberg:RemoveComponent("stackable")
    iceberg:RemoveComponent("bait")
    iceberg:RemoveComponent("repairer")
    iceberg:RemoveComponent("deployable")
    iceberg:RemoveTag("molebait")
    iceberg:AddComponent("heater")
    iceberg.components.heater.iscooler = true
    iceberg.components.heater.heatfn = function(iceberg) return -40 end
    iceberg:AddComponent("workable")
    iceberg.components.workable:SetWorkAction(ACTIONS.MINE)
    iceberg.components.workable:SetWorkLeft(30)
    iceberg.components.workable:SetOnWorkCallback(function(iceberg)
        iceberg.components.workable:SetWorkLeft(30)
        local pt1 = iceberg:GetPosition()
        if math.random()<.2 then
           local icecream = SpawnPrefab("thulecite_pieces")
           icecream.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 3, pt1.z+(math.random(3)-math.random(3)))
           icecream.AnimState:SetBank("ice")
           icecream.AnimState:SetBuild("ice")
           icecream.AnimState:PlayAnimation("f1")
           icecream:RemoveComponent("edible")
           icecream:RemoveComponent("tradable")
           icecream:RemoveComponent("stackable")
           icecream:RemoveComponent("bait")
           icecream:RemoveComponent("repairer")
           icecream:RemoveComponent("deployable")
           icecream:RemoveTag("molebait")
           icecream:AddComponent("named")
           icecream.components.named:SetName("Ice")
           icecream.components.inventoryitem.imagename = "ice"
           icecream:AddComponent("edible")
           icecream.components.edible.foodtype = "SEEDS"
           icecream.components.edible.healthvalue = TUNING.HEALING_TINY/2
           icecream.components.edible.hungervalue = TUNING.CALORIES_TINY/4
           icecream.components.edible:SetOnEatenFn(function(icecream, eater)
               if eater and eater.components.temperature then
                  local temp = eater.components.temperature:GetCurrent()
                  eater.components.temperature:SetTemperature(temp - 70)
               end
           end )
           icecream.components.edible.degrades_with_spoilage = false
           icecream:AddTag("icecream")
        elseif math.random()<.4 then
           local ice = SpawnPrefab("ice")
           ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 3, pt1.z+(math.random(3)-math.random(3)))
        end
    end )
    iceberg.components.workable:SetOnFinishCallback(function(iceberg)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(iceberg.Transform:GetWorldPosition())
        iceberg:Remove()
    end )
    iceberg:AddTag("iceberg")
end
local function OnDeploy (inst, pt)
    makeiceberg(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("iceberg") then
        data.iceberg = true
    end
    if inst:HasTag("icecream") then
        data.icecream = true
    end
end
local function onload(inst, data)
    if data and data.iceberg then
       makeiceberg(inst)
       inst:Remove()
    end
    if data and data.icecream then
       inst.AnimState:SetBank("ice")
       inst.AnimState:SetBuild("ice")
       inst.AnimState:PlayAnimation("f1")
       inst:RemoveComponent("edible")
       inst:RemoveComponent("tradable")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("bait")
       inst:RemoveComponent("repairer")
       inst:RemoveComponent("deployable")
       inst:RemoveTag("molebait")
       inst:AddComponent("named")
       inst.components.named:SetName("Ice")
       inst.components.inventoryitem.imagename = "ice"
       inst:AddComponent("edible")
       inst.components.edible.foodtype = "SEEDS"
       inst.components.edible.healthvalue = TUNING.HEALING_TINY/2
       inst.components.edible.hungervalue = TUNING.CALORIES_TINY/4
       inst.components.edible:SetOnEatenFn(function(inst, eater)
           if eater and eater.components.temperature then
              local temp = eater.components.temperature:GetCurrent()
              eater.components.temperature:SetTemperature(temp - 70)
           end
       end )
       inst.components.edible.degrades_with_spoilage = false
       inst:AddTag("icecream")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ƬСɽ1ƬԵҼŶ򲻻ֳɽóͷɽһʻñḯҲɶѵʳãܽ£ûͲҪԣᶳˡҪСɽˣյɡҪ롰ƬֺͰһͬ޸




.¡ҹħֿ¡Я¡

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\armor_sanity.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "silk" or item.prefab == "houndstooth" or item.prefab == "beefalowool" or item.prefab == "tentaclespots" or item.prefab == "froglegs" or item.prefab == "stinger" or item.prefab == "mosquitosack" or item.prefab == "tallbirdegg" or item.prefab == "walrus_tusk" or item.prefab == "livinglog" or item.prefab == "bird_egg" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "deerclops_eyeball" or item.prefab == "fish" or item.prefab == "plantmeat" or item.prefab == "rocks" or item.prefab == "cave_banana" or item.prefab == "slurper_pelt" or item.prefab == "minotaurhorn" or item.prefab == "wormlight" or item.prefab == "slurtle_shellpieces" or item.prefab == "slurtleslime" or item.prefab == "batwing" or item.prefab == "manrabbit_tail" or item.prefab == "pigskin" or item.prefab == "lightninggoathorn" or item.prefab == "dragon_scales" or item.prefab == "goose_feather" or item.prefab == "bearger_fur" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,-75,0)}
local widgetbuttoninfo = {
    text = "GO",
    position = Vector3(0, -135, 0),
    fn = function(inst)
        if inst:HasTag("machines") then
           if not inst.components.container:IsEmpty() then
              for k,v in pairs(inst.components.container.slots) do
                  if v and v.prefab == "silk" then inst.weirdo = "spiderqueen" end
                  if v and v.prefab == "houndstooth" then inst.weirdo = "firehound" end
                  if v and v.prefab == "beefalowool" then inst.weirdo = "beefalo" end
                  if v and v.prefab == "tentaclespots" then inst.weirdo = "tentacle" end
                  if v and v.prefab == "froglegs" then inst.weirdo = "frog" end
                  if v and v.prefab == "stinger" then inst.weirdo = "killerbee" end
                  if v and v.prefab == "mosquitosack" then inst.weirdo = "mosquito" end
                  if v and v.prefab == "tallbirdegg" then inst.weirdo = "tallbird" end
                  if v and v.prefab == "walrus_tusk" then inst.weirdo = "walrus" end
                  if v and v.prefab == "livinglog" then inst.weirdo = "leif_sparse" end
                  if v and v.prefab == "bird_egg" then inst.weirdo = "perd" end
                  if v and v.prefab == "trunk_summer" then inst.weirdo = "koalefant_summer" end
                  if v and v.prefab == "trunk_winter" then inst.weirdo = "koalefant_winter" end
                  if v and v.prefab == "deerclops_eyeball" then inst.weirdo = "deerclops" end
                  if v and v.prefab == "fish" then inst.weirdo = "merm" end
                  if v and v.prefab == "plantmeat" then inst.weirdo = "lureplant" end
                  if v and v.prefab == "rocks" then inst.weirdo = "rocky" end
                  if v and v.prefab == "cave_banana" then inst.weirdo = "monkey" end
                  if v and v.prefab == "slurper_pelt" then inst.weirdo = "slurper" end
                  if v and v.prefab == "minotaurhorn" then inst.weirdo = "minotaur" end
                  if v and v.prefab == "wormlight" then inst.weirdo = "worm" end
                  if v and v.prefab == "slurtle_shellpieces" then inst.weirdo = "slurtle" end
                  if v and v.prefab == "slurtleslime" then inst.weirdo = "snurtle" end
                  if v and v.prefab == "batwing" then inst.weirdo = "bat" end
                  if v and v.prefab == "manrabbit_tail" then inst.weirdo = "bunnyman" end
                  if v and v.prefab == "pigskin" then inst.weirdo = "pigman" end
                  if v and v.prefab == "lightninggoathorn" then inst.weirdo = "lightninggoat" end
                  if v and v.prefab == "dragon_scales" then inst.weirdo = "dragonfly" end
                  if v and v.prefab == "goose_feather" then inst.weirdo = "moose" end
                  if v and v.prefab == "bearger_fur" then inst.weirdo = "bearger" end
                  v:Remove()
              end
              local pt0 = Vector3(GetPlayer().Transform:GetWorldPosition())
              for k = 1, 20 do
                  local result_offset = FindValidPositionByFan(1 * 2 * PI, 10, 20, function(offset)
                      local x,y,z = (pt0 + offset):Get()
                      local ents = TheSim:FindEntities(x,y,z , 1)
                      return not next(ents) 
                  end)
                  if result_offset then
                     local newweirdo = SpawnPrefab(inst.weirdo)
                     newweirdo.Transform:SetPosition((pt0 + result_offset):Get())
                     GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                     local fx = SpawnPrefab("collapse_small")
                     local pos = pt0 + result_offset
                     fx.Transform:SetPosition(pos.x, pos.y, pos.z)
                  end
              end
           end
        end
    end }
local function OnDeploy (inst, pt)
    local machine = SpawnPrefab("armor_sanity")
    machine.Transform:SetPosition(pt.x, pt.y, pt.z)
    machine.AnimState:SetBank("rain_meter")
    machine.AnimState:SetBuild("rain_meter")
    machine.AnimState:PlayAnimation("meter", 0)
    machine.Transform:SetScale(0.5, 0.5, 0.5)
    machine:RemoveTag("sanity")
    machine:RemoveComponent("inventoryitem")
    machine:RemoveComponent("armor")
    machine:RemoveComponent("equippable")
    machine:RemoveComponent("deployable")
    machine.components.container.canbeopened = true
    machine:AddComponent("inventoryitem")
    machine.components.inventoryitem:ChangeImageName("rainometer")
    machine:AddComponent("equippable")
    machine.components.equippable.equipslot = EQUIPSLOTS.BODY
    machine.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2
    machine.components.equippable:SetOnEquip( function(machine)
        GetPlayer().components.inventory:SetOverflow(machine)
        machine.components.container:Open(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open")
        GetPlayer():Hide()
        local shadow = GetPlayer().entity:AddDynamicShadow()
        shadow:SetSize( 0, 0 )
    end )
    machine.components.equippable:SetOnUnequip( function(machine)
        machine.components.container:Close(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open")
        GetPlayer():Show()
        local shadow = GetPlayer().entity:AddDynamicShadow()
        shadow:SetSize( 1.3, .6 )
    end )
    machine:AddTag("machines")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("machines") then
       data.machines = true
    end
end
local function onload(inst, data)
  if data and data.machines then
    inst.AnimState:SetBank("rain_meter")
    inst.AnimState:SetBuild("rain_meter")
    inst.AnimState:PlayAnimation("meter", 0)
    inst.Transform:SetScale(0.5, 0.5, 0.5)
    inst:RemoveTag("sanity")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("armor")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:ChangeImageName("rainometer")
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2
    inst.components.equippable:SetOnEquip( function(inst)
        GetPlayer().components.inventory:SetOverflow(inst)
        inst.components.container:Open(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open")
        GetPlayer():Hide()
        local shadow = GetPlayer().entity:AddDynamicShadow()
        shadow:SetSize( 0, 0 )
    end )
    inst.components.equippable:SetOnUnequip( function(inst)
        inst.components.container:Close(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open")
        GetPlayer():Show()
        local shadow = GetPlayer().entity:AddDynamicShadow()
        shadow:SetSize( 1.3, .6 )
    end )
    inst:AddTag("machines")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-80,150,0)
    inst.components.container.side_widget = true
    inst.components.container.itemtestfn = itemtest
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.acceptsstacks = false
    inst.components.container.canbeopened = false

    ҹħֿ¡װ¡ΧĻҲָӺͰťڸз1ƷGOťͿԿ¡20Ϊ֩˿¡֩ŮȮ¡𹷡ţë¡ţƤ¡֡ȿ¡ܡ̿¡ɱ˷䡢Ѫҿ¡ӡ񵰿¡񡢺¡󡢻ľͷ¡¡𼦡ǿ¡󡢶ǿ¡󡢾¹¡¹¡ˡʳ˻¡ʳ˻ʯ¡Ϻ㽶¡ӡ׺ʳƤ¡׺ʳߡԶػ߽ǿ¡Զػߡӹ¡ӡţƬ¡ţꡢţճҺ¡桢¡βͿ¡ˡƤ¡ˡǿ¡Ƭ¡ѡƤ¡ܡ¹Ѽë¡¹Ѽжؿ¡ӵп¡޵ĹˢҲԹƹ֣ţȺ촥֣֩Ⱥͷɱ˷ȣһɡҹħħѡźã5جȼϡ3ֽ




.ǿ֢ߣInsertڵϻ꣬㽨졢ֲٰInsertʧ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_INSERT, function()
    if not inst:HasTag("ruler") then
       inst:AddTag("ruler")
       local pt = inst:GetPosition()
       for y = 10, 0, -1 do
           for x = 0, 10 do
               local coordinate = SpawnPrefab("gridplacer")
               coordinate.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
               coordinate.AnimState:SetLayer( LAYER_BACKGROUND )
               coordinate.AnimState:SetSortOrder( 1 )
               coordinate.Transform:SetRotation( 45 )
               coordinate.Transform:SetPosition(pt.x-14.1+x*2.82, 0, pt.z-14.1+y*2.82)
               local light = coordinate.entity:AddLight()
               light:SetIntensity(.6)
               light:SetRadius(.5)
               light:SetFalloff(.6)
               light:Enable(true)
               light:SetColour(180/255, 195/255, 225/255)
               coordinate:AddTag("NOCLICK")
               coordinate:AddTag("coordinate")
           end
       end
    else
       inst:RemoveTag("ruler")
       local pos = Vector3(inst.Transform:GetWorldPosition())
       local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
       for k,v in pairs(ents) do
           if v:HasTag("coordinate") then
              v:Remove()
           end
       end
    end
end )

    ɰInsertΪڵϻɫ꣬ΪֲĲߣҲɲеĽֲǲˣǿ֢رҹЧŶٰһInsertʧ




.ƱòɡƱʱԶƱɼӹɴñ棬ɱ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\umbrella.luaļinst:AddTag("show_spoilage")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "ice" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,-75,0)}
local widgetbuttoninfo = {
    text = "Make",
    position = Vector3(0, -135, 0),
    fn = function(inst)
        if inst:HasTag("icemaker") then
           if inst.components.container:Has("ice", 10) then
              GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
              inst.components.container:ConsumeByName("ice", 10)
              local pt = inst:GetPosition()
              local bigice = SpawnPrefab("grass_umbrella")
              bigice.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3)))
              bigice.AnimState:SetBank("icehat")
              bigice.AnimState:SetBuild("hat_ice")
              bigice.AnimState:PlayAnimation("anim")
              bigice.Transform:SetScale(1.5, 1.5, 1.5)
              bigice:RemoveComponent("waterproofer")
              bigice:RemoveComponent("equippable")
              bigice:RemoveComponent("insulator")
              bigice:RemoveComponent("perishable")
              bigice:RemoveComponent("fuel")
              bigice:RemoveComponent("burnable")
              bigice:RemoveComponent("propagator")
              bigice:RemoveComponent("deployable")
              bigice:RemoveComponent("container")
              bigice:RemoveTag("nopunch")
              bigice:RemoveTag("show_spoilage")
              bigice:RemoveAllEventCallbacks()
              bigice:AddComponent("named")
              bigice.components.named:SetName("Big ice")
              bigice.components.inventoryitem:ChangeImageName("icehat")
              bigice:AddComponent("heater")
              bigice.components.heater.iscooler = true
              bigice.components.heater.heatfn = function(bigice) return -40 end
              bigice:AddComponent("workable")
              bigice.components.workable:SetWorkAction(ACTIONS.HAMMER)
              bigice.components.workable:SetWorkLeft(1)
              bigice.components.workable:SetOnFinishCallback(function(bigice)
                  SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(bigice.Transform:GetWorldPosition())
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                  for k = 1, 10 do
                      local pt1 = bigice:GetPosition()
                      local ice = SpawnPrefab("ice")
                      ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
                  end
                  bigice:Remove()
              end )
              bigice:AddTag("bigice")
           end
        end
    end }
local function OnDeploy (inst, pt)
    local icemaker = SpawnPrefab("grass_umbrella")
    icemaker.Transform:SetPosition(pt.x, pt.y, pt.z)
    icemaker.AnimState:SetBank("eyeball_turret_base")
    icemaker.AnimState:SetBuild("eyeball_turret_base")
    icemaker.AnimState:PlayAnimation("idle_loop")
    icemaker.Transform:SetScale(0.8, 0.8, 0.8)
    icemaker.AnimState:SetMultColour(0/255,255/255,0/255,1)
    icemaker:RemoveComponent("waterproofer")
    icemaker:RemoveComponent("inventoryitem")
    icemaker:RemoveComponent("equippable")
    icemaker:RemoveComponent("insulator")
    icemaker:RemoveComponent("perishable")
    icemaker:RemoveComponent("fuel")
    icemaker:RemoveComponent("burnable")
    icemaker:RemoveComponent("propagator")
    icemaker:RemoveComponent("deployable")
    icemaker:RemoveTag("nopunch")
    icemaker:RemoveTag("show_spoilage")
    icemaker:RemoveAllEventCallbacks()
    icemaker:AddComponent("named")
    icemaker.components.named:SetName("Ice maker")
    icemaker.components.container.canbeopened = true
    icemaker:AddComponent("workable")
    icemaker.components.workable:SetWorkAction(ACTIONS.HAMMER)
    icemaker.components.workable:SetWorkLeft(3)
    icemaker.components.workable:SetOnFinishCallback(function(icemaker)
        SpawnPrefab("collapse_big").Transform:SetPosition(icemaker.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        icemaker:Remove()
    end )
    icemaker:ListenForEvent("rainstart", function()
        icemaker.task = icemaker:DoPeriodicTask(10, function()
            local ice = SpawnPrefab("ice")
            icemaker.components.container:GiveItem(ice)
        end )
    end, GetWorld())
    icemaker:ListenForEvent("rainstop", function()
        if icemaker.task then icemaker.task:Cancel() icemaker.task = nil end
    end, GetWorld())
    icemaker:AddTag("icemaker")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,150,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.canbeopened = false
    inst.components.container.onopenfn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst.components.container.onclosefn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst:AddTag("fridge")
local function onsave(inst, data)
    if inst:HasTag("icemaker") then
        data.icemaker = true
    end
    if inst:HasTag("bigice") then
        data.bigice = true
    end
end
local function onload(inst, data)
  if data and data.icemaker then
    inst.AnimState:SetBank("eyeball_turret_base")
    inst.AnimState:SetBuild("eyeball_turret_base")
    inst.AnimState:PlayAnimation("idle_loop")
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.AnimState:SetMultColour(0/255,255/255,0/255,1)
    inst:RemoveComponent("waterproofer")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("insulator")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("nopunch")
    inst:RemoveTag("show_spoilage")
    inst:RemoveAllEventCallbacks()
    inst:AddComponent("named")
    inst.components.named:SetName("Ice maker")
    inst.components.container.canbeopened = true
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:ListenForEvent("rainstart", function()
        inst.task = inst:DoPeriodicTask(10, function()
            local ice = SpawnPrefab("ice")
            inst.components.container:GiveItem(ice)
        end )
    end, GetWorld())
    inst:ListenForEvent("rainstop", function()
        if inst.task then inst.task:Cancel() inst.task = nil end
    end, GetWorld())
    inst:AddTag("icemaker")
  end
  if data and data.bigice then
    inst.AnimState:SetBank("icehat")
    inst.AnimState:SetBuild("hat_ice")
    inst.AnimState:PlayAnimation("anim")
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    inst:RemoveComponent("waterproofer")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("insulator")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    inst:RemoveTag("nopunch")
    inst:RemoveTag("show_spoilage")
    inst:RemoveAllEventCallbacks()
    inst:AddComponent("named")
    inst.components.named:SetName("Big ice")
    inst.components.inventoryitem:ChangeImageName("icehat")
    inst:AddComponent("heater")
    inst.components.heater.iscooler = true
    inst.components.heater.heatfn = function(inst) return -40 end
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(1)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        for k = 1, 10 do
            local pt1 = inst:GetPosition()
            local ice = SpawnPrefab("ice")
            ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3)))
        end
        inst:Remove()
    end )
    inst:AddTag("bigice")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    òɡƱʱÿ10ƳһƱɴ򿪸ӣڸȡ10ʱġMakeťɽӹɴ飬ñ档ɽ£ôҴ飬ɻԭСҪƱˣôըټɡɡѡף£4֦3ݡ6




.̱䣨̦޺̱䣬ƽÿ峿ֽ5ƿţֽ̣ɲԣ

    ü±ϷĿ¼\data\scripts\prefabs\cutlichen.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "goldnugget" or item.prefab == "goatmilk" or item.prefab == "cutlichen" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)}
local widgetbuttoninfo = {
    text = "Buy",
    position = Vector3(0, 95, 0),
    fn = function(inst)
        if inst:HasTag("milkcartons") and inst.components.container:Has("goldnugget", 1) then
           inst.components.container:ConsumeByName("goldnugget", 1)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
           local newspaper = SpawnPrefab("cutlichen")
           newspaper.AnimState:SetBank("blueprint")
           newspaper.AnimState:SetBuild("blueprint")
           newspaper.AnimState:PlayAnimation("idle")
           newspaper.components.inventoryitem:ChangeImageName("blueprint")
           newspaper.Transform:SetScale(1.2, 1.2, 1.2)
           newspaper:AddComponent("named")
           newspaper.components.named:SetName("Newspaper")
           newspaper:RemoveComponent("stackable")
           newspaper:RemoveComponent("edible")
           newspaper:RemoveComponent("perishable")
           newspaper:RemoveComponent("container")
           newspaper:RemoveComponent("deployable")
           newspaper.components.inspectable.getstatus = function(newspaper)
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing")
               GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
               newspaper:Remove()
           end
           newspaper:AddTag("newspapers")
           GetPlayer().components.inventory:GiveItem(newspaper)
        end
    end }
local function OnDeploy (inst, pt)
    local milkcarton = SpawnPrefab("cutlichen")
    milkcarton.Transform:SetPosition(pt.x, pt.y, pt.z)
    milkcarton.AnimState:SetBank("icebox")
    milkcarton.AnimState:SetBuild("ice_box")
    milkcarton.AnimState:PlayAnimation("closed")
    milkcarton.Transform:SetScale(0.6, 0.6, 0.6)
    milkcarton.AnimState:SetMultColour(0/255,185/255,255/255,1)
    milkcarton:AddComponent("named")
    milkcarton.components.named:SetName("Milk carton")
    milkcarton:RemoveComponent("stackable")
    milkcarton:RemoveComponent("inventoryitem")
    milkcarton:RemoveComponent("edible")
    milkcarton:RemoveComponent("perishable")
    milkcarton:RemoveComponent("deployable")
    milkcarton.components.container.canbeopened = true
    milkcarton:AddComponent("workable")
    milkcarton.components.workable:SetWorkAction(ACTIONS.HAMMER)
    milkcarton.components.workable:SetWorkLeft(3)
    milkcarton.components.workable:SetOnFinishCallback(function(milkcarton)
        SpawnPrefab("collapse_big").Transform:SetPosition(milkcarton.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        milkcarton:Remove()
    end )
    milkcarton:ListenForEvent( "daytime", function()
        if milkcarton.components.container:Has("goldnugget", 5) then
           milkcarton.components.container:ConsumeByName("goldnugget", 5)
           for k = 1, 5 do
               local goatmilk = SpawnPrefab("goatmilk")
               milkcarton.components.container:GiveItem(goatmilk)
           end
           local newspaper = SpawnPrefab("cutlichen")
           newspaper.AnimState:SetBank("blueprint")
           newspaper.AnimState:SetBuild("blueprint")
           newspaper.AnimState:PlayAnimation("idle")
           newspaper.components.inventoryitem:ChangeImageName("blueprint")
           newspaper.Transform:SetScale(1.2, 1.2, 1.2)
           newspaper:AddComponent("named")
           newspaper.components.named:SetName("Newspaper")
           newspaper:RemoveComponent("stackable")
           newspaper:RemoveComponent("edible")
           newspaper:RemoveComponent("perishable")
           newspaper:RemoveComponent("container")
           newspaper:RemoveComponent("deployable")
           newspaper.components.inspectable.getstatus = function(newspaper)
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing")
               GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
               newspaper:Remove()
           end
           newspaper:AddTag("newspapers")
           milkcarton.components.container:GiveItem(newspaper)
        end
    end, GetWorld())
    milkcarton:AddTag("milkcartons")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst.components.deployable.min_spacing = 1
    inst:AddComponent("container")
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,150,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.onopenfn = function(inst) inst.AnimState:PlayAnimation("open") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst.components.container.onclosefn = function(inst) inst.AnimState:PlayAnimation("close") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst.components.container.itemtestfn = itemtest
    inst:AddTag("fridge")
local function onsave(inst, data)
    if inst:HasTag("milkcartons") then
        data.milkcartons = true
    end
    if inst:HasTag("newspapers") then
        data.newspapers = true
    end
end
local function onload(inst, data)
  if data and data.milkcartons then
    inst.AnimState:SetBank("icebox")
    inst.AnimState:SetBuild("ice_box")
    inst.AnimState:PlayAnimation("closed")
    inst.Transform:SetScale(0.6, 0.6, 0.6)
    inst.AnimState:SetMultColour(0/255,185/255,255/255,1)
    inst:AddComponent("named")
    inst.components.named:SetName("Milk carton")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:ListenForEvent( "daytime", function()
        if inst.components.container:Has("goldnugget", 5) then
           inst.components.container:ConsumeByName("goldnugget", 5)
           for k = 1, 5 do
               local goatmilk = SpawnPrefab("goatmilk")
               inst.components.container:GiveItem(goatmilk)
           end
           local newspaper = SpawnPrefab("cutlichen")
           newspaper.AnimState:SetBank("blueprint")
           newspaper.AnimState:SetBuild("blueprint")
           newspaper.AnimState:PlayAnimation("idle")
           newspaper.components.inventoryitem:ChangeImageName("blueprint")
           newspaper.Transform:SetScale(1.2, 1.2, 1.2)
           newspaper:AddComponent("named")
           newspaper.components.named:SetName("Newspaper")
           newspaper:RemoveComponent("stackable")
           newspaper:RemoveComponent("edible")
           newspaper:RemoveComponent("perishable")
           newspaper:RemoveComponent("container")
           newspaper:RemoveComponent("deployable")
           newspaper.components.inspectable.getstatus = function(newspaper)
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing")
               GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
               newspaper:Remove()
           end
           newspaper:AddTag("newspapers")
           inst.components.container:GiveItem(newspaper)
        end
    end, GetWorld())
    inst:AddTag("milkcartons")
  end
  if data and data.newspapers then
    inst.AnimState:SetBank("blueprint")
    inst.AnimState:SetBuild("blueprint")
    inst.AnimState:PlayAnimation("idle")
    inst.components.inventoryitem:ChangeImageName("blueprint")
    inst.Transform:SetScale(1.2, 1.2, 1.2)
    inst:AddComponent("named")
    inst.components.named:SetName("Newspaper")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("container")
    inst:RemoveComponent("deployable")
    inst.components.inspectable.getstatus = function(inst)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing")
        GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
        inst:Remove()
    end
    inst:AddTag("newspapers")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ̦޺̱䣬̱ɴ򿪸ӣڸзƽ𣨶Ԥ5ƽ𣩣ڶ峿5ƿţ̣һݱֽͬʱ۳5ƽ𡣽ֽƷҼɶֵлƽ𣬵ϷġBuyťԶ⹺ֽÿ1ƽÿඩţ̺ͱֽͶּ̱ɡҪ̱ˣôһټɡ̦޺ڶѨвɵҪ롰̦޺̦޺̦޺ֲһͬ޸




һ.·ƣɫ·ƣҹԶϨ𣬿ֶء׻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.AnimState:PlayAnimation("blueamulet")һвݣ

local function makestreetlight(inst)
    local pt = inst:GetPosition()
    local streetlight = SpawnPrefab("blueamulet")
    streetlight.Transform:SetPosition(pt.x, pt.y, pt.z)
    streetlight.AnimState:SetBank("nightstick")
    streetlight.AnimState:SetBuild("nightstick")
    streetlight.AnimState:PlayAnimation("idle")
    streetlight.Transform:SetScale(1.5, 1.5, 1.5)
    streetlight.AnimState:SetMultColour(255/255,255/255,0/255,1)
    MakeObstaclePhysics(streetlight, .5 )
    streetlight:RemoveComponent("equippable")
    streetlight:RemoveComponent("inventoryitem")
    streetlight:RemoveComponent("heater")
    streetlight:RemoveComponent("fueled")
    streetlight:RemoveComponent("deployable")
    streetlight:AddComponent("named")
    streetlight.components.named:SetName("Street Light")
    streetlight:AddComponent("workable")
    streetlight.components.workable:SetWorkAction(ACTIONS.HAMMER)
    streetlight.components.workable:SetWorkLeft(3)
    streetlight.components.workable:SetOnFinishCallback(function(streetlight, worker)
        SpawnPrefab("collapse_big").Transform:SetPosition(streetlight.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos = Vector3(streetlight.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)
        for k,v in pairs(ents) do
            if v:HasTag("bulbs") then
               v:Remove()
            end
        end
        streetlight:Remove()
    end )
    streetlight:AddTag("streetlights")
    local bulb = SpawnPrefab("blueamulet")
    bulb.AnimState:SetBank("bulb")
    bulb.AnimState:SetBuild("bulb")
    bulb.AnimState:PlayAnimation("idle")
    bulb.Transform:SetScale(1.6, 1.6, 1.6)
    bulb.Physics:SetActive(false)
    bulb:RemoveComponent("equippable")
    bulb:RemoveComponent("inventoryitem")
    bulb:RemoveComponent("heater")
    bulb:RemoveComponent("fueled")
    bulb:RemoveComponent("deployable")
    bulb.persists = false
    bulb:AddComponent("named")
    bulb.components.named:SetName("Street Light")
    bulb.entity:AddSoundEmitter()
    local light = bulb.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(255/255,255/255,255/255)
    light:Enable(false)  
    local follower = bulb.entity:AddFollower()
    follower:FollowSymbol( streetlight.GUID, "swap_object", 15, -160, 0.1 )
    bulb:AddComponent("machine")
    bulb.components.machine.turnonfn = function()
        bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_on")
        bulb.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        bulb.Light:Enable(true)
    end
    bulb.components.machine.turnofffn = function()
        bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_off")
        bulb.AnimState:SetBloomEffectHandle( "" )
        bulb.Light:Enable(false)
    end
    bulb:ListenForEvent( "daytime", function() bulb.components.machine:TurnOff() end , GetWorld() )
    bulb:ListenForEvent( "dusktime", function() bulb.components.machine:TurnOn() end , GetWorld() )
    bulb:AddTag("lightningrod")
    bulb:AddTag("bulbs")
    if not GetClock():IsDay() then
       bulb.components.machine:TurnOn()
    else
       bulb.components.machine:TurnOff()
    end
end
local function OnDeploy (inst, pt)
    makestreetlight(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("streetlights") then
       data.streetlights = true
    end
end
local function onload(inst, data)
    if data and data.streetlights then
       makestreetlight(inst)
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɫ·ƣҹԶԶϨҼݣֶء·ƿ̫ܺԴֶܣɷ׻Ҫ·ˣôҵɡɫħѡźã£3ƽ1ʯ




.ʯҼװıʯǴ͵һ鱣ʯ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\heatrock.luaļinst:AddComponent("inspectable")һвݣ

local function canteleport(inst, caster)
    return true
end
local function teleport(inst)
    local caster = inst.components.inventoryitem.owner
    local range = 3000
    local pos = Vector3(caster.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v.prefab == "heatrock" and not v.components.inventoryitem:IsHeld() then
            caster.Transform:SetPosition(v.Transform:GetWorldPosition())
        end
    end
    return true
end
    inst:AddComponent("spellcaster")
    inst.components.spellcaster:SetSpellFn(teleport)
    inst.components.spellcaster:SetSpellTestFn(canteleport)
    inst.components.spellcaster.canusefrominventory = false
    inst.components.spellcaster.canuseonpoint = true
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS

    2鱣ʯ1Ҫĵص㣨ҡѨڴȣ1ϣߵͼδֻҪװʯԿյذҼϴͻڵϵıʯ3鱣ʯ2ڲͬص㣬2佫γɳ涴ЧװʯԿյذҼ2ش




.裨װë10룩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\feathers.luaļinst:AddComponent("inspectable")һвݣ

local function onequip(inst, owner)
    inst.fire = SpawnPrefab( "feather_"..name )
    inst.fire.Physics:SetActive(false)
    local follower = inst.fire.entity:AddFollower()
    follower:FollowSymbol( inst.GUID, "swap_object", 0, 60, 0 )
    local pt = owner:GetPosition()
    owner.Transform:SetPosition(pt.x, pt.y+30, pt.z)
    inst:DoTaskInTime(10, function() 
    local pt = owner:GetPosition()
    owner.Transform:SetPosition(pt.x, pt.y-30, pt.z)
    inst:Remove()
    end)
end
local function onunequip(inst, owner)
    local pt = owner:GetPosition()
    owner.Transform:SetPosition(pt.x, pt.y-30, pt.z)
    inst.fire:Remove()
    inst.fire = nil
end
    inst:AddComponent("equippable")
    inst.components.equippable:SetOnEquip( onequip )
    inst.components.equippable:SetOnUnequip( onunequip )
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
    inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*5

    װë10룬ἢδйоѨҲɷС10ëľɾҪಶŶעʱҪɫʹ




.峵½Ͻͨߣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\umbrella.luaļ

    1.ݣ

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
    UpdateSound(inst)
    
    owner.DynamicShadow:SetSize(2.2, 1.4)

    inst.components.fueled:StartConsuming()
end

local function onunequip(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
    UpdateSound(inst)

    owner.DynamicShadow:SetSize(1.3, 0.6)

    inst.components.fueled:StopConsuming()
end

    滻Ϊ

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
    UpdateSound(inst)
    inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,0,0) end)
    inst.fire = SpawnPrefab( "telebase" )
    inst.fire.Physics:SetActive(false)
    local follower = inst.fire.entity:AddFollower()
    follower:FollowSymbol( owner.GUID, "swap_object", -90, 130, 0 )
end
local function onunequip(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
    UpdateSound(inst)
    if inst.task then inst.task:Cancel() inst.task = nil end
    inst.fire:Remove()
    inst.fire = nil
end


    2.inst.components.fueled:SetDepletedFn(onperish)һвinst:AddComponent("blinkstaff")

    װɡʱ²ŻԶʻɡķ緫жɡͣ¡ؿԿƷҲüWSADƷ򣩣Ҽؿ˲ƣϰпնȥɡɡѡף£6֦1Ƥ2˿




.ñëñɷ裩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hats.luaļݣ

    local function feather_equip(inst, owner)
        onequip(inst, owner)
        local ground = GetWorld()
        if ground and ground.components.birdspawner then
            ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY_FEATHERHAT)
            ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX_FEATHERHAT)
        end
    end
    local function feather_unequip(inst, owner)
        onunequip(inst, owner)
        local ground = GetWorld()
        if ground and ground.components.birdspawner then
            ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY)
            ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX)
        end
    end
    local function feather()
        local inst = simple()
        
		inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL
        
        inst.components.equippable:SetOnEquip( feather_equip )
        inst.components.equippable:SetOnUnequip( feather_unequip )
        
        inst:AddComponent("fueled")
        inst.components.fueled.fueltype = "USAGE"
        inst.components.fueled:InitializeFuelLevel(TUNING.FEATHERHAT_PERISHTIME)
        inst.components.fueled:SetDepletedFn(generic_perish)

    滻Ϊ

local function feather_equip(inst, owner)
    onequip(inst, owner)
    local shadow = GetPlayer().entity:AddDynamicShadow()
    shadow:SetSize( 0, 0 )
    inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,10,0) end )
    inst:DoTaskInTime(3, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end
        inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,1,0) end)
    end )
end
local function feather_unequip(inst, owner)
    if inst.task then inst.task:Cancel() inst.task = nil end
    inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,-10,0) end)
    inst:DoTaskInTime(3, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end
        onunequip(inst, owner)
        local shadow = GetPlayer().entity:AddDynamicShadow()
        shadow:SetSize( 1.3, .6 )
    end)
end
local function feather()
    local inst = simple()
    inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL
    inst.components.equippable:SetOnEquip( feather_equip )
    inst.components.equippable:SetOnUnequip( feather_unequip )

    ڴëñʱʼɣ3ƽɣüWSADƷ뽵ʱжëñɿʼ½غỬһΣWSADԼٻо룩עⲻҪ׶жëñƽʱжؼɣڹ½ܳһξ




.涴涴԰ᵽص㣬磩

    ü±ϷĿ¼\data\scripts\prefabs\wormhole.luaļ

    1.doer.components.sanity:DoDelta(-TUNING.SANITY_MED)滻Ϊdoer.components.sanity:DoDelta(TUNING.SANITY_MED)


    2.inst:AddComponent("inspectable")һвݣ

local function turnon(inst)
    inst.components.machine.ison = true
    inst.components.inventoryitem.canbepickedup = true
end
local function turnoff(inst)
    inst.components.machine.ison = false
    inst.components.inventoryitem.canbepickedup = false
end
    inst:AddComponent("equippable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:ChangeImageName("abigail_flower")
    inst.components.inventoryitem.canbepickedup = false
    inst:AddComponent("machine")
    inst.components.machine.turnonfn = turnon
    inst.components.machine.turnofffn = turnoff

    ɶԳ涴ҼڵϣٵͿԽƷʾΪһ仨ͼƬҪõĵص󣬽涴óڵϣҼٴڵϡڼſڰһų涴Ӧĳ涴ȥĵطԼĳ涴ɡ涴ήԣᲹԣе




.֩PageUPٻ֩PageDownȡ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("inventory")һвݣ

TheInput:AddKeyUpHandler(KEY_PAGEUP, function()
    if inst.task then inst.task:Cancel() inst.task = nil end
    if inst.task2 then inst.task2:Cancel() inst.task2 = nil end
    if inst.doll then inst.doll:Remove() inst.doll = nil end
    inst.components.locomotor:Stop()
    inst.components.playercontroller:Enable(false)
    SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
    inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/scream_short")
    inst:DoTaskInTime(0.1, function() 
        inst.AnimState:SetBank("spider_queen")
        inst.AnimState:SetBuild("spider_queen_build")
        inst.AnimState:PlayAnimation("idle", true)
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        inst:SetStateGraph("SGspiderqueen")
        shadow:SetSize( 7, 3 )
        inst.components.locomotor.walkspeed = 15
        inst.components.locomotor.runspeed = 20
        inst.components.health:SetInvincible(true)
        inst.components.hunger:Pause()
        inst.components.combat:SetDefaultDamage(300)
        inst.components.temperature:SetTemp(20)
        inst.components.playercontroller:Enable(true)
        local pt = GetPlayer():GetPosition()
        inst.doll = SpawnPrefab( "beardhair" )
        inst.doll.Transform:SetPosition(pt.x, 3.5, pt.z)
        inst.doll.Physics:SetActive(false)
        inst.doll.AnimState:SetBank("wilson")
        inst.doll.AnimState:SetBuild(name)
        inst.doll.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear")
        inst.doll.AnimState:Hide("ARM_normal")
        inst.doll.AnimState:Show("ARM_carry")
        inst.doll.Transform:SetFourFaced()
        inst.doll.AnimState:PlayAnimation("idle")
        inst.doll:RemoveComponent("burnable")
        inst.doll:RemoveComponent("propagator")
        inst.doll:RemoveComponent("inspectable")
        inst.doll:RemoveComponent("inventoryitem")
        inst.doll:RemoveComponent("stackable")
        inst.doll:RemoveComponent("fuel")
        inst.task = inst:DoPeriodicTask(.05, function()
            local pt1 = GetPlayer():GetPosition()
            inst.doll.Transform:SetPosition(pt1.x, 3.5, pt1.z)
            inst.doll.Transform:SetRotation(GetPlayer().Transform:GetRotation())
        end )
        inst.task2 = inst:DoPeriodicTask(10, function()
            inst.doll.AnimState:PlayAnimation("give",true)
            inst:DoTaskInTime(2.2, function() inst.doll.AnimState:PlayAnimation("idle") end )
        end )
    end )
end )
TheInput:AddKeyUpHandler(KEY_PAGEDOWN, function()
    inst.components.locomotor:Stop()
    inst.components.playercontroller:Enable(false)
    SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
    inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/scream_short")
    inst:DoTaskInTime(0.1, function() 
        inst.AnimState:SetBank("wilson")
        inst.AnimState:SetBuild(name)
        inst.AnimState:PlayAnimation("idle")
        inst.AnimState:SetBloomEffectHandle("")
        inst:SetStateGraph("SGwilson")
        shadow:SetSize( 1.3, .6 )
        inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
        inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
        inst.components.health:SetInvincible(false)
        inst.components.hunger:Resume()
        inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
        inst.components.temperature:SetTemp(nil)
        inst.components.playercontroller:Enable(true)
        if inst.task then inst.task:Cancel() inst.task = nil end
        if inst.task2 then inst.task2:Cancel() inst.task2 = nil end
        if inst.doll then inst.doll:Remove() inst.doll = nil end
    end )
end )

    ɰPageUPٻ֩Զ֩ϣPageDownȡʱԵ˰Ctrl + Ҳ԰סF֩ʱ޷ǣǲѪ




.ձˣҼǿԭصȴ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\trunkvest.luaļinst.AnimState:SetBuild("armor_trunkvest_summer")һвݣ

local function OnDeploy (inst, pt)
    local jet = SpawnPrefab("trunkvest_summer")
    jet.Transform:SetPosition(pt.x, pt.y, pt.z)
    jet.AnimState:SetBank("glommer")
    jet.AnimState:SetBuild("glommer")
    jet.AnimState:PlayAnimation("idle_loop")
    jet.Transform:SetFourFaced()
    jet.entity:AddSoundEmitter()
    local shadow = jet.entity:AddDynamicShadow()
    shadow:SetSize( 2, .75 )
    local minimap = jet.entity:AddMiniMapEntity()
    minimap:SetIcon("glommer.png")
    jet:AddComponent("named")
    jet.components.named:SetName("Glommer")
    jet:RemoveComponent("inventoryitem")
    jet:RemoveComponent("equippable")
    jet:RemoveComponent("insulator")
    jet:RemoveComponent("fueled")
    jet:RemoveComponent("waterproofer")
    jet:RemoveComponent("deployable")
    jet:AddComponent("knownlocations")
    jet:AddComponent("follower")
    jet.components.follower:SetLeader(GetPlayer())
    jet:AddComponent("lootdropper")
    jet:AddComponent("health")
    jet.components.health:SetMaxHealth(2000)
    jet:AddComponent("combat")
    jet:AddComponent("locomotor")
    jet.components.locomotor.walkspeed = 15
    jet:SetStateGraph("SGglommer")
    local brain = require "brains/chesterbrain"
    jet:SetBrain(brain)
    jet:AddComponent("trader")
    jet.components.trader:SetAcceptTest(function(jet, item)
        if not jet:HasTag("driving") then
           if item.prefab == "cutgrass" then
              return true
           end
        end
        return false
    end )
    jet.components.trader.onaccept = function(jet, giver, item)
        jet.components.health:DoDelta(2000)
        if not jet:HasTag("stophere") then
           jet:AddTag("stophere")
           jet.components.locomotor:Stop()
           jet:SetBrain(nil)
           jet.components.follower:SetLeader(nil)
        else
           jet:RemoveTag("stophere")
           local brain = require "brains/chesterbrain"
           jet:SetBrain(brain)
           jet:RestartBrain()
           jet.components.follower:SetLeader(GetPlayer())
        end
    end
    jet.components.inspectable.getstatus = function()
        if not jet:HasTag("driving") then
           jet:AddTag("driving")
           jet:RemoveTag("stophere")
           jet.components.locomotor:Stop()
           local shadow = jet.entity:AddDynamicShadow()
           shadow:SetSize( 0, 0 )
           jet.Physics:SetActive(false)
           jet:SetStateGraph("SGshadowwaxwell")
           jet:SetBrain(nil)
           jet.components.follower:SetLeader(nil)
           jet.AnimState:SetBank("wilson")
           if GetPlayer().prefab == "wilson" then jet.AnimState:SetBuild("wilson") end
           if GetPlayer().prefab == "wendy" then jet.AnimState:SetBuild("wendy") end
           if GetPlayer().prefab == "wes" then jet.AnimState:SetBuild("wes") end
           if GetPlayer().prefab == "wickerbottom" then jet.AnimState:SetBuild("wickerbottom") end
           if GetPlayer().prefab == "willow" then jet.AnimState:SetBuild("willow") end
           if GetPlayer().prefab == "wolfgang" then jet.AnimState:SetBuild("wolfgang") end
           if GetPlayer().prefab == "wx78" then jet.AnimState:SetBuild("wx78") end
           if GetPlayer().prefab == "woodie" then jet.AnimState:SetBuild("woodie") end
           if GetPlayer().prefab == "waxwell" then jet.AnimState:SetBuild("waxwell") end
           if GetPlayer().prefab == "wathgrithr" then jet.AnimState:SetBuild("wathgrithr") end
           if GetPlayer().prefab == "webber" then jet.AnimState:SetBuild("webber") end
           jet.AnimState:PlayAnimation("idle")
           jet.AnimState:Hide("ARM_carry") 
           jet.AnimState:Show("ARM_normal")
           jet.Transform:SetRotation( 0 )
           jet.task = jet:DoPeriodicTask(0.05, function(jet)
               local pt1 = GetPlayer():GetPosition()
               jet.Transform:SetPosition(pt1.x, 3.5, pt1.z)
               jet.Transform:SetRotation(GetPlayer().Transform:GetRotation())
           end )
           GetPlayer().AnimState:SetBank("glommer")
           GetPlayer().AnimState:SetBuild("glommer")
           GetPlayer().AnimState:PlayAnimation("idle_loop")
           GetPlayer():SetStateGraph("SGglommer")
           local shadow = GetPlayer().entity:AddDynamicShadow()
           shadow:SetSize( 2, .75 )
           GetPlayer().components.locomotor.walkspeed = 25
           GetPlayer().components.locomotor.runspeed = 25
           GetPlayer().components.health:SetInvincible(true)
           GetPlayer().components.hunger:Pause()
           GetPlayer().components.temperature:SetTemp(20)
           GetPlayer().components.playeractionpicker.leftclickoverride = function(target_ent, pos)
               if GetPlayer().components.combat:CanTarget(target_ent) then
                  return GetPlayer().components.playeractionpicker:SortActionList({ACTIONS.LOOKAT}, target_ent, nil)
               end
           end
        else
           jet:RemoveTag("driving")
           local shadow = jet.entity:AddDynamicShadow()
           shadow:SetSize( 2, .75 )
           jet.Physics:SetActive(true)
           jet.AnimState:SetBank("glommer")
           jet.AnimState:SetBuild("glommer")
           jet.AnimState:PlayAnimation("idle_loop")
           jet:SetStateGraph("SGglommer")
           local brain = require "brains/chesterbrain"
           jet:SetBrain(brain)
           jet:RestartBrain()
           jet.components.follower:SetLeader(GetPlayer())
           if jet.task then jet.task:Cancel() jet.task = nil end
           local pt1 = GetPlayer():GetPosition()
           jet.Transform:SetPosition(pt1.x, 0, pt1.z)
           GetPlayer().AnimState:SetBank("wilson")
           if GetPlayer().prefab == "wilson" then GetPlayer().AnimState:SetBuild("wilson") end
           if GetPlayer().prefab == "wendy" then GetPlayer().AnimState:SetBuild("wendy") end
           if GetPlayer().prefab == "wes" then GetPlayer().AnimState:SetBuild("wes") end
           if GetPlayer().prefab == "wickerbottom" then GetPlayer().AnimState:SetBuild("wickerbottom") end
           if GetPlayer().prefab == "willow" then GetPlayer().AnimState:SetBuild("willow") end
           if GetPlayer().prefab == "wolfgang" then GetPlayer().AnimState:SetBuild("wolfgang") end
           if GetPlayer().prefab == "wx78" then GetPlayer().AnimState:SetBuild("wx78") end
           if GetPlayer().prefab == "woodie" then GetPlayer().AnimState:SetBuild("woodie") end
           if GetPlayer().prefab == "waxwell" then GetPlayer().AnimState:SetBuild("waxwell") end
           if GetPlayer().prefab == "wathgrithr" then GetPlayer().AnimState:SetBuild("wathgrithr") end
           if GetPlayer().prefab == "webber" then GetPlayer().AnimState:SetBuild("webber") end
           GetPlayer().AnimState:PlayAnimation("idle")
           GetPlayer():SetStateGraph("SGwilson")
           local shadow = GetPlayer().entity:AddDynamicShadow()
           shadow:SetSize( 1.3, .6 )
           GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
           GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
           GetPlayer().components.health:SetInvincible(false)
           GetPlayer().components.hunger:Resume()
           GetPlayer().components.temperature:SetTemp(nil)
           GetPlayer().components.playeractionpicker.leftclickoverride = nil
        end
    end
    jet:AddTag("jets")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("jets") then
        data.jets = true
    end
    if inst:HasTag("stophere") then
        data.stophere = true
    end
end
local function onload(inst, data)
  if data and data.jets then
    inst.AnimState:SetBank("glommer")
    inst.AnimState:SetBuild("glommer")
    inst.AnimState:PlayAnimation("idle_loop")
    inst.Transform:SetFourFaced()
    inst.entity:AddSoundEmitter()
    local shadow = inst.entity:AddDynamicShadow()
    shadow:SetSize( 2, .75 )
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("glommer.png")
    inst:AddComponent("named")
    inst.components.named:SetName("Glommer")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("insulator")
    inst:RemoveComponent("fueled")
    inst:RemoveComponent("waterproofer")
    inst:RemoveComponent("deployable")
    inst:AddComponent("knownlocations")
    inst:AddComponent("follower")
    inst.components.follower:SetLeader(GetPlayer())
    inst:AddComponent("lootdropper")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(2000)
    inst:AddComponent("combat")
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 15
    inst:SetStateGraph("SGglommer")
    local brain = require "brains/chesterbrain"
    inst:SetBrain(brain)
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item)
        if not inst:HasTag("driving") then
           if item.prefab == "cutgrass" then
              return true
           end
        end
        return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        inst.components.health:DoDelta(2000)
        if not inst:HasTag("stophere") then
           inst:AddTag("stophere")
           inst.components.locomotor:Stop()
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
        else
           inst:RemoveTag("stophere")
           local brain = require "brains/chesterbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
        end
    end
    inst.components.inspectable.getstatus = function()
        if not inst:HasTag("driving") then
           inst:AddTag("driving")
           inst:RemoveTag("stophere")
           inst.components.locomotor:Stop()
           local shadow = inst.entity:AddDynamicShadow()
           shadow:SetSize( 0, 0 )
           inst.Physics:SetActive(false)
           inst:SetStateGraph("SGshadowwaxwell")
           inst:SetBrain(nil)
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBank("wilson")
           if GetPlayer().prefab == "wilson" then inst.AnimState:SetBuild("wilson") end
           if GetPlayer().prefab == "wendy" then inst.AnimState:SetBuild("wendy") end
           if GetPlayer().prefab == "wes" then inst.AnimState:SetBuild("wes") end
           if GetPlayer().prefab == "wickerbottom" then inst.AnimState:SetBuild("wickerbottom") end
           if GetPlayer().prefab == "willow" then inst.AnimState:SetBuild("willow") end
           if GetPlayer().prefab == "wolfgang" then inst.AnimState:SetBuild("wolfgang") end
           if GetPlayer().prefab == "wx78" then inst.AnimState:SetBuild("wx78") end
           if GetPlayer().prefab == "woodie" then inst.AnimState:SetBuild("woodie") end
           if GetPlayer().prefab == "waxwell" then inst.AnimState:SetBuild("waxwell") end
           if GetPlayer().prefab == "wathgrithr" then inst.AnimState:SetBuild("wathgrithr") end
           if GetPlayer().prefab == "webber" then inst.AnimState:SetBuild("webber") end
           inst.AnimState:PlayAnimation("idle")
           inst.AnimState:Hide("ARM_carry") 
           inst.AnimState:Show("ARM_normal")
           inst.Transform:SetRotation( 0 )
           inst.task = inst:DoPeriodicTask(0.05, function(inst)
               local pt1 = GetPlayer():GetPosition()
               inst.Transform:SetPosition(pt1.x, 3.5, pt1.z)
               inst.Transform:SetRotation(GetPlayer().Transform:GetRotation())
           end )
           GetPlayer().AnimState:SetBank("glommer")
           GetPlayer().AnimState:SetBuild("glommer")
           GetPlayer().AnimState:PlayAnimation("idle_loop")
           GetPlayer():SetStateGraph("SGglommer")
           local shadow = GetPlayer().entity:AddDynamicShadow()
           shadow:SetSize( 2, .75 )
           GetPlayer().components.locomotor.walkspeed = 25
           GetPlayer().components.locomotor.runspeed = 25
           GetPlayer().components.health:SetInvincible(true)
           GetPlayer().components.hunger:Pause()
           GetPlayer().components.temperature:SetTemp(20)
           GetPlayer().components.playeractionpicker.leftclickoverride = function(target_ent, pos)
               if GetPlayer().components.combat:CanTarget(target_ent) then
                  return GetPlayer().components.playeractionpicker:SortActionList({ACTIONS.LOOKAT}, target_ent, nil)
               end
           end
        else
           inst:RemoveTag("driving")
           local shadow = inst.entity:AddDynamicShadow()
           shadow:SetSize( 2, .75 )
           inst.Physics:SetActive(true)
           inst.AnimState:SetBank("glommer")
           inst.AnimState:SetBuild("glommer")
           inst.AnimState:PlayAnimation("idle_loop")
           inst:SetStateGraph("SGglommer")
           local brain = require "brains/chesterbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           if inst.task then inst.task:Cancel() inst.task = nil end
           local pt1 = GetPlayer():GetPosition()
           inst.Transform:SetPosition(pt1.x, 0, pt1.z)
           GetPlayer().AnimState:SetBank("wilson")
           if GetPlayer().prefab == "wilson" then GetPlayer().AnimState:SetBuild("wilson") end
           if GetPlayer().prefab == "wendy" then GetPlayer().AnimState:SetBuild("wendy") end
           if GetPlayer().prefab == "wes" then GetPlayer().AnimState:SetBuild("wes") end
           if GetPlayer().prefab == "wickerbottom" then GetPlayer().AnimState:SetBuild("wickerbottom") end
           if GetPlayer().prefab == "willow" then GetPlayer().AnimState:SetBuild("willow") end
           if GetPlayer().prefab == "wolfgang" then GetPlayer().AnimState:SetBuild("wolfgang") end
           if GetPlayer().prefab == "wx78" then GetPlayer().AnimState:SetBuild("wx78") end
           if GetPlayer().prefab == "woodie" then GetPlayer().AnimState:SetBuild("woodie") end
           if GetPlayer().prefab == "waxwell" then GetPlayer().AnimState:SetBuild("waxwell") end
           if GetPlayer().prefab == "wathgrithr" then GetPlayer().AnimState:SetBuild("wathgrithr") end
           if GetPlayer().prefab == "webber" then GetPlayer().AnimState:SetBuild("webber") end
           GetPlayer().AnimState:PlayAnimation("idle")
           GetPlayer():SetStateGraph("SGwilson")
           local shadow = GetPlayer().entity:AddDynamicShadow()
           shadow:SetSize( 1.3, .6 )
           GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
           GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
           GetPlayer().components.health:SetInvincible(false)
           GetPlayer().components.hunger:Resume()
           GetPlayer().components.temperature:SetTemp(nil)
           GetPlayer().components.playeractionpicker.leftclickoverride = nil
        end
    end
    inst:AddTag("jets")
  end
  if data and data.stophere then
     inst.components.locomotor:Stop()
     inst:SetBrain(nil)
     inst.components.follower:SetLeader(nil)
     inst:AddTag("stophere")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ձﲻҪˣǰҼʱ޷ս⵽ʱˣ˹㣩㣬ιһݣŲݶͣԭأͬʱѪٸһݿɼ档СͼʾΪͼ꣬ҪˣɱɣCtrl + ձڴѡñӣ£1ɫǡ8˿




.վòϯֹվƱһվ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bedroll_straw.luaļinst:AddComponent("inspectable")һвݣ

    inst.kind = ""
    inst.soundpath   = "dontstarve/creatures/rook/"
    inst.effortsound = "dontstarve/creatures/rook/steam"
local function OnDeploy (inst, pt)
    local busstation = SpawnPrefab("bedroll_straw")
    busstation.Transform:SetPosition(pt.x, pt.y, pt.z)
    busstation.AnimState:SetBank("sign_home")
    busstation.AnimState:SetBuild("sign_home")
    busstation.AnimState:PlayAnimation("idle")
    busstation.Transform:SetScale(1.5, 1.5, 1.5)
    busstation.AnimState:SetMultColour(255/255,105/255,0/255,0.8)
    local minimap = busstation.entity:AddMiniMapEntity()
    minimap:SetIcon( "sign.png" )
    busstation:RemoveComponent("inventoryitem")
    busstation:RemoveComponent("stackable")
    busstation:RemoveComponent("fuel")
    busstation:RemoveComponent("sleepingbag")
    busstation:RemoveComponent("burnable")
    busstation:RemoveComponent("propagator")
    busstation:RemoveComponent("deployable")
    busstation:AddTag("busstation")
    busstation:AddComponent("workable")
    busstation.components.workable:SetWorkAction(ACTIONS.HAMMER)
    busstation.components.workable:SetWorkLeft(3)
    busstation.components.workable:SetOnFinishCallback(function(busstation)
        SpawnPrefab("collapse_big").Transform:SetPosition(busstation.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        busstation:Remove()
    end )
    busstation:AddComponent("trader")
    busstation.components.trader:SetAcceptTest(function(busstation, item) 
       if item.prefab == "goldnugget" then
          return true
       end
       return false
    end )
    busstation.components.trader.onaccept = function(busstation, giver, item)
        busstation:AddTag("startingpoint")
        local target = FindEntity(busstation, 3000, function(guy) 
            return guy:HasTag("busstation") and not guy:HasTag("startingpoint")
        end )
        if target then
           GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
           GetPlayer().components.playercontroller:Enable(false)
           local pt1 = busstation:GetPosition()
           local bus = SpawnPrefab("bedroll_straw")
           bus.Transform:SetPosition(pt1.x+15+2, 0, pt1.z-15+2)
           bus.AnimState:SetBank("rook")
           bus.AnimState:SetBuild("rook_build")
           bus.AnimState:PlayAnimation("idle", true)
           bus.Transform:SetFourFaced()
           bus.Transform:SetScale(1.2, 1.2, 1.2)
           bus.AnimState:SetMultColour(255/255,105/255,0/255,1)
           local sound = bus.entity:AddSoundEmitter()
           bus:RemoveComponent("inventoryitem")
           bus:RemoveComponent("stackable")
           bus:RemoveComponent("fuel")
           bus:RemoveComponent("sleepingbag")
           bus:RemoveComponent("burnable")
           bus:RemoveComponent("propagator")
           bus:RemoveComponent("deployable")
           bus:AddTag("goodbye")
           bus:AddComponent("locomotor")
           bus.components.locomotor.walkspeed = 5
           bus.components.locomotor.runspeed =  10
           bus:SetStateGraph("SGrook")
           bus:AddComponent("health")
           bus.components.health:SetMaxHealth(1000)
           bus.components.health:SetInvincible(true)
           bus:AddComponent("combat")
           bus:AddComponent("follower")
           bus:AddComponent("knownlocations")
           bus:DoTaskInTime(1, function()
               bus.components.locomotor:GoToPoint(Point(pt1.x+2, 0, pt1.z+2))
           end )
           bus:DoTaskInTime(9, function()
               GetPlayer():Hide()
               GetPlayer().components.health:SetInvincible(true)
               local shadow = GetPlayer().entity:AddDynamicShadow()
               shadow:SetSize( 0, 0 )
               bus.components.locomotor:GoToPoint(Point(pt1.x-15+2, 0, pt1.z+15+2))
           end )
           GetPlayer():DoTaskInTime(15, function()
               TheFrontEnd:Fade(false,1)
               bus:Remove()
               GetPlayer().Transform:SetPosition(target.Transform:GetWorldPosition())
               GetPlayer():DoTaskInTime(2, function()
                   TheFrontEnd:Fade(true,1)
                   busstation:RemoveTag("startingpoint")
                   GetPlayer():Show()
                   GetPlayer().components.health:SetInvincible(false)
                   GetPlayer().components.playercontroller:Enable(true)
                   local shadow = GetPlayer().entity:AddDynamicShadow()
                   shadow:SetSize( 1.3, .6 )
               end )
           end )
        else
           SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition())
           busstation:RemoveTag("startingpoint")
        end
    end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("busstation") then
        data.busstation = true
    end
end
local function onload(inst, data)
  if data and data.goodbye then
     inst:Remove()
  end
  if data and data.busstation then
    inst.AnimState:SetBank("sign_home")
    inst.AnimState:SetBuild("sign_home")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    inst.AnimState:SetMultColour(255/255,105/255,0/255,0.8)
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "sign.png" )
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("sleepingbag")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst:AddTag("busstation")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:AddComponent("trader")
    inst.components.trader:SetAcceptTest(function(inst, item) 
       if item.prefab == "goldnugget" then
          return true
       end
       return false
    end )
    inst.components.trader.onaccept = function(inst, giver, item)
        inst:AddTag("startingpoint")
        local target = FindEntity(inst, 3000, function(guy) 
            return guy:HasTag("busstation") and not guy:HasTag("startingpoint")
        end )
        if target then
           GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
           GetPlayer().components.playercontroller:Enable(false)
           local pt1 = inst:GetPosition()
           local bus = SpawnPrefab("bedroll_straw")
           bus.Transform:SetPosition(pt1.x+15+2, 0, pt1.z-15+2)
           bus.AnimState:SetBank("rook")
           bus.AnimState:SetBuild("rook_build")
           bus.AnimState:PlayAnimation("idle", true)
           bus.Transform:SetFourFaced()
           bus.Transform:SetScale(1.2, 1.2, 1.2)
           bus.AnimState:SetMultColour(255/255,105/255,0/255,1)
           local sound = bus.entity:AddSoundEmitter()
           bus:RemoveComponent("inventoryitem")
           bus:RemoveComponent("stackable")
           bus:RemoveComponent("fuel")
           bus:RemoveComponent("sleepingbag")
           bus:RemoveComponent("burnable")
           bus:RemoveComponent("propagator")
           bus:RemoveComponent("deployable")
           bus:AddTag("goodbye")
           bus:AddComponent("locomotor")
           bus.components.locomotor.walkspeed = 5
           bus.components.locomotor.runspeed =  10
           bus:SetStateGraph("SGrook")
           bus:AddComponent("health")
           bus.components.health:SetMaxHealth(1000)
           bus.components.health:SetInvincible(true)
           bus:AddComponent("combat")
           bus:AddComponent("follower")
           bus:AddComponent("knownlocations")
           bus:DoTaskInTime(1, function()
               bus.components.locomotor:GoToPoint(Point(pt1.x+2, 0, pt1.z+2))
           end )
           bus:DoTaskInTime(9, function()
               GetPlayer():Hide()
               GetPlayer().components.health:SetInvincible(true)
               local shadow = GetPlayer().entity:AddDynamicShadow()
               shadow:SetSize( 0, 0 )
               bus.components.locomotor:GoToPoint(Point(pt1.x-15+2, 0, pt1.z+15+2))
           end )
           GetPlayer():DoTaskInTime(15, function()
               TheFrontEnd:Fade(false,1)
               bus:Remove()
               GetPlayer().Transform:SetPosition(target.Transform:GetWorldPosition())
               GetPlayer():DoTaskInTime(2, function()
                   TheFrontEnd:Fade(true,1)
                   inst:RemoveTag("startingpoint")
                   GetPlayer():Show()
                   GetPlayer().components.health:SetInvincible(false)
                   GetPlayer().components.playercontroller:Enable(true)
                   local shadow = GetPlayer().entity:AddDynamicShadow()
                   shadow:SetSize( 1.3, .6 )
               end )
           end )
        else
           SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition())
           inst:RemoveTag("startingpoint")
        end
    end
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڵͼص㣬òϯֹվվ1ƽŻƽվƵ㵽һվƣƶվڿտĵطԱ㹫ʻֻһվվƲĻƽ𡣹վСͼʾΪ·ƵͼꡣҪվʱôҵɡϯѡ£ף£6ݡ1




ߣ.ƣZٻϷУٰZأ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("resurrectable")һвݣ

TheInput:AddKeyUpHandler(KEY_Z, function()
     if not inst:HasTag("flycloud") then
        inst:AddTag("flycloud")
        inst.components.locomotor:Stop()
        inst.components.talker:ShutUp()
        SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst.AnimState:PlayAnimation("give")
        inst:DoTaskInTime(0.3, function()
            inst.cloud = SpawnPrefab("corn_cooked")
            inst.cloud.Physics:SetActive(false)
            inst.cloud.Transform:SetScale(1.8, 1.8, 1.8)
            inst.cloud.AnimState:SetMultColour(255/255,255/255,255/255,0.6)
            inst.cloud.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            inst.cloud:RemoveComponent("perishable")
            inst.cloud:RemoveComponent("edible")
            inst.cloud:RemoveComponent("stackable")
            inst.cloud:RemoveComponent("inventoryitem")
            inst.cloud:RemoveComponent("bait")
            inst.cloud:RemoveComponent("tradable")
            inst.cloud:RemoveComponent("burnable")
            inst.cloud:RemoveComponent("propagator")
            inst.cloud.persists = false
            inst.cloud:AddTag("NOCLICK")
            local follower = inst.cloud.entity:AddFollower()
            follower:FollowSymbol( inst.GUID, "swap_body", 0, 60, 0 )
            local pt = inst:GetPosition()
            inst.Transform:SetPosition(pt.x, 10, pt.z)
            local shadow = inst.entity:AddDynamicShadow()
            shadow:SetSize( 0, 0 )
            inst.gogogo = inst:DoPeriodicTask(.01, function() inst.Physics:SetMotorVelOverride(25,1.5,0) end)
        end )
     else
        inst:RemoveTag("flycloud")
        inst.components.locomotor:Stop()
        inst.components.talker:ShutUp()
        SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition())
        inst.AnimState:PlayAnimation("give")
        inst:DoTaskInTime(0.3, function()
            if inst.cloud then inst.cloud:Remove() inst.cloud = nil end
            if inst.gogogo then inst.gogogo:Cancel() inst.gogogo = nil end
            local pt = inst:GetPosition()
            inst.Transform:SetPosition(pt.x, 0, pt.z)
            local shadow = inst.entity:AddDynamicShadow()
            shadow:SetSize( 1.3, .6 )
            inst.Physics:ClearMotorVelOverride()
            inst.Physics:ClearMotorVelOverride()
        end )
     end
end )

    ɿĬ㡱¼ZٻϷУüWSADƷٴΰZ




һ.ȫԶֲֻԶһٶ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\lightningrod.luaļinst:AddComponent("inspectable")һвݣ

local slotpos = { Vector3(0,-75,0)}
local function itemtest(inst, item, slot)
    if item.prefab == "twigs" or item.prefab == "cutgrass" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "cutreeds" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "carrot" or item.prefab == "berries" or item.prefab == "mandrake" or item.prefab == "foliage" or item.prefab == "cave_banana" or item.prefab == "cutlichen" or item.prefab == "lightbulb" or item.prefab == "pinecone" or item.prefab == "charcoal" or item.prefab == "acorn" or item.prefab == "cactus_meat" then
       return true
    end
    return false
end
local widgetbuttoninfo = {
    text = "Do",
    position = Vector3(0, -145, 0),
    fn = function(inst)
        if GetPlayer().components.inventory:Has("goldnugget", 50) then
           if inst.components.container:Has("twigs", 1) then
              inst.components.container:ConsumeByName("twigs", 1)
              inst.plants = "sapling"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("cutgrass", 1) then
              inst.components.container:ConsumeByName("cutgrass", 1)
              inst.plants = "grass"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("petals", 1) then
              inst.components.container:ConsumeByName("petals", 1)
              inst.plants = "flower"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("petals_evil", 1) then
              inst.components.container:ConsumeByName("petals_evil", 1)
              inst.plants = "flower_evil"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("cutreeds", 1) then
              inst.components.container:ConsumeByName("cutreeds", 1)
              inst.plants = "reeds"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("red_cap", 1) then
              inst.components.container:ConsumeByName("red_cap", 1)
              inst.plants = "red_mushroom"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("green_cap", 1) then
              inst.components.container:ConsumeByName("green_cap", 1)
              inst.plants = "green_mushroom"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("blue_cap", 1) then
              inst.components.container:ConsumeByName("blue_cap", 1)
              inst.plants = "blue_mushroom"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("carrot", 1) then
              inst.components.container:ConsumeByName("carrot", 1)
              inst.plants = "carrot_planted"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("berries", 1) then
              inst.components.container:ConsumeByName("berries", 1)
              inst.plants = "berrybush2"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("mandrake", 1) then
              inst.components.container:ConsumeByName("mandrake", 1)
              inst.plants = "mandrake"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("foliage", 1) then
              inst.components.container:ConsumeByName("foliage", 1)
              inst.plants = "cave_fern"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("cave_banana", 1) then
              inst.components.container:ConsumeByName("cave_banana", 1)
              inst.plants = "cave_banana_tree"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("cutlichen", 1) then
              inst.components.container:ConsumeByName("cutlichen", 1)
              inst.plants = "lichen"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("lightbulb", 1) then
              inst.components.container:ConsumeByName("lightbulb", 1)
              inst.plants = "flower_cave_triple"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("pinecone", 1) then
              inst.components.container:ConsumeByName("pinecone", 1)
              inst.plants = "evergreen_tall"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("charcoal", 1) then
              inst.components.container:ConsumeByName("charcoal", 1)
              inst.plants = "mushtree_tall"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("acorn", 1) then
              inst.components.container:ConsumeByName("acorn", 1)
              inst.plants = "deciduoustree_tall"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           if inst.components.container:Has("cactus_meat", 1) then
              inst.components.container:ConsumeByName("cactus_meat", 1)
              inst.plants = "cactus"
              GetPlayer().components.inventory:ConsumeByName("goldnugget", 50)
           end
           local pt = Vector3(inst.Transform:GetWorldPosition())
           inst:StartThread(function()
               for k = 1, 25 do
                   local result_offset = FindValidPositionByFan(1 * 2 * PI, 4, 25, function(offset)
                       local x,y,z = (pt + offset):Get()
                       local ents = TheSim:FindEntities(x,y,z , 1)
                       return not next(ents) 
                   end)
                   if result_offset then
                       local plant = SpawnPrefab(inst.plants)
                       plant.Transform:SetPosition((pt + result_offset):Get())
                       GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                       local fx = SpawnPrefab("splash_ocean")
                       local pos = pt + result_offset
                       fx.Transform:SetPosition(pos.x, pos.y, pos.z)
                       GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                   end
                   Sleep(.33)
               end
               for k = 1, 37 do
                   local result_offset = FindValidPositionByFan(1 * 2 * PI, 6, 37, function(offset)
                       local x,y,z = (pt + offset):Get()
                       local ents = TheSim:FindEntities(x,y,z , 1)
                       return not next(ents) 
                   end)
                   if result_offset then
                       local plant = SpawnPrefab(inst.plants)
                       plant.Transform:SetPosition((pt + result_offset):Get())
                       GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                       local fx = SpawnPrefab("splash_ocean")
                       local pos = pt + result_offset
                       fx.Transform:SetPosition(pos.x, pos.y, pos.z)
                       GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                   end
                   Sleep(.23)
               end
               for k = 1, 50 do
                   local result_offset = FindValidPositionByFan(1 * 2 * PI, 8, 50, function(offset)
                       local x,y,z = (pt + offset):Get()
                       local ents = TheSim:FindEntities(x,y,z , 1)
                       return not next(ents) 
                   end)
                   if result_offset then
                       local plant = SpawnPrefab(inst.plants)
                       plant.Transform:SetPosition((pt + result_offset):Get())
                       GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
                       local fx = SpawnPrefab("splash_ocean")
                       local pos = pt + result_offset
                       fx.Transform:SetPosition(pos.x, pos.y, pos.z)
                       GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                   end
                   Sleep(.13)
               end
           end)
        end
end }
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,180,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.acceptsstacks = false
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo

    ڿտĵϽһ룬ɴ򿪸ӣڸзֲDoťԶ100ֲ50ƽϻƽʱֲֲ17ֲУ֦硢ֲݡֻجλجλ«έ«έĢֺĢĢĢĢĢֺֹܲܲԡݡҶާֲ㽶㽶̦޺̦޺ӫ䶴Ѩɹľ̿Ģơʱʾ浵˳ٶͿʾע⣬йԡ㽶Ģֺú޷ͨУáʿȡ˲ƣԾáոߡջ




߶.ֻܲˣڵԶ100㽶

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\onemanband.luaļinst:AddComponent("inspectable")һвݣ

local function ondropped(inst)
    local player = GetPlayer()
    if player.components.inventory:Has("goldnugget", 50) then
    player.components.inventory:ConsumeByName("goldnugget", 50)
    RemovePhysicsColliders(inst)
    inst.name = "cave_banana_tree"
    inst.components.inventoryitem.canbepickedup = false
    inst:DoTaskInTime(1, function()
        inst.task = inst:DoPeriodicTask(.5, function()
            inst.Physics:SetMotorVelOverride(2,0,2)
            inst.Physics:ClearMotorVelOverride()
            player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end)
    end)
    inst:DoTaskInTime(11, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end 
        player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst.Physics:SetMotorVelOverride(-3,0,3)
        inst.Physics:ClearMotorVelOverride()
    end)
    inst:DoTaskInTime(12, function()
        inst.task = inst:DoPeriodicTask(.5, function()
            inst.Physics:SetMotorVelOverride(-2,0,-2)
            inst.Physics:ClearMotorVelOverride()
            player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end)
    end)
    inst:DoTaskInTime(22, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end 
        player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst.Physics:SetMotorVelOverride(-3,0,3)
        inst.Physics:ClearMotorVelOverride()
    end)
    inst:DoTaskInTime(23, function()
        inst.task = inst:DoPeriodicTask(.5, function()
            inst.Physics:SetMotorVelOverride(2,0,2)
            inst.Physics:ClearMotorVelOverride()
            player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end)
    end)
    inst:DoTaskInTime(33, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end 
        player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst.Physics:SetMotorVelOverride(-3,0,3)
        inst.Physics:ClearMotorVelOverride()
    end)
    inst:DoTaskInTime(34, function()
        inst.task = inst:DoPeriodicTask(.5, function()
            inst.Physics:SetMotorVelOverride(-2,0,-2)
            inst.Physics:ClearMotorVelOverride()
            player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end)
    end)
    inst:DoTaskInTime(44, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end 
        player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst.Physics:SetMotorVelOverride(-3,0,3)
        inst.Physics:ClearMotorVelOverride()
    end)
    inst:DoTaskInTime(45, function()
        inst.task = inst:DoPeriodicTask(.5, function()
            inst.Physics:SetMotorVelOverride(2,0,2)
            inst.Physics:ClearMotorVelOverride()
            player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition())
        end)
    end)
    inst:DoTaskInTime(55, function() 
        if inst.task then inst.task:Cancel() inst.task = nil end 
        player.SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst.Physics:SetMotorVelOverride(-3,0,3)
        inst.Physics:ClearMotorVelOverride()
        inst.components.inventoryitem.canbepickedup = true
    end)
    end
end
    inst:ListenForEvent("ondropped",  ondropped)

    ɽڿĿյϣԶʻ100㽶5Уÿ20ãͬʱȡ50ƽϻƽʱɻеcave_banana_treeѨ㽶Ϊֲflower_cave_triple䶴ѨȣͿֲˣ޸ļɡƷӢơħѡźã£2ƽ4جȼϡ2Ƥ




.ˣ߰ڵԶ50ũ

    ü±ϷĿ¼\data\scripts\prefabs\sewingkit.luaļinst:AddComponent("inspectable")һвݣ

local function startbuild(inst)
    inst.name = "fast_farmplot"
    local space = 2.1
    local row = 10
    local num = 0 local num2 = 0 local num3 = 0 local num4 = 0 local num5 = 0
    local pt = GetPlayer():GetPosition()
    inst:StartThread(function()
        for k = 1,row do
            num = num + space
            inst.Transform:SetPosition(pt.x+num, 5, pt.z+num)
            SpawnPrefab(inst.name).Transform:SetPosition(pt.x+num, 0, pt.z+num)
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            Sleep(.5)
        end
        for k = 1,row do
            num2 = num2 + space
            inst.Transform:SetPosition(pt.x-2.6+num2, 5, pt.z+2.6+num2)
            SpawnPrefab(inst.name).Transform:SetPosition(pt.x-2.6+num2, 0, pt.z+2.6+num2)
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            Sleep(.5)
        end
        for k = 1,row do
            num3 = num3 + space
            inst.Transform:SetPosition(pt.x-5.2+num3, 5, pt.z+5.2+num3)
            SpawnPrefab(inst.name).Transform:SetPosition(pt.x-5.2+num3, 0, pt.z+5.2+num3)
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            Sleep(.5)
        end
        for k = 1,row do
            num4 = num4 + space
            inst.Transform:SetPosition(pt.x-7.8+num4, 5, pt.z+7.8+num4)
            SpawnPrefab(inst.name).Transform:SetPosition(pt.x-7.8+num4, 0, pt.z+7.8+num4)
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            Sleep(.5)
        end
        for k = 1,row do
            num5 = num5 + space
            inst.Transform:SetPosition(pt.x-10.4+num5, 5, pt.z+10.4+num5)
            SpawnPrefab(inst.name).Transform:SetPosition(pt.x-10.4+num5, 0, pt.z+10.4+num5)
            GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            Sleep(.5)
        end
    end)
end
local function ondropped(inst)
    if GetPlayer().components.inventory:Has("goldnugget", 100) then
       GetPlayer().components.inventory:ConsumeByName("goldnugget", 100)
       GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
       inst.components.inventoryitem.canbepickedup = false
       inst.Physics:SetMotorVelOverride(0,2,0)
       inst:DoTaskInTime(3, function() startbuild(inst) end)
       inst:DoTaskInTime(28, function()
           inst.Physics:ClearMotorVelOverride()
           inst.components.inventoryitem.canbepickedup = true
           GetPlayer().components.inventory:GiveItem(inst)
       end)
    end
end
    inst:ListenForEvent("ondropped",  ondropped)

    ɽ߰ڿĿյϣڿԶ50ũͬʱȡ100ƽϻƽʱɻеfast_farmplot߼ũΪcookpotbirdcageȣͿԽˣ޸ļɡƷӢơ߰ڴѡñ£1ľͷ8˿2Ȯ




.綯ӣûƽԶŵߵ

    ü±ϷĿ¼\data\scripts\prefabs\axe.luaļ

    1.ݣ

local function onequipgold(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenaxe", "swap_goldenaxe")
	owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")     
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

    滻Ϊ

local function pickup(inst, owner)
    local range = 3
    local pos = Vector3(owner.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v:HasTag("tree") and v.components.workable and v.components.workable.workleft > 0 then
           v.components.workable:Destroy(GetPlayer())
        end
    end
    inst.SoundEmitter:PlaySound("dontstarve/forest/treeCrumble")
end
local function onequipgold(inst, owner)
    if owner.components.inventory:Has("lightbulb", 1) then
       inst.task = inst:DoPeriodicTask(.033, function() pickup(inst, owner) end)
       owner.components.inventory:ConsumeByName("lightbulb", 1)
    end
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenaxe", "swap_goldenaxe")
    owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end
local function onunequipgold(inst, owner)
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")
    if inst.task then inst.task:Cancel() inst.task = nil end
end


    2.inst.components.equippable:SetOnEquip( onequipgold )һвinst.components.equippable:SetOnUnequip( onunequipgold )

    ûƽԶŵߵƵ⣩ЧʼߣҲ綯ҪԴÿװʱԶ1ӫûӫ򲻻Ὺ綯ܣֶֻ




.綯䣨ûƽԶ俪ߵʯͷ

    1.ü±ϷĿ¼\data\scripts\prefabs\pickaxe.luaļݣ

local function onequipgold(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenpickaxe", "swap_goldenpickaxe")
	owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")     
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

    滻Ϊ

local function pickup(inst, owner)
    local range = 3
    local pos = Vector3(owner.Transform:GetWorldPosition())
    local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
    for k,v in pairs(ents) do
        if v.components.workable and v.components.workable.action == ACTIONS.MINE and v.components.workable.workleft > 0 then
           v.components.workable:Destroy(GetPlayer())
        end
    end
    inst.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
end
local function onequipgold(inst, owner)
    if owner.components.inventory:Has("lightbulb", 1) then
       inst.task = inst:DoPeriodicTask(.033, function() pickup(inst, owner) end)
       owner.components.inventory:ConsumeByName("lightbulb", 1)
    end
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenpickaxe", "swap_goldenpickaxe")
    owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
    owner.AnimState:Show("ARM_carry")
    owner.AnimState:Hide("ARM_normal")
end
local function onunequipgold(inst, owner)
    owner.AnimState:Hide("ARM_carry")
    owner.AnimState:Show("ARM_normal")
    if inst.task then inst.task:Cancel() inst.task = nil end
end


    2.inst.components.equippable:SetOnEquip( onequipgold )һвinst.components.equippable:SetOnUnequip( onunequipgold )

    ûƽԶ俪ߵʯͷЧʼߣʯ֩붴Զŵ񶼿ƽ綯ҪԴÿװʱԶ1ӫûӫ򲻻Ὺ綯ܣֶֻ




.綯ݲ棨òݲԶµĵƤ

    ü±ϷĿ¼\data\scripts\prefabs\pitchfork.luaļݣ

local function onequip(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_pitchfork", "swap_pitchfork")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

local function onunequip(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
end

    滻Ϊ

local function pickup(inst, owner)
    local pt = owner:GetPosition()
    inst.components.terraformer:Terraform(pt)
    inst.SoundEmitter:PlaySound("dontstarve/wilson/dig")
end
local function onequip(inst, owner) 
    if owner.components.inventory:Has("lightbulb", 1) then
       inst.task = inst:DoPeriodicTask(.033, function() pickup(inst, owner) end)
       owner.components.inventory:ConsumeByName("lightbulb", 1)
    end
    owner.AnimState:OverrideSymbol("swap_object", "swap_pitchfork", "swap_pitchfork")
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end
local function onunequip(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
    if inst.task then inst.task:Cancel() inst.task = nil end
end

    òݲԶµĵƤЧʼߣصٶֻȡ߶졣綯ݲҪԴÿװʱԶ1ӫûӫ򲻻Ὺ綯ܣֶֻ




.綯·ûƽԶµĿյƤ̳·

    ü±ϷĿ¼\data\scripts\prefabs\shovel.luaļ

    1.ݣ

local function onequipgold(inst, owner) 
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenshovel", "swap_goldenshovel")
	owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")     
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end

    滻Ϊ

local function pickup(inst, owner)
    inst.name = GROUND.ROAD
    local pt = owner:GetPosition()
    local ground = GetWorld()
    local tile = ground.Map:GetTileAtPoint(pt.x, pt.y, pt.z)
    if ground and tile == GROUND.DIRT then
       local original_tile_type = ground.Map:GetTileAtPoint(pt.x, pt.y, pt.z)
       local x, y = ground.Map:GetTileCoordsAtPoint(pt.x, pt.y, pt.z)
       if x and y then
          ground.Map:SetTile(x,y, inst.name)
          ground.Map:RebuildLayer( original_tile_type, x, y )
          ground.Map:RebuildLayer( inst.name, x, y )
       end
       local minimap = TheSim:FindFirstEntityWithTag("minimap")
       if minimap then
          minimap.MiniMap:RebuildLayer( original_tile_type, x, y )
          minimap.MiniMap:RebuildLayer( inst.name, x, y )
       end
    end
    inst.SoundEmitter:PlaySound("dontstarve/wilson/dig")
end
local function onequipgold(inst, owner) 
    if owner.components.inventory:Has("lightbulb", 1) then
       inst.task = inst:DoPeriodicTask(.033, function() pickup(inst, owner) end)
       owner.components.inventory:ConsumeByName("lightbulb", 1)
    end
    owner.AnimState:OverrideSymbol("swap_object", "swap_goldenshovel", "swap_goldenshovel")
    owner.SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")     
    owner.AnimState:Show("ARM_carry") 
    owner.AnimState:Hide("ARM_normal") 
end
local function onunequipgold(inst, owner) 
    owner.AnimState:Hide("ARM_carry") 
    owner.AnimState:Show("ARM_normal") 
    if inst.task then inst.task:Cancel() inst.task = nil end
end


    2.inst.components.equippable:SetOnEquip( onequipgold )һвinst.components.equippable:SetOnUnequip( onunequipgold )

    ûƽԶµĿյƤ̳·Чʼߣ·ٶֻȡ߶졣綯·ҪԴÿװʱԶ1ӫûӫ򲻻Ὺ綯ܡGROUND.ROADʯ·滻ΪƤƣGROUND.ROCKYʯƤGROUND.DIRT۹ƤGROUND.SAVANNAȴԭƤGROUND.GRASSݵƤGROUND.FORESTɭֵƤGROUND.MARSHƤGROUND.WOODFLOORľʵذ壩GROUND.CARPET̺ذ壩GROUND.CHECKER̵ذ壩GROUND.CAVEƤGROUND.FUNGUSƤGROUND.FUNGUSREDƤGROUND.FUNGUSGREEN̾ƤGROUND.SINKHOLEճƤGROUND.UNDERROCKѨʯصƤGROUND.MUDŢƤͿԶƤ




߰.ƤֵƤһ70Ƥ

    ü±ϷĿ¼\data\scripts\prefabs\panflute.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "turf_road" or item.prefab == "turf_rocky" or item.prefab == "turf_forest" or item.prefab == "turf_marsh" or item.prefab == "turf_grass" or item.prefab == "turf_savanna" or item.prefab == "turf_dirt" or item.prefab == "turf_woodfloor" or item.prefab == "turf_carpetfloor" or item.prefab == "turf_checkerfloor" or item.prefab == "turf_cave" or item.prefab == "turf_fungus" or item.prefab == "turf_fungus_red" or item.prefab == "turf_fungus_green" or item.prefab == "turf_sinkhole" or item.prefab == "turf_underrock" or item.prefab == "turf_mud" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,-75,0)}
local widgetbuttoninfo = {
    text = "Do",
    position = Vector3(0, -135, 0),
    fn = function(inst)
        if inst:HasTag("turfmachines") then
           if not inst.components.container:IsEmpty() then
              for k,v in pairs(inst.components.container.slots) do
                  if v and v.prefab == "turf_road" then inst.rug = GROUND.ROAD end
                  if v and v.prefab == "turf_rocky" then inst.rug = GROUND.ROCKY end
                  if v and v.prefab == "turf_forest" then inst.rug = GROUND.FOREST end
                  if v and v.prefab == "turf_marsh" then inst.rug = GROUND.MARSH end
                  if v and v.prefab == "turf_grass" then inst.rug = GROUND.GRASS end
                  if v and v.prefab == "turf_savanna" then inst.rug = GROUND.SAVANNA end
                  if v and v.prefab == "turf_dirt" then inst.rug = GROUND.DIRT end
                  if v and v.prefab == "turf_woodfloor" then inst.rug = GROUND.WOODFLOOR end
                  if v and v.prefab == "turf_carpetfloor" then inst.rug = GROUND.CARPET end
                  if v and v.prefab == "turf_checkerfloor" then inst.rug = GROUND.CHECKER end
                  if v and v.prefab == "turf_cave" then inst.rug = GROUND.CAVE end
                  if v and v.prefab == "turf_fungus" then inst.rug = GROUND.FUNGUS end
                  if v and v.prefab == "turf_fungus_red" then inst.rug = GROUND.FUNGUSRED end
                  if v and v.prefab == "turf_fungus_green" then inst.rug = GROUND.FUNGUSGREEN end
                  if v and v.prefab == "turf_sinkhole" then inst.rug = GROUND.SINKHOLE end
                  if v and v.prefab == "turf_underrock" then inst.rug = GROUND.UNDERROCK end
                  if v and v.prefab == "turf_mud" then inst.rug = GROUND.MUD end
                  v:Remove()
              end
              local pt = GetPlayer():GetPosition()
              for y = 10, 0, -1 do
                  for x = 0, 10 do
                      local tile = GetWorld().Map:GetTileAtPoint(pt.x-2.1*x+2.1*y-10.5+10.5, pt.y, pt.z+2.1*x+2.1*y-10.5-10.5)
                      if tile ~= GROUND.IMPASSABLE then
                         local original_tile_type = GetWorld().Map:GetTileAtPoint(pt.x-2.1*x+2.1*y-10.5+10.5, pt.y, pt.z+2.1*x+2.1*y-10.5-10.5)
                         local x, y = GetWorld().Map:GetTileCoordsAtPoint(pt.x-2.1*x+2.1*y-10.5+10.5, pt.y, pt.z+2.1*x+2.1*y-10.5-10.5)
                         GetWorld().Map:SetTile(x,y, inst.rug)
                         GetWorld().Map:RebuildLayer( original_tile_type, x, y )
                         GetWorld().Map:RebuildLayer( inst.rug, x, y )
                         local minimap = TheSim:FindFirstEntityWithTag("minimap")
                         minimap.MiniMap:RebuildLayer( original_tile_type, x, y )
                         minimap.MiniMap:RebuildLayer( inst.rug, x, y )
                      end
                  end
              end
           end
        end
    end }
local function OnDeploy (inst, pt)
    local turfmachine = SpawnPrefab("panflute")
    turfmachine.Transform:SetPosition(pt.x, pt.y, pt.z)
    turfmachine.AnimState:SetBank("researchlab3")
    turfmachine.AnimState:SetBuild("researchlab3")
    turfmachine.AnimState:PlayAnimation("idle")
    turfmachine.Transform:SetScale(0.5, 0.5, 0.5)
    turfmachine:RemoveComponent("instrument")
    turfmachine:RemoveComponent("tool")
    if turfmachine.components.finiteuses then turfmachine:RemoveComponent("finiteuses") end
    turfmachine:RemoveComponent("deployable")
    turfmachine.components.container.canbeopened = true
    turfmachine.components.inventoryitem:ChangeImageName("researchlab3")
    turfmachine:AddComponent("equippable")
    turfmachine.components.equippable.equipslot = EQUIPSLOTS.BODY
    turfmachine.components.equippable:SetOnEquip( function(turfmachine)
        GetPlayer().components.inventory:SetOverflow(turfmachine)
        turfmachine.components.container:Open(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open")
    end )
    turfmachine.components.equippable:SetOnUnequip( function(turfmachine)
        turfmachine.components.container:Close(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open")
    end )
    turfmachine:AddTag("turfmachines")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("turfmachines") then
       data.turfmachines = true
    end
end
local function onload(inst, data)
  if data and data.turfmachines then
    inst.AnimState:SetBank("researchlab3")
    inst.AnimState:SetBuild("researchlab3")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(0.5, 0.5, 0.5)
    inst:RemoveComponent("instrument")
    inst:RemoveComponent("tool")
    if inst.components.finiteuses then inst:RemoveComponent("finiteuses") end
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst.components.inventoryitem:ChangeImageName("researchlab3")
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.BODY
    inst.components.equippable:SetOnEquip( function(inst)
        GetPlayer().components.inventory:SetOverflow(inst)
        inst.components.container:Open(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open")
    end )
    inst.components.equippable:SetOnUnequip( function(inst)
        inst.components.container:Close(GetPlayer())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open")
    end )
    inst:AddTag("turfmachines")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-80,150,0)
    inst.components.container.side_widget = true
    inst.components.container.itemtestfn = itemtest
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.acceptsstacks = false
    inst.components.container.canbeopened = false

    ֵƤװƤĻҲཫָӺͰťڸз1ƤDoťϷῨһ£5-10룩70Ƥ̺ˣͼ֧17ֵƤֻҪԷӵĶ̡ħѡźã5«έ1ݡ1




߾.СңúСңӣ10볤ʵ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\butterflywings.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local oven = SpawnPrefab("butterflywings")
    oven.Transform:SetPosition(pt.x, pt.y, pt.z)
    oven.AnimState:SetBank("skull_chest")
    oven.AnimState:SetBuild("skull_chest")
    oven.AnimState:PlayAnimation("closed")
    oven.Transform:SetScale(1.5, 1.5, 1.5)
    oven:AddTag("fridge")
    oven:AddTag("ovens")
    oven:RemoveComponent("edible")
    oven:RemoveComponent("tradable")
    oven:RemoveComponent("stackable")
    oven:RemoveComponent("inventoryitem")
    oven:RemoveComponent("perishable")
    oven:RemoveComponent("deployable")
    oven:RemoveTag("cattoy")
    oven:AddComponent("workable")
    oven.components.workable:SetWorkAction(ACTIONS.HAMMER)
    oven.components.workable:SetWorkLeft(3)
    oven.components.workable:SetOnFinishCallback(function(oven)
        SpawnPrefab("collapse_big").Transform:SetPosition(oven.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        oven:Remove()
    end )
    oven.components.container.canbeopened = true
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("ovens") then
        data.ovens = true
    end
end
local function onload(inst, data)
  if data and data.ovens then
    inst.AnimState:SetBank("skull_chest")
    inst.AnimState:SetBuild("skull_chest")
    inst.AnimState:PlayAnimation("closed")
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    inst:AddTag("fridge")
    inst:AddTag("ovens")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveTag("cattoy")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst.components.container.canbeopened = true
  end
end
local function itemtest(inst, item, slot)
    if item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "carrot_seeds" or item.prefab == "corn_seeds" or item.prefab == "pumpkin_seeds" or item.prefab == "eggplant_seeds" or item.prefab == "durian_seeds" or item.prefab == "pomegranate_seeds" or item.prefab == "dragonfruit_seeds" or item.prefab == "seeds" or item.prefab == "spoiled_food" or item.prefab == "lightbulb" or item.prefab == "watermelon_seeds" or item.prefab == "watermelon" then
       return true
    end
    return false
end
local slotpos = {}
for y = 2, 0, -1 do
    for x = 0, 14 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
local widgetbuttoninfo = {
    text = "Start",
    position = Vector3(450, -150, 0),
    fn = function(inst)
      if inst:HasTag("ovens") and inst.components.container:Has("lightbulb", 1) then
       inst.components.container:ConsumeByName("lightbulb", 1)
       inst.components.container:Close(GetPlayer())
       inst.components.container.canbeopened = false
       inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
       inst:DoTaskInTime(10, function()
           inst.AnimState:SetBloomEffectHandle("")
           GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
           inst.components.container.canbeopened = true
           for k,v in pairs(inst.components.container.slots) do
               if v and v.prefab == "carrot_seeds" then
                  v:Remove()
                  local carrot = SpawnPrefab("carrot")
                  inst.components.container:GiveItem(carrot)
               end
               if v and v.prefab == "corn_seeds" then
                  v:Remove()
                  local corn = SpawnPrefab("corn")
                  inst.components.container:GiveItem(corn)
               end
               if v and v.prefab == "pumpkin_seeds" then
                  v:Remove()
                  local pumpkin = SpawnPrefab("pumpkin")
                  inst.components.container:GiveItem(pumpkin)
               end
               if v and v.prefab == "eggplant_seeds" then
                  v:Remove()
                  local eggplant = SpawnPrefab("eggplant")
                  inst.components.container:GiveItem(eggplant)
               end
               if v and v.prefab == "durian_seeds" then
                  v:Remove()
                  local durian = SpawnPrefab("durian")
                  inst.components.container:GiveItem(durian)
               end
               if v and v.prefab == "pomegranate_seeds" then
                  v:Remove()
                  local pomegranate = SpawnPrefab("pomegranate")
                  inst.components.container:GiveItem(pomegranate)
               end
               if v and v.prefab == "dragonfruit_seeds" then
                  v:Remove()
                  local dragonfruit = SpawnPrefab("dragonfruit")
                  inst.components.container:GiveItem(dragonfruit)
               end
               if v and v.prefab == "watermelon_seeds" then
                  v:Remove()
                  local watermelon = SpawnPrefab("watermelon")
                  inst.components.container:GiveItem(watermelon)
               end
               if v and v.prefab == "seeds" then
                  v:Remove()
                  local names = {"carrot","corn","pumpkin","eggplant","durian","pomegranate","dragonfruit","watermelon"}
                  local name = names[math.random(#names)]
                  local fruit = SpawnPrefab(name)
                  inst.components.container:GiveItem(fruit)
               end
               if v.prefab == "carrot" or v.prefab == "corn" or v.prefab == "pumpkin" or v.prefab == "eggplant" or v.prefab == "durian" or v.prefab == "pomegranate" or v.prefab == "dragonfruit" or v.prefab == "watermelon" then
                  v:Remove()
                  local spoiled = SpawnPrefab("spoiled_food")
                  inst.components.container:GiveItem(spoiled)
               end
           end
       end )
      end
    end }
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.acceptsstacks = false
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-250,200,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.itemtestfn = itemtest
    inst.components.container.onopenfn = function(inst) inst.AnimState:PlayAnimation("open") end
    inst.components.container.onclosefn = function(inst) inst.AnimState:PlayAnimation("close") end

    úСң1ԵҼŶ򲻻ֳ۶ĶֲũСңɴ򿪸ӡӷӣ1ӫṩܣ󣬵StartťֲＴʼƣ10ҵ𣩼ɴңջĹʵɡÿֲ1ӫûӫʱҲṤѹʵڸڣStartťӫ10ʵɸʳϡҪСʱôҵɣǵȡƷŶɴ




ˣ.úװ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\trunkvest.luaļinst.AnimState:SetBuild("armor_trunkvest_winter")һвݣ

local function OnDeploy2(inst, pt)
    local extinguisher = SpawnPrefab("trunkvest_winter")
    extinguisher.Transform:SetPosition(pt.x, pt.y, pt.z)
    extinguisher.AnimState:SetBank("firefighter")
    extinguisher.AnimState:SetBuild("firefighter")
    extinguisher.AnimState:PlayAnimation("idle_on_loop")
    extinguisher.Transform:SetScale(0.5, 0.5, 0.5)
    extinguisher:RemoveComponent("inventoryitem")
    extinguisher:RemoveComponent("equippable")
    extinguisher:RemoveComponent("insulator")
    extinguisher:RemoveComponent("fueled")
    extinguisher:RemoveComponent("deployable")
    extinguisher:AddComponent("workable")
    extinguisher.components.workable:SetWorkAction(ACTIONS.HAMMER)
    extinguisher.components.workable:SetWorkLeft(3)
    extinguisher.components.workable:SetOnFinishCallback(function(extinguisher)
        SpawnPrefab("collapse_big").Transform:SetPosition(extinguisher.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        extinguisher:Remove()
    end )
    extinguisher:AddComponent("inventoryitem")
    extinguisher.components.inventoryitem:ChangeImageName("firesuppressor")
    extinguisher:AddComponent("equippable")
    extinguisher.components.equippable.equipslot = EQUIPSLOTS.HANDS
    extinguisher.components.equippable:SetOnEquip(function(extinguisher, owner)
        extinguisher.task = extinguisher:DoPeriodicTask(1, function(extinguisher)
            local waterring = SpawnPrefab("groundpoundring_fx")
            waterring.Transform:SetPosition(owner.Transform:GetWorldPosition())
            waterring.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            local pos = Vector3(extinguisher.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
            for k,v in pairs(ents) do
                if v.components.burnable and v.components.burnable:IsBurning() then
                   if v.prefab == "cactus" or v.prefab == "berrybush" or v.prefab == "berrybush2" or v.prefab == "carrot_planted" or v.prefab == "cave_banana_tree" or v.prefab == "cave_fern" or v.prefab == "deciduoustree" or v.prefab == "deciduoustree_normal" or v.prefab == "deciduoustree_tall" or v.prefab == "deciduoustree_short" or v.prefab == "evergreen" or v.prefab == "evergreen_normal" or v.prefab == "evergreen_tall" or v.prefab == "evergreen_short" or v.prefab == "evergreen_sparse" or v.prefab == "evergreen_sparse_normal" or v.prefab == "evergreen_sparse_tall" or v.prefab == "evergreen_sparse_short" or v.prefab == "flower" or v.prefab == "flower_evil" or v.prefab == "grass" or v.prefab == "marsh_bush" or v.prefab == "red_mushroom" or v.prefab == "green_mushroom" or v.prefab == "blue_mushroom" or v.prefab == "mushtree_tall" or v.prefab == "mushtree_medium" or v.prefab == "mushtree_small" or v.prefab == "sapling" or v.prefab == "flower_cave" or v.prefab == "flower_cave_double" or v.prefab == "flower_cave_triple" or v.prefab == "lichen" or v.prefab == "livingtree" or v.prefab == "marsh_tree" or v.prefab == "reeds" then
                      if v.components.propagator then v.components.propagator.spreading = false end
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      SpawnPrefab(v.prefab).Transform:SetPosition(v.Transform:GetWorldPosition())
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/common/fireOut")
                      v:Remove()
                   end
                   if v.prefab == "treasurechest" or v.prefab == "slow_farmplot" or v.prefab == "fast_farmplot" or v.prefab == "tent" or v.prefab == "wall_wood" or v.prefab == "wall_hay" or v.prefab == "cookpot" or v.prefab == "beebox" or v.prefab == "homesign" or v.prefab == "researchlab" or v.prefab == "researchlab2" or v.prefab == "researchlab3" or v.prefab == "researchlab4" or v.prefab == "meatrack" or v.prefab == "pighouse" or v.prefab == "rabbithouse" or v.prefab == "pottedfern" or v.prefab == "rainometer" or v.prefab == "winterometer" or v.prefab == "resurrectionstatue" or v.prefab == "siestahut" then
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/common/fireOut")
                      v.components.burnable:Extinguish(true)
                   end
                end
            end
        end )
    end )
    extinguisher.components.equippable:SetOnUnequip(function(extinguisher, owner)
        if extinguisher.task then extinguisher.task:Cancel() extinguisher.task = nil end
    end )
    extinguisher:AddTag("extinguishers")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy2
local function onsave2(inst, data)
    if inst:HasTag("extinguishers") then
       data.extinguishers = true
    end
end
local function onload2(inst, data)
  if data and data.extinguishers then
    inst.AnimState:SetBank("firefighter")
    inst.AnimState:SetBuild("firefighter")
    inst.AnimState:PlayAnimation("idle_on_loop")
    inst.Transform:SetScale(0.5, 0.5, 0.5)
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("insulator")
    inst:RemoveComponent("fueled")
    inst:RemoveComponent("deployable")
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:ChangeImageName("firesuppressor")
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
    inst.components.equippable:SetOnEquip(function(inst, owner)
        inst.task = inst:DoPeriodicTask(1, function(inst)
            local waterring = SpawnPrefab("groundpoundring_fx")
            waterring.Transform:SetPosition(owner.Transform:GetWorldPosition())
            waterring.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            local pos = Vector3(inst.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
            for k,v in pairs(ents) do
                if v.components.burnable and v.components.burnable:IsBurning() then
                   if v.prefab == "cactus" or v.prefab == "berrybush" or v.prefab == "berrybush2" or v.prefab == "carrot_planted" or v.prefab == "cave_banana_tree" or v.prefab == "cave_fern" or v.prefab == "deciduoustree" or v.prefab == "deciduoustree_normal" or v.prefab == "deciduoustree_tall" or v.prefab == "deciduoustree_short" or v.prefab == "evergreen" or v.prefab == "evergreen_normal" or v.prefab == "evergreen_tall" or v.prefab == "evergreen_short" or v.prefab == "evergreen_sparse" or v.prefab == "evergreen_sparse_normal" or v.prefab == "evergreen_sparse_tall" or v.prefab == "evergreen_sparse_short" or v.prefab == "flower" or v.prefab == "flower_evil" or v.prefab == "grass" or v.prefab == "marsh_bush" or v.prefab == "red_mushroom" or v.prefab == "green_mushroom" or v.prefab == "blue_mushroom" or v.prefab == "mushtree_tall" or v.prefab == "mushtree_medium" or v.prefab == "mushtree_small" or v.prefab == "sapling" or v.prefab == "flower_cave" or v.prefab == "flower_cave_double" or v.prefab == "flower_cave_triple" or v.prefab == "lichen" or v.prefab == "livingtree" or v.prefab == "marsh_tree" or v.prefab == "reeds" then
                      if v.components.propagator then v.components.propagator.spreading = false end
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      SpawnPrefab(v.prefab).Transform:SetPosition(v.Transform:GetWorldPosition())
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/common/fireOut")
                      v:Remove()
                   end
                   if v.prefab == "treasurechest" or v.prefab == "slow_farmplot" or v.prefab == "fast_farmplot" or v.prefab == "tent" or v.prefab == "wall_wood" or v.prefab == "wall_hay" or v.prefab == "cookpot" or v.prefab == "beebox" or v.prefab == "homesign" or v.prefab == "researchlab" or v.prefab == "researchlab2" or v.prefab == "researchlab3" or v.prefab == "researchlab4" or v.prefab == "meatrack" or v.prefab == "pighouse" or v.prefab == "rabbithouse" or v.prefab == "pottedfern" or v.prefab == "rainometer" or v.prefab == "winterometer" or v.prefab == "resurrectionstatue" or v.prefab == "siestahut" then
                      SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/common/fireOut")
                      v.components.burnable:Extinguish(true)
                   end
                end
            end
        end )
    end )
    inst.components.equippable:SetOnUnequip(function(inst, owner)
        if inst.task then inst.task:Cancel() inst.task = nil end
    end )
    inst:AddTag("extinguishers")
  end
end
    inst.OnSave = onsave2
    inst.OnLoad = onload2

    úװⴵǿŻĽֲԶȼյĻز޲ߡҪˣôҵɡձڴѡñӣ£1ɫǡ8˿졢2ţë




һ.г÷ũƷ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rabbithouse.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" or item.prefab == "goldnugget" then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" then
       local goldnugget = SpawnPrefab("goldnugget")
       giver.components.inventory:GiveItem(goldnugget)
    end
    if item.prefab == "goldnugget" then
       local names = {"cave_banana","carrot","corn","pumpkin","eggplant","durian","pomegranate","dragonfruit","berries","cactus_meat","watermelon","acorn"}
       local name = names[math.random(#names)]
       local veggie = SpawnPrefab(name)
       giver.components.inventory:GiveItem(veggie)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ɽֳũƷ÷ũƷ÷1ƽ𣬻ƽԶ˻ƷҲԸ÷ƽƷֵũƷũƷ㽶ܲӡϹϡסʯ񡢻⡢ϡ




˶.ʳࣩ꣨

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pighouse.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" or item.prefab == "goldnugget" then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" then
       local goldnugget = SpawnPrefab("goldnugget")
       giver.components.inventory:GiveItem(goldnugget)
    end
    if item.prefab == "goldnugget" then
       local names = {"meat","smallmeat","fish","eel","drumstick","bird_egg","froglegs","monstermeat"}
       local name = names[math.random(#names)]
       local meat = SpawnPrefab(name)
       giver.components.inventory:GiveItem(meat)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ɽ1ƽ𣬻ƽԶ˻ƷҲԸƽƷֵ࣬⡢С⡢㡢㡢ȡ񵰡ȡ




.̷塢ôڵ̯

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pigman.luaļlocal function OnEat(inst, food)һвݣ

    if food.components.edible and food.components.edible.foodtype == "MEAT" then
       for k = 1, 2 do
           local gold = SpawnPrefab("goldnugget")
           gold.Transform:SetPosition(inst.Transform:GetWorldPosition())		
	end
    end


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bunnyman.luaļinst:AddComponent("eater")һвݣ

local function OnEat(inst, food)
    if food.components.edible and food.components.edible.foodtype == "VEGGIE" then
       for k = 1, 2 do
           local gold = SpawnPrefab("goldnugget")
           gold.Transform:SetPosition(inst.Transform:GetWorldPosition())		
	end
    end
end
    inst.components.eater:SetOnEatFn(OnEat)

    彫ࣨ㡢ȵȣڵϣô彫߲ˣũƷ㽶ȣڵϣǻԶÿ߲˸2ƽڵϣͼû壨ϣô壨һ㣩Լ÷γ




.ӻչУñӡӵӻ񻻻ƽ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rope.luaļinst:AddComponent("inspectable")һвinst:AddComponent("tradable")


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\boards.luaļinst:AddComponent("inspectable")һвinst:AddComponent("tradable")


    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cutstone.luaļinst:AddComponent("inspectable")һвinst:AddComponent("tradable")


    4.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tent.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if item:HasTag("hat") then
       return true
    end
    if item:HasTag("preparedfood") and item.prefab ~= "wetgoop" then
       return true
    end
    if item.prefab == "rope" or item.prefab == "boards" or item.prefab == "cutstone" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "manrabbit_tail" or item.prefab == "pigskin" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "slurper_pelt" or item.prefab == "wormlight" then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item:HasTag("hat") then
       for k = 1, 3 do
           local goldnugget = SpawnPrefab("goldnugget")
           giver.components.inventory:GiveItem(goldnugget)
       end
    end
    if item:HasTag("preparedfood") and item.prefab ~= "wetgoop" then
       for k = 1, 5 do
           local goldnugget = SpawnPrefab("goldnugget")
           giver.components.inventory:GiveItem(goldnugget)
       end
    end
    if item.prefab == "rope" or item.prefab == "boards" or item.prefab == "cutstone" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "manrabbit_tail" or item.prefab == "pigskin" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "slurper_pelt" or item.prefab == "wormlight" then
       local goldnugget = SpawnPrefab("goldnugget")
       giver.components.inventory:GiveItem(goldnugget)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ɽӻ񻻻ƽƷչ5ƽñ3ƽӡľ塢ʯשҶӡۡӫβ͡ƤꡢجλꡢʳƤӹ1ƽ




.ղƷУ˷ղƷ׬ۣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\mermhouse.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if GetPlayer().components.inventory:Has("goldnugget", 4) then
       if item.prefab == "goldnugget" then
          return true
       end
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    local names = {"trinket_1","trinket_2","trinket_3","trinket_4","trinket_5","trinket_6","trinket_7","trinket_8","trinket_9","trinket_10","trinket_11","trinket_12"}
    inst.name = names[math.random(#names)]
    local trinket = SpawnPrefab(inst.name)
    if item.prefab == "goldnugget" then
       giver.components.inventory:ConsumeByName("goldnugget", 3)
       giver.components.inventory:GiveItem(trinket)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ˷ûƽղƷŻƽ˷4ƽ1ƷղƷֱװƷõղƷ2-8ƽڵϣ˯ʱύסнһգ⵽åˣЩղƷǮϻƽ4ʱ޷




.ղƷڻгڻгѡղƷ

    1.ü±ϷĿ¼\data\DLC0001\scripts\constants.luaļDRESS = {str = "DRESS", sort=9, icon = "tab_dress.tex"},һвMARKET = {str = "MARKET", sort = 12, icon = "tab_book.tex"},


    2.ü±ϷĿ¼\data\scripts\strings.luaļANCIENT = "Ancient",һвMARKET = "Market",


    3.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļrequire "tuning"һвݣ

----MARKET----
Recipe("trinket_1", {Ingredient("goldnugget", math.random(4,8))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_2", {Ingredient("goldnugget", math.random(6,12))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_3", {Ingredient("goldnugget", math.random(4,8))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_4", {Ingredient("goldnugget", math.random(5,10))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_5", {Ingredient("goldnugget", math.random(4,8))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_6", {Ingredient("goldnugget", math.random(5,10))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_7", {Ingredient("goldnugget", math.random(4,8))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_8", {Ingredient("goldnugget", math.random(8,16))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_9", {Ingredient("goldnugget", math.random(7,14))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_10", {Ingredient("goldnugget", math.random(2,4))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_11", {Ingredient("goldnugget", math.random(5,10))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)
Recipe("trinket_12", {Ingredient("goldnugget", math.random(8,16))}, RECIPETABS.MARKET, TECH.NONE,nil,nil,true)


    4.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\trinkets.luaļinst:AddComponent("inspectable")һвinst:AddTag("trinket")


    5.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\scienceprototyper.luaļinst:AddComponent("inspectable")һвݣ

local function SpawnLootPrefab(inst, lootprefab)
    local player = GetPlayer()
    local loot = SpawnPrefab(lootprefab)
    player.components.inventory:GiveItem(loot)
    return loot
end
local function ShouldAcceptItem(inst, item)
    if item:HasTag("trinket") then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    local recipe = GetRecipe(item.prefab)
    local loot = {}
    if item:HasTag("trinket") then 
        for k,v in ipairs(recipe.ingredients) do
            if not string.find(v.type, "gem") then
                local amt = math.ceil(v.amount * 1)
                for n = 1, amt do
                    table.insert(loot, v.type)
                end
            end
        end
    end
    if #loot <= 0 then
        return
    end
    for k,v in pairs(loot) do
        SpawnLootPrefab(item, v)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ղƷڻť3飩ղƷ۸ÿζı䣬ڵͼʱ루ֱӴ룩ڸ߼ʱղƷԿѧõʱ۵ĻƽԶװƷӶ׬ȡۡͬʱ޸ˡֶ浵ٶ޸ļɣͿڲ˳Ϸ£F5浵ٰF6ˢ¼۸񡣱롰ղƷСͬʱ޸




.ͳУ̵ѡûƽƷ

    1.ü±ϷĿ¼\data\DLC0001\scripts\constants.luaļANCIENT = {str = "ANCIENT", sort = 10, icon = "tab_crafting_table.tex"}滻Ϊݣ

    ANCIENT = {str = "ANCIENT", sort = 10, icon = "tab_crafting_table.tex"},
    SHOP = {str = "SHOP", sort = 11, icon = "tab_gemology.tex"}


    2.ü±ϷĿ¼\data\scripts\strings.luaļANCIENT = "Ancient",һвSHOP = "Shop",


    3.ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļ----GEMS----һвݣ

----SHOP----
Recipe("nightmarefuel", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("livinglog", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("gears", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("marble", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("petals_evil", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("boneshard", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("ice", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("slurtle_shellpieces", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("pigskin", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("silk", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("spidergland", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("tentaclespots", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("tentaclespike", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("feather_crow", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("feather_robin", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("feather_robin_winter", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("stinger", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("honeycomb", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("butterflywings", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("houndstooth", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("horn", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("tallbirdegg", {Ingredient("goldnugget", 1+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("manrabbit_tail", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("slurper_pelt", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("lightninggoathorn", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("batwing", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("trunk_summer", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("trunk_winter", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("walrus_tusk", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("deerclops_eyeball", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("minotaurhorn", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("dragon_scales", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("bearger_fur", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("goose_feather", {Ingredient("goldnugget", 1+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("coontail", {Ingredient("goldnugget", 1+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("poop", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("beardhair", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("mandrake", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("lightbulb", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("cactus_meat", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("cactus_flower", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("wormlight", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("lureplantbulb", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("fireflies", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("redgem", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("bluegem", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("orangegem", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("yellowgem", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("greengem", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("thulecite_pieces", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("red_cap", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("green_cap", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("blue_cap", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("monstermeat", {Ingredient("goldnugget", math.random(2))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("honey", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("butter", {Ingredient("goldnugget", math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("butterflymuffin", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("frogglebunwich", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("taffy", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("pumpkincookie", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("stuffedeggplant", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("fishsticks", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("honeynuggets", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("honeyham", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("dragonpie", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("kabobs", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("mandrakesoup", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("baconeggs", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("meatballs", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("bonestew", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("perogies", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("turkeydinner", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("ratatouille", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("jammypreserves", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("fruitmedley", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("fishtacos", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("waffles", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("unagi", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("flowersalad", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("icecream", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("watermelonicle", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("trailmix", {Ingredient("goldnugget", 4+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("hotchili", {Ingredient("goldnugget", 5+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("guacamole", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("krampus_sack", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("slurtlehat", {Ingredient("goldnugget", 3+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)
Recipe("armorsnurtleshell", {Ingredient("goldnugget", 8+math.random(3))}, RECIPETABS.SHOP, TECH.NONE,nil,nil,true)

    ̵ѡ»űʯָûƽƷ˹ϡȡÿζ󣬳м۸񶼻һôʱһЩɡͬʱ޸ˡгʳꡱ̷ӻչСղƷСղƷڻг޸ļɣͨũƷࡢӻղƷȡĻƽγɼĽǮϵҪ롰쿲˹һͬ޸




˰.ι֣·ƻƽιֲƱд󽱣

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\homesign.luaļinst:AddComponent("inspectable")һвݣ

local function ShouldAcceptItem(inst, item)
    if item.prefab == "goldnugget" then
       return true
    end
    return false
end
local function OnGetItemFromPlayer(inst, giver, item)
    if item.prefab == "goldnugget" then
       local papyrus = SpawnPrefab("papyrus")
       papyrus:AddComponent("lootdropper")
       papyrus.components.inspectable.getstatus = function(papyrus)
           if math.random()<.01 then
               for k = 1, 50 do
               papyrus.components.lootdropper:SpawnLootPrefab("goldnugget")
           end
           elseif math.random()<.05 then
               for k = 1, 10 do
               papyrus.components.lootdropper:SpawnLootPrefab("goldnugget")
           end
           elseif math.random()<.15 then
               for k = 1, 2 do
               papyrus.components.lootdropper:SpawnLootPrefab("goldnugget")
           end
           elseif math.random()<.3 then
               papyrus.components.lootdropper:SpawnLootPrefab("goldnugget")
           else
               papyrus.components.lootdropper:SpawnLootPrefab("ash")
           end
           SpawnPrefab("collapse_small").Transform:SetPosition(papyrus.Transform:GetWorldPosition())
           papyrus.components.stackable:Get():Remove()
       end
       giver.components.inventory:GiveItem(papyrus)
    end
end
    inst:AddComponent("trader")
    inst.components.trader.onaccept = OnGetItemFromPlayer
    inst.components.trader:SetAcceptTest(ShouldAcceptItem)

    ɸ·ƻƽιֲƱûƽ·ưƱ1ֱֽװƷƷеֽҼɹνһȽ50ƽ𣬶Ƚ10ƽȽ2ƽĵȽ1ƽĩȽֻһŻҡ浵˳ʱϲҪƱΪٶϣٹν




˾.ԶȡûľͷԶȡĻƽÿ3%Ϣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\livinglog.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "goldnugget" then
       return true
    end
    return false
end
local slotpos = {}
for y = 2, 0, -1 do
    for x = 0, 8 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
local function OnDeploy (inst, pt)
    local bank = SpawnPrefab("livinglog")
    bank.Transform:SetPosition(pt.x, pt.y, pt.z)
    bank.Transform:SetScale(1.5, 1.5, 1.5)
    bank.AnimState:SetBank("ruins_vase")
    bank.AnimState:SetBuild("ruins_vase")
    bank.AnimState:PlayAnimation("idle")
    bank:RemoveComponent("stackable")
    bank:RemoveComponent("fuel")
    bank:RemoveComponent("edible")
    bank:RemoveComponent("inventoryitem")
    bank:RemoveComponent("repairer")
    bank:RemoveComponent("burnable")
    bank:RemoveComponent("propagator")
    bank:RemoveComponent("deployable")
    bank.components.container.canbeopened = true
    bank:AddComponent("workable")
    bank.components.workable:SetWorkAction(ACTIONS.HAMMER)
    bank.components.workable:SetWorkLeft(3)
    bank.components.workable:SetOnFinishCallback(function(bank)
        SpawnPrefab("collapse_big").Transform:SetPosition(bank.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        bank:Remove()
    end )
    bank:ListenForEvent( "daytime", function()
        local num_found = 0
        for k,v in pairs(bank.components.container.slots) do
            if v and v.prefab == "goldnugget" then
               num_found = num_found + v.components.stackable:StackSize()
            end
        end
        local Interests = math.floor(num_found/100*3)
        for k = 1, Interests do
            bank.components.container:ConsumeByName("goldnugget", -1)
        end
    end, GetWorld())
    bank:AddTag("banks")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("banks") then
        data.banks = true
    end
end
local function onload(inst, data)
  if data and data.banks then
    inst.Transform:SetScale(1.5, 1.5, 1.5)
    inst.AnimState:SetBank("ruins_vase")
    inst.AnimState:SetBuild("ruins_vase")
    inst.AnimState:PlayAnimation("idle")
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("repairer")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:ListenForEvent( "daytime", function()
        local num_found = 0
        for k,v in pairs(inst.components.container.slots) do
            if v and v.prefab == "goldnugget" then
               num_found = num_found + v.components.stackable:StackSize()
            end
        end
        local Interests = math.floor(num_found/100*3)
        for k = 1, Interests do
            inst.components.container:ConsumeByName("goldnugget", -1)
        end
    end, GetWorld())
    inst:AddTag("banks")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-100,200,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.itemtestfn = itemtest

    ûľͷԶȡ򿪸ӣٵرգֻڴȡƽ𡣽ƽȡÿʱ3%Ϣ1ƽͷԶĨȥ90ƽϢΪ2.7ֻ2ƽ𣩡ǣǼṩĽڷ񣬽޿ȥųϢɡҪԶȡˣôҵɣס֮ǰǮȡŶ




ţ.ߵĶľ֣˹ǣûƽעȭս

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rope.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local skeleton = SpawnPrefab("skeleton")
    if skeleton then
        skeleton:PushEvent("growfromrope")
		skeleton.Transform:SetPosition(pt.x, pt.y, pt.z)
        inst.components.stackable:Get():Remove()
    end
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\skeleton.luaļinst:AddComponent("inspectable")һвݣ

local function game(inst)
    local light = inst.entity:AddLight()
    light:Enable(true)
    local num_found = 0
    for k,v in pairs(inst.components.container.slots) do
        if v and v.prefab == "goldnugget" then
           num_found = num_found + v.components.stackable:StackSize()
        end
    end
    inst.components.container:Close(GetPlayer())
    inst.components.container.canbeopened = false
    GetPlayer().components.playercontroller:Enable(false)
    local bonuspoint1 = math.random(5)
    local bonuspoint2 = math.random(5)
    local pt = Vector3(inst.Transform:GetWorldPosition())
    local red = SpawnPrefab("pigman")
    red.Transform:SetPosition(pt.x+4+3, 0, pt.z+4-3)
    red.components.health:SetMaxHealth(100 * bonuspoint1)
    red.components.health:DoDelta(200 * bonuspoint1)
    red.AnimState:SetMultColour(255/255,0/255,0/255,1)
    red.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat")
    red.AnimState:Show("hat")
    local blue = SpawnPrefab("pigman")
    blue.Transform:SetPosition(pt.x+4-3, 0, pt.z+4+3)
    blue.components.health:SetMaxHealth(100 * bonuspoint2)
    blue.components.health:DoDelta(200 * bonuspoint2)
    blue.AnimState:SetMultColour(0/255,100/255,255/255,1)
    blue.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat")
    blue.AnimState:Show("hat")
    red.components.combat.target = blue
    blue.components.combat.target = red
    TheCamera:SetTarget(red)
    red:ListenForEvent("death", function()
        inst:DoTaskInTime(3, function() blue:Remove()
           GetPlayer().components.sanity:DoDelta(-10)
           GetPlayer().AnimState:PlayAnimation("hit")
           GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
           inst.components.container:DestroyContents()
           inst.components.container.canbeopened = true
           GetPlayer().components.playercontroller:Enable(true)
           TheCamera:SetTarget(GetPlayer())
           light:Enable(false)
        end )
    end )
    blue:ListenForEvent("death", function()
        inst:DoTaskInTime(3, function() red:Remove()
           GetPlayer().components.sanity:DoDelta(10)
           for k = 1, num_found do
               inst.components.container:ConsumeByName("goldnugget", -1)
           end
           GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
           inst.components.container.canbeopened = true
           GetPlayer().components.playercontroller:Enable(true)
           TheCamera:SetTarget(GetPlayer())
           light:Enable(false)
        end )
    end )
end
local slotpos = { Vector3(0,-75,0)}
local widgetbuttoninfo = { text = "GO",
      position = Vector3(0, -165, 0),
      fn = function(inst) if not inst.components.container:IsEmpty() then game(inst) end
end }
local function itemtest(inst, item, slot)
    if item.prefab == "goldnugget" then
       return true
    end
    return false
end
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,200,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    local light = inst.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(50)
    light:Enable(false)
    light:SetColour(180/255, 195/255, 50/255)
    MakeMediumBurnable(inst)

    ˹ͷ˹ǣ1ӼGOťڸзƽ󣨶Ľ⣩GOť졢ȭֳս췽ʤӮ1˹ǵĸȡ10ԡʤĶĽ𽫱ߣ߻ʤͬʱ10ԡƽ֣˫ͬʱжΪ߻ʤ޷߶ֹףԱ߳Զ߿˹Զ÷ĿտűҪ˹ˣյɡߵĶľȫ쿪ţҪԶĲŶ




һ.Сƹݣ굶Сƹݣ֡վơСһ£

    ü±ϷĿ¼\data\scripts\prefabs\razor.luaļinst:AddComponent("inspectable")һвݣ

local function bar(inst)
    local pt = inst:GetPosition()
    local waiter = SpawnPrefab("razor")
    waiter.Transform:SetPosition(pt.x, pt.y, pt.z)
    waiter.AnimState:SetBank("wilson")
    waiter.AnimState:SetBuild("wes")
    waiter.AnimState:Hide("ARM_carry")
    waiter.AnimState:Show("ARM_normal")
    waiter.Transform:SetFourFaced()
    waiter.AnimState:PlayAnimation("idle")
    waiter:AddTag("waiter")
    waiter:RemoveComponent("inventoryitem")
    waiter:RemoveComponent("shaver")
    waiter:RemoveComponent("deployable")
    waiter:AddComponent("trader")
    waiter.components.trader:SetAcceptTest(function(waiter, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 1) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    waiter.components.trader.onaccept = function(waiter, giver, item)
        waiter.AnimState:PlayAnimation("idle_onemanband1_loop",true)
        waiter:DoTaskInTime(5, function() waiter.AnimState:PlayAnimation("idle") end )
        GetPlayer().components.sanity:DoDelta(3)
    end
    local bar = SpawnPrefab("razor")
    bar.Transform:SetPosition(pt.x+0.8, 0, pt.z+0.8)
    bar.AnimState:SetBank("ruins_table")
    bar.AnimState:SetBuild("ruins_table")
    bar.AnimState:PlayAnimation("idle")
    bar:AddTag("goodbye")
    bar:RemoveComponent("inventoryitem")
    bar:RemoveComponent("shaver")
    bar:RemoveComponent("deployable")
    bar:AddComponent("trader")
    bar.components.trader:SetAcceptTest(function(bar, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    bar.components.trader.onaccept = function(bar, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        waiter.AnimState:PlayAnimation("give")
        local wine = SpawnPrefab("razor")
        wine.AnimState:SetBank("ruins_vase")
        wine.AnimState:SetBuild("ruins_vase")
        wine.AnimState:PlayAnimation("idle")
        wine.Transform:SetScale(0.5, 0.5, 0.5)
        wine.Physics:SetActive(false)
        wine:AddTag("goodbye")
        wine.components.inventoryitem.canbepickedup = false
        local follower = wine.entity:AddFollower()
        follower:FollowSymbol( bar.GUID, "swap_object", -100, -170, 0 )
        wine.components.inspectable.getstatus = function(wine)
            wine:Remove()
            wine = nil
            GetPlayer().sg:GoToState("eat")
            GetPlayer().components.sanity:DoDelta(-5)
            GetPlayer().components.health:DoDelta(20)
        end
    end
    local icebox = SpawnPrefab("razor")
    icebox.Transform:SetPosition(pt.x-1.6+0.8, 0, pt.z+1.6+0.8)
    icebox.AnimState:SetBank("icebox")
    icebox.AnimState:SetBuild("ice_box")
    icebox.AnimState:PlayAnimation("closed")
    icebox.AnimState:SetMultColour(255/255,255/255,255/255,1)
    icebox:AddTag("goodbye")
    icebox:RemoveComponent("inventoryitem")
    icebox:RemoveComponent("shaver")
    icebox:RemoveComponent("deployable")
    icebox:AddComponent("trader")
    icebox.components.trader:SetAcceptTest(function(icebox, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    icebox.components.trader.onaccept = function(icebox, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        waiter.AnimState:PlayAnimation("give")
        local names = {"butterflymuffin","frogglebunwich","taffy","pumpkincookie","stuffedeggplant","fishsticks","honeynuggets","honeyham","dragonpie","kabobs","mandrakesoup","baconeggs","meatballs","bonestew","perogies","turkeydinner","ratatouille","jammypreserves","fruitmedley","fishtacos","waffles","unagi","flowersalad","icecream","watermelonicle","trailmix","hotchili","guacamole"}
        local name = names[math.random(#names)]
        local snack = SpawnPrefab(name)
        giver.components.inventory:GiveItem(snack)
    end
    local chair = SpawnPrefab("razor")
    chair.Transform:SetPosition(pt.x+1.5+0.8, 0, pt.z-1.5+0.8)
    chair.AnimState:SetBank("ruins_chair")
    chair.AnimState:SetBuild("ruins_chair")
    chair.AnimState:PlayAnimation("idle")
    chair:AddTag("goodbye")
    chair:RemoveComponent("inventoryitem")
    chair:RemoveComponent("shaver")
    chair:RemoveComponent("deployable")
    chair.components.inspectable.getstatus = function()
        TheFrontEnd:Fade(true,1)
        GetClock():NextPhase()
        GetPlayer().components.hunger:DoDelta(-10)
        GetPlayer().components.sanity:DoDelta(25)
    end
    local music = SpawnPrefab("razor")
    music.Transform:SetPosition(pt.x+1.5-0.8, 0, pt.z-1.5-0.8)
    music.AnimState:SetBank("phonograph")
    music.AnimState:SetBuild("phonograph")
    music.AnimState:PlayAnimation("idle")
    music:AddTag("goodbye")
    music:RemoveComponent("inventoryitem")
    music:RemoveComponent("shaver")
    music:RemoveComponent("deployable")
    music.entity:AddSoundEmitter()
    music:AddComponent("machine")
    music.components.machine.turnonfn = function(music)
        music.AnimState:PlayAnimation("play_loop", true)
        music.SoundEmitter:PlaySound("dontstarve/maxwell/ragtime", "ragtime")
    end
    music.components.machine.turnofffn = function(music)
        music.AnimState:PlayAnimation("idle")
        music.SoundEmitter:KillSound("ragtime")
        music.SoundEmitter:PlaySound("dontstarve/music/gramaphone_end")
    end
    music.components.machine:TurnOff()
    local pot = SpawnPrefab("razor")
    pot.Transform:SetPosition(pt.x-1.5-1.1, 0, pt.z+1.5-1.1)
    pot.AnimState:SetBank("cook_pot")
    pot.AnimState:SetBuild("cook_pot")
    pot.Transform:SetScale(0.8, 0.8, 0.8)
    pot.AnimState:PlayAnimation("cooking_loop", true)
    pot:AddTag("goodbye")
    pot:RemoveComponent("inventoryitem")
    pot:RemoveComponent("shaver")
    pot:RemoveComponent("deployable")
    pot.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    local light = pot.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
end
local function OnDeploy (inst, pt)
    bar(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("waiter") then
        data.waiter = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.waiter then
       bar(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)

    굶Сƹݣ5ƽŻƽӵԱΪ1ƿվƣϵľƿɺȵ20Ѫ5ԣȶ˻ͷΣ5ƽ𣬿ԹֱӷƷƹݵķ񣬿Ա֧СѣŻƽԷԱÿ1ƽ𣬲3ԡϢһ£ӣʱһʱΣ25ԣ10㼢ҼԿ֡ʱů͡ҪСƹʱյɡ굶ڹѡŸӺ͸䣩£2֦2ʯ




Ŷ.Ұȭĳûȶ̹ҰȭĳׯʯͷӮ

    ü±ϷĿ¼\data\scripts\prefabs\hambat.luaļ

    1.Asset("ANIM", "anim/swap_ham_bat.zip"),һвݣ

    Asset("ANIM", "anim/wolfgang.zip"),
    Asset("ANIM", "anim/wolfgang_skinny.zip"),
    Asset("ANIM", "anim/wolfgang_mighty.zip"),
    Asset("ANIM", "anim/player_wolfgang.zip"),


    2.inst.OnLoad = OnLoad滻Ϊݣ

local function game(inst)
    local pt = inst:GetPosition()
    local makers = SpawnPrefab("hambat")
    makers.Transform:SetPosition(pt.x, pt.y, pt.z)
    makers.AnimState:SetBank("wilson")
    makers.AnimState:SetBuild("wolfgang")
    makers.AnimState:Hide("ARM_carry")
    makers.AnimState:Show("ARM_normal")
    makers.Transform:SetFourFaced()
    makers.AnimState:PlayAnimation("idle")
    makers:RemoveComponent("weapon")
    makers:RemoveComponent("edible")
    makers:RemoveComponent("perishable")
    makers:RemoveComponent("inventoryitem")
    makers:RemoveComponent("equippable")
    makers:RemoveTag("show_spoilage")
    makers:AddTag("makers")
    local light = makers.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    local chest1 = SpawnPrefab("hambat")
    chest1.Transform:SetPosition(pt.x-1+2, pt.y, pt.z-1-2)
    chest1.AnimState:SetBank("pandoras_chest_large")
    chest1.AnimState:SetBuild("pandoras_chest_large")
    chest1.AnimState:PlayAnimation("closed")
    chest1.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    chest1:RemoveComponent("weapon")
    chest1:RemoveComponent("edible")
    chest1:RemoveComponent("perishable")
    chest1:RemoveComponent("inventoryitem")
    chest1:RemoveComponent("equippable")
    chest1:RemoveTag("show_spoilage")
    chest1:AddTag("goodbye")
    local chest2 = SpawnPrefab("hambat")
    chest2.Transform:SetPosition(pt.x-1-2, pt.y, pt.z-1+2)
    chest2.AnimState:SetBank("pandoras_chest_large")
    chest2.AnimState:SetBuild("pandoras_chest_large")
    chest2.AnimState:PlayAnimation("closed")
    chest2.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    chest2:RemoveComponent("weapon")
    chest2:RemoveComponent("edible")
    chest2:RemoveComponent("perishable")
    chest2:RemoveComponent("inventoryitem")
    chest2:RemoveComponent("equippable")
    chest2:RemoveTag("show_spoilage")
    chest2:AddTag("goodbye")
    local carpet = SpawnPrefab("hambat")
    carpet.Transform:SetPosition(pt.x+2.5, 0, pt.z+2.5)
    carpet.AnimState:SetBuild("staff_purple_base_ground")
    carpet.AnimState:SetBank("staff_purple_base_ground")
    carpet.AnimState:PlayAnimation("idle")
    carpet.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    carpet.AnimState:SetLayer( LAYER_BACKGROUND )
    carpet.AnimState:SetSortOrder( 3 )
    carpet.Transform:SetRotation( 45 )
    carpet.AnimState:SetMultColour(255/255,0/255,0/255,1)
    carpet.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    carpet:RemoveComponent("weapon")
    carpet:RemoveComponent("edible")
    carpet:RemoveComponent("perishable")
    carpet:RemoveComponent("inventoryitem")
    carpet:RemoveComponent("equippable")
    carpet:RemoveTag("show_spoilage")
    carpet:AddTag("goodbye")
    carpet:AddComponent("trader")
    carpet.components.trader:SetAcceptTest(function(carpet, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 11) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    carpet.components.trader.onaccept = function(carpet, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        makers.AnimState:PlayAnimation("give")
        local gold = SpawnPrefab("hambat")
        gold.Transform:SetPosition(pt.x+2.5, 0, pt.z+2.5)
        gold.AnimState:SetBank("goldnugget")
        gold.AnimState:SetBuild("gold_nugget")
        gold.AnimState:PlayAnimation("idle")
        gold.AnimState:PlayAnimation("sparkle")
        gold.AnimState:PushAnimation("idle")
        gold:RemoveComponent("weapon")
        gold:RemoveComponent("edible")
        gold:RemoveComponent("perishable")
        gold:RemoveComponent("inventoryitem")
        gold:RemoveComponent("equippable")
        gold:RemoveTag("show_spoilage")
        gold:AddTag("goodbye")
        local rock = SpawnPrefab("hambat")
        rock.Transform:SetPosition(pt.x+4+1.8, 0, pt.z+4-1.8)
        rock.AnimState:SetBank("rocks")
        rock.AnimState:SetBuild("rocks")
        rock.AnimState:PlayAnimation("f1")
        rock:RemoveComponent("weapon")
        rock:RemoveComponent("edible")
        rock:RemoveComponent("perishable")
        rock:RemoveComponent("inventoryitem")
        rock:RemoveComponent("equippable")
        rock:RemoveTag("show_spoilage")
        rock:AddTag("goodbye")
        rock.Transform:SetScale(1.2, 1.2, 1.2)
        rock.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        local shears = SpawnPrefab("hambat")
        shears.Transform:SetPosition(pt.x+4, 0, pt.z+4)
        shears.AnimState:SetBank("razor")
        shears.AnimState:SetBuild("razor")
        shears.AnimState:PlayAnimation("idle")
        shears:RemoveComponent("weapon")
        shears:RemoveComponent("edible")
        shears:RemoveComponent("perishable")
        shears:RemoveComponent("inventoryitem")
        shears:RemoveComponent("equippable")
        shears:RemoveTag("show_spoilage")
        shears:AddTag("goodbye")
        shears.Transform:SetScale(1.2, 1.2, 1.2)
        shears.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        local colth = SpawnPrefab("hambat")
        colth.Transform:SetPosition(pt.x+3.8-1.9, 0, pt.z+3.8+1.9)
        colth.AnimState:SetBank("blueprint")
        colth.AnimState:SetBuild("blueprint")
        colth.AnimState:PlayAnimation("idle")
        colth:RemoveComponent("weapon")
        colth:RemoveComponent("edible")
        colth:RemoveComponent("perishable")
        colth:RemoveComponent("inventoryitem")
        colth:RemoveComponent("equippable")
        colth:RemoveTag("show_spoilage")
        colth:AddTag("goodbye")
        colth.Transform:SetScale(1.2, 1.2, 1.2)
        colth.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        local names = {"rocks","razor","blueprint"}
        local goldnugget = SpawnPrefab("goldnugget")
        rock.components.inspectable.getstatus = function(rock)
            makers.AnimState:PlayAnimation("give")
            local name = names[math.random(#names)]
            local fist = SpawnPrefab(name)
            fist.Transform:SetPosition(pt.x+0.7, 0, pt.z+0.7)
            fist:AddTag("goodbye")
            fist.Transform:SetScale(1.2, 1.2, 1.2)
            fist.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            fist.components.inventoryitem.canbepickedup = false
            shears:Remove() colth:Remove()
            GetPlayer():DoTaskInTime(3, function() rock:Remove() fist:Remove() gold:Remove() end )
            if fist.prefab == "rocks" then
               makers.AnimState:SetBuild("wolfgang")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 10 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                  end
               end )
            end
            if fist.prefab == "razor" then
               makers.AnimState:SetBuild("wolfgang_skinny")
               makers.AnimState:PlayAnimation("hit")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 20 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  end
               end )
            end
            if fist.prefab == "blueprint" then
               makers.AnimState:SetBuild("wolfgang_mighty")
               makers.AnimState:PlayAnimation("idle_onemanband1_loop",true)
               GetPlayer():DoTaskInTime(3, function() 
                  makers.AnimState:PlayAnimation("idle")
                  SpawnPrefab("collapse_small").Transform:SetPosition(pt.x+2.5, 0, pt.z+2.5)
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
               end )
            end
        end
        shears.components.inspectable.getstatus = function(shears)
            makers.AnimState:PlayAnimation("give")
            local name = names[math.random(#names)]
            local fist = SpawnPrefab(name)
            fist.Transform:SetPosition(pt.x+0.7, 0, pt.z+0.7)
            fist:AddTag("goodbye")
            fist.Transform:SetScale(1.2, 1.2, 1.2)
            fist.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            fist.components.inventoryitem.canbepickedup = false
            rock:Remove() colth:Remove()
            GetPlayer():DoTaskInTime(3, function() shears:Remove() fist:Remove() gold:Remove() end )
            if fist.prefab == "razor" then
               makers.AnimState:SetBuild("wolfgang")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 10 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                  end
               end )
            end
            if fist.prefab == "blueprint" then
               makers.AnimState:SetBuild("wolfgang_skinny")
               makers.AnimState:PlayAnimation("hit")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 20 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  end
               end )
            end
            if fist.prefab == "rocks" then
               makers.AnimState:SetBuild("wolfgang_mighty")
               makers.AnimState:PlayAnimation("idle_onemanband1_loop",true)
               GetPlayer():DoTaskInTime(3, function() 
                  makers.AnimState:PlayAnimation("idle")
                  SpawnPrefab("collapse_small").Transform:SetPosition(pt.x+2.5, 0, pt.z+2.5)
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
               end )
            end
        end
        colth.components.inspectable.getstatus = function(colth)
            makers.AnimState:PlayAnimation("give")
            local name = names[math.random(#names)]
            local fist = SpawnPrefab(name)
            fist.Transform:SetPosition(pt.x+0.7, 0, pt.z+0.7)
            fist:AddTag("goodbye")
            fist.Transform:SetScale(1.2, 1.2, 1.2)
            fist.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            fist.components.inventoryitem.canbepickedup = false
            shears:Remove() rock:Remove()
            GetPlayer():DoTaskInTime(3, function() colth:Remove() fist:Remove() gold:Remove() end )
            if fist.prefab == "blueprint" then
               makers.AnimState:SetBuild("wolfgang")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 10 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                  end
               end )
            end
            if fist.prefab == "rocks" then
               makers.AnimState:SetBuild("wolfgang_skinny")
               makers.AnimState:PlayAnimation("hit")
               GetPlayer():DoTaskInTime(3, function() 
                  for k = 1, 20 do
                      GetPlayer().components.inventory:GiveItem(goldnugget)
                      GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                  end
               end )
            end
            if fist.prefab == "razor" then
               makers.AnimState:SetBuild("wolfgang_mighty")
               makers.AnimState:PlayAnimation("idle_onemanband1_loop",true)
               GetPlayer():DoTaskInTime(3, function() 
                  makers.AnimState:PlayAnimation("idle")
                  SpawnPrefab("collapse_small").Transform:SetPosition(pt.x+2.5, 0, pt.z+2.5)
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
               end )
            end
        end
    end
end
local function OnDeploy (inst, pt)
    game(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("makers") then
        data.makers = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.makers then
       game(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)

    ûȶ̹Ұȭĳɫ10ƽŻƽԺɫǵʯͷӡѡҪѡʯͷׯһͬʱȭҰȭĹǣʯͷӮ䲼ӮʯͷӮʯͷӡʤñ10ƽ𣨹20ƽ𣩣ƽ˻˾ׯҲ⵰Զģڸ10ƽı뱣1ƽ𡣲ҪҰȭĳʱյɡȶ̹սѡѽ£1Ƥ2֦2




.ϳ꣨ӡ桢ۣ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rabbit.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = 999


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\birds.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = 999


    3.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\mole.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = 999


    4.ü±ϷĿ¼\data\scripts\prefabs\bugnet.luaļinst:AddComponent("inspectable")һвݣ

local function netsell(inst)
    inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
    inst:DoTaskInTime(3, function() inst.AnimState:SetBloomEffectHandle( "" ) end )
    if inst.components.container:Has("goldnugget", 10) then
       if inst.components.container:Has("bee", 3) then
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("bee", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum)
       end
       if inst.components.container:Has("killerbee", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("killerbee", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*2)
       end
       if inst.components.container:Has("butterfly", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("butterfly", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum)
       end
       if inst.components.container:Has("fireflies", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("fireflies", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*2)
       end
       if inst.components.container:Has("crow", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("crow", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*3)
       end
       if inst.components.container:Has("robin", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("robin", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*3)
       end
       if inst.components.container:Has("robin_winter", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("robin_winter", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*3)
       end
       if inst.components.container:Has("rabbit", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("rabbit", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*2)
       end
       if inst.components.container:Has("mole", 3) then 
          local sellnum = math.random(1,3)
          inst.components.container:ConsumeByName("mole", sellnum)
          inst.components.container:ConsumeByName("goldnugget", -sellnum*5)
       end
    end
end
local function OnDeploy (inst, pt)
    if GetPlayer().components.inventory:Has("goldnugget", 200) then 
       GetPlayer().components.inventory:ConsumeByName("goldnugget", 200)
       local sellbox = SpawnPrefab("bugnet")
       sellbox.Transform:SetPosition(pt.x, pt.y, pt.z)
       sellbox.AnimState:SetBank("bee_box")
       sellbox.AnimState:SetBuild("bee_box")
       sellbox.AnimState:PlayAnimation("idle")
       sellbox.AnimState:SetMultColour(0/255,255/255,0/255,1)
       sellbox.Transform:SetScale(1.2, 1.2, 1.2)
       sellbox:AddTag("sellbox")
       sellbox.components.container.canbeopened = true
       sellbox:RemoveComponent("weapon")
       sellbox:RemoveComponent("tool")
       sellbox:RemoveComponent("finiteuses")
       sellbox:RemoveComponent("inventoryitem")
       sellbox:RemoveComponent("equippable")
       sellbox:AddTag("fridge")
       MakeLargeBurnable(sellbox)
       inst:Remove()
    end
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("sellbox") then
        data.sellbox = true
    end
end
local function onload(inst, data)
    if data and data.sellbox then
       inst.AnimState:SetBank("bee_box")
       inst.AnimState:SetBuild("bee_box")
       inst.AnimState:PlayAnimation("idle")
       inst.AnimState:SetMultColour(0/255,255/255,0/255,1)
       inst.Transform:SetScale(1.2, 1.2, 1.2)
       inst:AddTag("sellbox")
       inst.components.container.canbeopened = true
       inst:RemoveComponent("weapon")
       inst:RemoveComponent("tool")
       inst:RemoveComponent("finiteuses")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("equippable")
       inst:AddTag("fridge")
       MakeLargeBurnable(inst)
    end
end
local function itemtest(inst, item, slot)
    if item.prefab == "goldnugget" or item.prefab == "bee" or item.prefab == "killerbee" or item.prefab == "butterfly" or item.prefab == "fireflies" or item.prefab == "crow" or item.prefab == "robin" or item.prefab == "robin_winter" or item.prefab == "rabbit" or item.prefab == "mole" then
       return true
    end
    return false
end
local slotpos = {Vector3(75,150,0)}
for y = 2, 0, -1 do
    for x = 0, 4 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(-100,200,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.itemtestfn = itemtest
    inst:DoPeriodicTask(30, function() if inst:HasTag("sellbox") then netsell(inst) end end )

    ò䣬200ƽϻƽʱ䡣򿪸ӣϵĸ10ƽı֤𣬲С󣨼ƷֶԣһƷ3ֻۡʱ㣬ӿɿƷļ١ƽȡƽѣϵĸ뱣10ƽı֤󶨼5ƽ񶨼3ƽɱ˷䡢ө桢Ӷ2ƽ۷䡢1ƽ𣬵ĳƷ治3ֻʱƷֽ˹뼰ʱ鲢ǧҪƽƷУϵı֤ӿţƷ0ƽСıŶӴ˾ӪԼϳ꣬׽С۰ɡҪʱյɣǵȡƽƷŶ




.ɿ󳡣ö๦ֲܹɿ󳡣׬ƽʯ

    ü±ϷĿ¼\data\scripts\prefabs\axe_pickaxe.luaļ

    1.Asset("ANIM", "anim/swap_multitool_axe_pickaxe.zip"),һвݣ

	Asset("ANIM", "anim/wolfgang.zip"),
	Asset("ANIM", "anim/wolfgang_skinny.zip"),
	Asset("ANIM", "anim/wolfgang_mighty.zip"),
	Asset("ANIM", "anim/player_wolfgang.zip"),
	Asset("SOUND", "sound/wolfgang.fsb"),

    
    2.inst:AddComponent("inspectable")һвݣ

local function mining(inst)
    local pt = inst:GetPosition()
    local boss = SpawnPrefab("multitool_axe_pickaxe")
    boss.Transform:SetPosition(pt.x, pt.y, pt.z)
    boss.AnimState:SetBank("wilson")
    boss.AnimState:SetBuild("wolfgang")
    boss.AnimState:Hide("ARM_carry")
    boss.AnimState:Show("ARM_normal")
    boss.Transform:SetFourFaced()
    boss.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat")
    boss.AnimState:Show("HAT")
    boss.AnimState:Show("HAT_HAIR")
    boss.AnimState:Hide("HAIR_NOHAT")
    boss.AnimState:Hide("HAIR")
    boss.AnimState:PlayAnimation("idle")
    boss:AddTag("boss")
    boss:RemoveComponent("weapon")
    boss:RemoveComponent("tool")
    boss:RemoveComponent("finiteuses")
    boss:RemoveComponent("inventoryitem")
    boss:RemoveComponent("equippable")
    boss:RemoveComponent("deployable")
    boss:RemoveTag("sharp")
    local light = boss.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(5)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    boss:AddComponent("trader")
    boss.components.trader:SetAcceptTest(function(boss, item) 
        if item.prefab == "goldnugget" then
           return true
        end
        if item.prefab == "purplegem" or item.prefab == "bluegem" or item.prefab == "redgem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "greengem" then
           return true
        end
        return false
    end )
    boss.components.trader.onaccept = function(boss, giver, item)
        boss.AnimState:PlayAnimation("give")
        if item.prefab == "goldnugget" then
           SpawnPrefab("pickaxe").Transform:SetPosition(pt.x+0.5, 0, pt.z+0.5)
        end
        if item.prefab == "purplegem" or item.prefab == "bluegem" or item.prefab == "redgem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "greengem" then
           SpawnPrefab("goldnugget").Transform:SetPosition(pt.x+0.5, 0, pt.z+0.5)
        end
    end
    boss.components.inspectable.getstatus = function(boss)
        boss.AnimState:PlayAnimation("give")
        local rock = SpawnPrefab("multitool_axe_pickaxe")
        rock.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5)
        rock.AnimState:SetBank("rock")
        rock.AnimState:SetBuild("rock")
        rock.AnimState:PlayAnimation("full")
        rock.Transform:SetScale(0.5, 0.5, 0.5)
        rock:AddTag("goodbye")
        rock:RemoveComponent("weapon")
        rock:RemoveComponent("tool")
        rock:RemoveComponent("finiteuses")
        rock:RemoveComponent("inventoryitem")
        rock:RemoveComponent("equippable")
        rock:RemoveComponent("deployable")
        rock:RemoveTag("sharp")
        rock:AddComponent("workable")
        rock.components.workable:SetWorkAction(ACTIONS.MINE)
        rock.components.workable:SetWorkLeft(30)
        rock.components.workable:SetOnWorkCallback(function(rock, worker, workleft)
            if rock.components.workable.workleft <= 0 then
               rock.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
               boss.AnimState:PlayAnimation("give")
               for k = 1, 3 do
                   SpawnPrefab("goldnugget").Transform:SetPosition(pt.x+0.5, 0, pt.z-0.5)
               end
               rock:Remove()
            else
               if rock.components.workable.workleft < 10 then
                  rock.AnimState:PlayAnimation("low")
               elseif rock.components.workable.workleft < 20 then
                  rock.AnimState:PlayAnimation("med")
               else
                  rock.AnimState:PlayAnimation("full")
               end
            end
        end) 
    end
    local mountain = SpawnPrefab("multitool_axe_pickaxe")
    mountain.Transform:SetPosition(pt.x-2, 0, pt.z-2)
    mountain.AnimState:SetBank("rock2")
    mountain.AnimState:SetBuild("rock2")
    mountain.AnimState:PlayAnimation("full")
    mountain.Transform:SetScale(2, 2, 2)
    mountain:AddTag("goodbye")
    mountain:RemoveComponent("weapon")
    mountain:RemoveComponent("tool")
    mountain:RemoveComponent("finiteuses")
    mountain:RemoveComponent("inventoryitem")
    mountain:RemoveComponent("equippable")
    mountain:RemoveComponent("deployable")
    mountain:RemoveTag("sharp")
    local miner = SpawnPrefab("multitool_axe_pickaxe")
    miner.Transform:SetPosition(pt.x+3-2, 0, pt.z-3-2)
    miner.AnimState:SetBank("wilson")
    miner.AnimState:SetBuild("wes")
    miner.Transform:SetFourFaced()
    miner.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat")
    miner.AnimState:Show("HAT")
    miner.AnimState:Show("HAT_HAIR")
    miner.AnimState:Hide("HAIR_NOHAT")
    miner.AnimState:Hide("HAIR")
    miner.AnimState:OverrideSymbol("swap_object", "swap_pickaxe", "swap_pickaxe")
    miner.AnimState:Show("ARM_carry") 
    miner.AnimState:Hide("ARM_normal") 
    miner.AnimState:PlayAnimation("pickaxe_pre")
    miner.AnimState:PlayAnimation("pickaxe_loop", true)
    miner.Transform:SetRotation( 270 )
    miner:AddTag("goodbye")
    miner:RemoveComponent("weapon")
    miner:RemoveComponent("tool")
    miner:RemoveComponent("finiteuses")
    miner:RemoveComponent("inventoryitem")
    miner:RemoveComponent("equippable")
    miner:RemoveComponent("deployable")
    miner:RemoveTag("sharp")
    miner:DoPeriodicTask(30, function()
        miner.AnimState:PlayAnimation("pickaxe_pre")
        miner.AnimState:PlayAnimation("pickaxe_loop", true)
        miner.Transform:SetRotation( 270 )
    end )
    miner:AddComponent("trader")
    miner.components.trader:SetAcceptTest(function(miner, item) 
        if item.prefab == "goldnugget" then
           return true
        end
        return false
    end )
    miner.components.trader.onaccept = function(miner, giver, item)
        miner.AnimState:PlayAnimation("give")
        miner.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180)
        local names = {"purplegem","bluegem","redgem","orangegem","yellowgem","greengem"}
        local name = names[math.random(#names)]
        local gem = SpawnPrefab(name)
        GetPlayer().components.inventory:GiveItem(gem)
    end
end
local function OnDeploy (inst, pt)
    mining(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("boss") then
        data.boss = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.boss then
       mining(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)

    ö๦ֲܹɿ󳡣㹤ͷʿóҪӹʯͷø佫ʯͷ飬ɻ3ƽĹǮͷڵϣͷ䣨ŻƽԹͷÿ1ƽҲԽԼıʯͷűʯԹͷÿ1ƽ𡣵ȻҲ˽󹤣ά˹ʯŻƽԿ󹤵ͬÿ1ƽ𣨱ʯֱӷƷɫҪɿʱյɡ๦ܹԶѡԶż̳£1ѻƽͷ1ѻƽ䡢2ʯ죬ʱҪԶż̳




.Ӷôʯֱ׬ƽ𣬹еӶ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rook.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("retinue") then
        data.retinue = true
    end
    if inst:HasTag("highretinue") then
        data.highretinue = true
    end
    if inst:HasTag("letgo") then
        data.letgo = true
    end
end
local function onload(inst, data)
    if data and data.retinue then
       inst.components.health:SetMaxHealth(1000)
       inst.components.combat:SetDefaultDamage(100)
       inst:RemoveTag("monster")
       inst:AddTag("retinue")
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "chessjunk.png" )
       inst.components.locomotor:Stop()
       inst:SetBrain(nil)
       inst.components.follower:SetLeader(nil)
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("letgo") then
              local brain = require "brains/rookbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
              inst:AddTag("letgo")
           else
              inst.components.locomotor:Stop()
              inst:SetBrain(nil)
              inst.components.follower:SetLeader(nil)
              inst:RemoveTag("letgo")
           end
       end
       inst:AddComponent("trader")
       inst.components.trader:SetAcceptTest(function(inst, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 50) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       inst.components.trader.onaccept = function(inst, giver, item)
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 49)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst.components.health:SetMaxHealth(2000)
           inst.components.health:DoDelta(2000)
           inst.components.combat:SetDefaultDamage(200)
           inst:AddTag("highretinue")
           inst.components.locomotor.walkspeed = 15
           inst.components.locomotor.runspeed =  20
       end
       inst.Physics:SetCollisionCallback(function(inst, other)
           if other and other.components.workable and other.components.workable.workleft > 0 then
              SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
              other.components.workable:Destroy(inst)
           end
       end)
       inst.components.locomotor.walkspeed = 10
       inst.components.locomotor.runspeed =  15
       inst.components.combat:SetAttackPeriod( 1 )
       inst.components.combat:SetRetargetFunction(3, function(inst)
          if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                  if guy.components.health and not guy.components.health:IsDead() then
                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                  end
              end)
          end
      end )
      inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
      if data and data.highretinue then
         inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
         inst.components.health:SetMaxHealth(2000)
         inst.components.combat:SetDefaultDamage(200)
         inst:AddTag("highretinue")
         inst.components.locomotor.walkspeed = 15
         inst.components.locomotor.runspeed =  20
      end
      if data and data.letgo then
         local brain = require "brains/rookbrain"
         inst:SetBrain(brain)
         inst:RestartBrain()
         inst.components.follower:SetLeader(GetPlayer())
         inst:AddTag("letgo")
      end
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload


    2.ü±ϷĿ¼\data\scripts\prefabs\bishop.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("retinue") then
        data.retinue = true
    end
    if inst:HasTag("highretinue") then
        data.highretinue = true
    end
    if inst:HasTag("letgo") then
        data.letgo = true
    end
end
local function onload(inst, data)
    if data and data.retinue then
       inst.components.health:SetMaxHealth(500)
       inst.components.combat:SetDefaultDamage(30)
       inst:RemoveTag("monster")
       inst:AddTag("retinue")
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "chessjunk.png" )
       inst.components.locomotor:Stop()
       inst:SetBrain(nil)
       inst.components.follower:SetLeader(nil)
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("letgo") then
              local brain = require "brains/rookbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
              inst:AddTag("letgo")
           else
              inst.components.locomotor:Stop()
              inst:SetBrain(nil)
              inst.components.follower:SetLeader(nil)
              inst:RemoveTag("letgo")
           end
       end
       inst:AddComponent("trader")
       inst.components.trader:SetAcceptTest(function(inst, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 30) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       inst.components.trader.onaccept = function(inst, giver, item)
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 29)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst.components.health:SetMaxHealth(1000)
           inst.components.health:DoDelta(1000)
           inst.components.combat:SetDefaultDamage(60)
           inst:AddTag("highretinue")
           inst.components.locomotor.walkspeed = 15
       end
       inst.components.locomotor.walkspeed = 10
       inst.components.combat:SetAttackPeriod( 0.5 )
       inst.components.combat:SetRetargetFunction(3, function(inst)
          if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                  if guy.components.health and not guy.components.health:IsDead() then
                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                  end
              end)
          end
      end )
      inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
      if data and data.highretinue then
         inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
         inst.components.health:SetMaxHealth(1000)
         inst.components.combat:SetDefaultDamage(60)
         inst:AddTag("highretinue")
         inst.components.locomotor.walkspeed = 15
      end
      if data and data.letgo then
         local brain = require "brains/rookbrain"
         inst:SetBrain(brain)
         inst:RestartBrain()
         inst.components.follower:SetLeader(GetPlayer())
         inst:AddTag("letgo")
      end
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload


    3.ü±ϷĿ¼\data\scripts\prefabs\knight.luaļinst:AddComponent("inspectable")һвݣ

local function onsave(inst, data)
    if inst:HasTag("retinue") then
        data.retinue = true
    end
    if inst:HasTag("highretinue") then
        data.highretinue = true
    end
    if inst:HasTag("letgo") then
        data.letgo = true
    end
end
local function onload(inst, data)
    if data and data.retinue then
       inst.components.health:SetMaxHealth(500)
       inst.components.combat:SetDefaultDamage(15)
       inst:RemoveTag("monster")
       inst:AddTag("retinue")
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "chessjunk.png" )
       inst.components.locomotor:Stop()
       inst:SetBrain(nil)
       inst.components.follower:SetLeader(nil)
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("letgo") then
              local brain = require "brains/rookbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
              inst:AddTag("letgo")
           else
              inst.components.locomotor:Stop()
              inst:SetBrain(nil)
              inst.components.follower:SetLeader(nil)
              inst:RemoveTag("letgo")
           end
       end
       inst:AddComponent("trader")
       inst.components.trader:SetAcceptTest(function(inst, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 15) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       inst.components.trader.onaccept = function(inst, giver, item)
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 14)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst.components.health:SetMaxHealth(1000)
           inst.components.health:DoDelta(1000)
           inst.components.combat:SetDefaultDamage(30)
           inst:AddTag("highretinue")
           inst.components.locomotor.walkspeed = 15
       end
       inst.components.locomotor.walkspeed = 10
       inst.components.combat:SetAttackPeriod( 0.5 )
       inst.components.combat:SetRetargetFunction(3, function(inst)
          if not inst.components.health:IsDead() then
              return FindEntity(inst, 20, function(guy)
                  if guy.components.health and not guy.components.health:IsDead() then
                     return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                  end
              end)
          end
      end )
      inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
      if data and data.highretinue then
         inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
         inst.components.health:SetMaxHealth(1000)
         inst.components.combat:SetDefaultDamage(30)
         inst:AddTag("highretinue")
         inst.components.locomotor.walkspeed = 15
      end
      if data and data.letgo then
         local brain = require "brains/rookbrain"
         inst:SetBrain(brain)
         inst:RestartBrain()
         inst.components.follower:SetLeader(GetPlayer())
         inst:AddTag("letgo")
      end
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload


    4.ü±ϷĿ¼\data\scripts\prefabs\armor_marble.luaļinst:AddComponent("inspectable")һвݣ

local function repairshop(inst)
    local pt = inst:GetPosition()
    local repairboss = SpawnPrefab("armormarble")
    repairboss.Transform:SetPosition(pt.x, pt.y, pt.z)
    repairboss.AnimState:SetBank("wilson")
    repairboss.AnimState:SetBuild("wx78")
    repairboss.AnimState:OverrideSymbol("swap_hat", "hat_top", "swap_hat")
    repairboss.AnimState:Show("HAT")
    repairboss.AnimState:Show("HAT_HAIR")
    repairboss.AnimState:Hide("HAIR_NOHAT")
    repairboss.AnimState:Hide("HAIR")
    repairboss.AnimState:OverrideSymbol("swap_body", "armor_marble", "swap_body")
    repairboss.AnimState:OverrideSymbol("swap_object", "swap_hammer", "swap_hammer")
    repairboss.AnimState:Show("ARM_carry") 
    repairboss.AnimState:Hide("ARM_normal") 
    repairboss.Transform:SetFourFaced()
    repairboss.AnimState:PlayAnimation("idle")
    repairboss:AddTag("repairboss")
    repairboss.components.inventoryitem.canbepickedup = false
    local light = repairboss.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    repairboss:AddComponent("trader")
    repairboss.components.trader:SetAcceptTest(function(repairboss, item) 
        if item.prefab == "goldnugget" then
           return true
        end
        return false
    end )
    repairboss.components.trader.onaccept = function(repairboss, giver, item)
        repairboss.AnimState:PlayAnimation("give")
        SpawnPrefab("hammer").Transform:SetPosition(pt.x+0.5, 0, pt.z+0.5)
    end
    repairboss.components.inspectable.getstatus = function(repairboss)
        repairboss.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_stone")
        local chessjunk = SpawnPrefab("armormarble")
        chessjunk.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
        chessjunk.AnimState:SetBank("chessmonster_ruins")
        chessjunk.AnimState:SetBuild("chessmonster_ruins")
        chessjunk.AnimState:PlayAnimation("idle3")
        chessjunk:AddTag("goodbye")
        chessjunk.components.inventoryitem.canbepickedup = false
        chessjunk:AddComponent("workable")
        chessjunk.components.workable:SetWorkAction(ACTIONS.HAMMER)
        chessjunk.components.workable:SetWorkLeft(30)
        chessjunk.components.workable:SetOnWorkCallback(function(chessjunk, worker, workleft)
            if chessjunk.components.workable.workleft <= 0 then
               GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/chessjunk_break")
               chessjunk:Remove()
               local goods = SpawnPrefab("armormarble")
               goods.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
               goods:AddTag("goodbye")
               goods.components.inventoryitem.canbepickedup = false
               if math.random()<.33 then
                  goods.AnimState:SetBank("rook")
                  goods.AnimState:SetBuild("rook_nightmare")
                  goods.AnimState:PlayAnimation("idle")
                  goods.Transform:SetScale(0.66, 0.66, 0.66)
               elseif math.random()<.66 then
                  goods.AnimState:SetBank("bishop")
                  goods.AnimState:SetBuild("bishop_nightmare")
                  goods.AnimState:PlayAnimation("idle_loop", true)
               else
                  goods.AnimState:SetBank("knight")
                  goods.AnimState:SetBuild("knight_nightmare")
                  goods.AnimState:PlayAnimation("idle_loop", true)
               end
               GetPlayer():DoTaskInTime(2, function()
                   repairboss.AnimState:PlayAnimation("give")
                   GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
                   for k = 1, 3 do
                       SpawnPrefab("goldnugget").Transform:SetPosition(pt.x+0.5, 0, pt.z-0.5)
                   end
                   goods:Remove()
               end )
            else
               if chessjunk.components.workable.workleft < 10 then
                  chessjunk.AnimState:PlayAnimation("idle1")
               elseif chessjunk.components.workable.workleft < 20 then
                  chessjunk.AnimState:PlayAnimation("idle2")
               else
                  chessjunk.AnimState:PlayAnimation("idle3")
               end
            end
        end) 
    end
    local chessjunk1 = SpawnPrefab("armormarble")
    chessjunk1.Transform:SetPosition(pt.x-3, 0, pt.z-3)
    chessjunk1.AnimState:SetBank("rook")
    chessjunk1.AnimState:SetBuild("rook_nightmare")
    chessjunk1.Transform:SetFourFaced()
    chessjunk1.AnimState:PlayAnimation("idle")
    chessjunk1.Transform:SetScale(0.66, 0.66, 0.66)
    chessjunk1:AddTag("goodbye")
    chessjunk1.components.inventoryitem.canbepickedup = false
    chessjunk1:AddComponent("trader")
    chessjunk1.components.trader:SetAcceptTest(function(chessjunk1, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 50) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    chessjunk1.components.trader.onaccept = function(chessjunk1, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 49)
        repairboss.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        local retinue1 = SpawnPrefab("rook_nightmare")
        retinue1.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
        retinue1.components.follower:SetLeader(GetPlayer())
        retinue1.components.health:SetMaxHealth(1000)
        retinue1.components.combat:SetDefaultDamage(100)
        retinue1:RemoveTag("monster")
        retinue1:AddTag("retinue")
        retinue1:AddTag("letgo")
	local minimap = retinue1.entity:AddMiniMapEntity()
	minimap:SetIcon( "chessjunk.png" )
        retinue1.components.inspectable.getstatus = function(retinue1)
            if not retinue1:HasTag("letgo") then
               local brain = require "brains/rookbrain"
               retinue1:SetBrain(brain)
               retinue1:RestartBrain()
               retinue1.components.follower:SetLeader(GetPlayer())
               retinue1:AddTag("letgo")
            else
               retinue1.components.locomotor:Stop()
               retinue1.components.follower:SetLeader(nil)
               retinue1:SetBrain(nil)
               retinue1:RemoveTag("letgo")
            end
        end
        retinue1:AddComponent("trader")
        retinue1.components.trader:SetAcceptTest(function(retinue1, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 50) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        retinue1.components.trader.onaccept = function(retinue1, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 49)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            retinue1.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            retinue1.components.health:SetMaxHealth(2000)
            retinue1.components.health:DoDelta(2000)
            retinue1.components.combat:SetDefaultDamage(200)
            retinue1:AddTag("highretinue")
            retinue1.components.locomotor.walkspeed = 15
            retinue1.components.locomotor.runspeed =  20
        end
        retinue1.Physics:SetCollisionCallback(function(retinue1, other)
            if other and other.components.workable and other.components.workable.workleft > 0 then
               SpawnPrefab("collapse_small").Transform:SetPosition(other:GetPosition():Get())
               other.components.workable:Destroy(retinue1)
            end
        end)
        retinue1.components.locomotor.walkspeed = 10
        retinue1.components.locomotor.runspeed =  15
        retinue1.components.combat:SetAttackPeriod( 1 )
        retinue1.components.combat:SetRetargetFunction(3, function(retinue1)
           if not retinue1.components.health:IsDead() then
               return FindEntity(retinue1, 20, function(guy)
                   if guy.components.health and not guy.components.health:IsDead() then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end)
           end
        end )
        retinue1.components.combat:SetKeepTargetFunction(function(retinue1, target) return target and target:IsValid() end )
    end
    local chessjunk2 = SpawnPrefab("armormarble")
    chessjunk2.Transform:SetPosition(pt.x-3+2.3, 0, pt.z-3-2.3)
    chessjunk2.AnimState:SetBank("bishop")
    chessjunk2.AnimState:SetBuild("bishop_nightmare")
    chessjunk2.Transform:SetFourFaced()
    chessjunk2.AnimState:PlayAnimation("idle_loop", true)
    chessjunk2:AddTag("goodbye")
    chessjunk2.components.inventoryitem.canbepickedup = false
    chessjunk2:AddComponent("trader")
    chessjunk2.components.trader:SetAcceptTest(function(chessjunk2, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 30) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    chessjunk2.components.trader.onaccept = function(chessjunk2, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 29)
        repairboss.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        local retinue2 = SpawnPrefab("bishop_nightmare")
        retinue2.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
        retinue2.components.follower:SetLeader(GetPlayer())
        retinue2.components.health:SetMaxHealth(500)
        retinue2.components.combat:SetDefaultDamage(30)
        retinue2:RemoveTag("monster")
        retinue2:AddTag("retinue")
        retinue2:AddTag("letgo")
	local minimap = retinue2.entity:AddMiniMapEntity()
	minimap:SetIcon( "chessjunk.png" )
        retinue2.components.inspectable.getstatus = function(retinue2)
            if not retinue2:HasTag("letgo") then
               local brain = require "brains/rookbrain"
               retinue2:SetBrain(brain)
               retinue2:RestartBrain()
               retinue2.components.follower:SetLeader(GetPlayer())
               retinue2:AddTag("letgo")
            else
               retinue2.components.locomotor:Stop()
               retinue2.components.follower:SetLeader(nil)
               retinue2:SetBrain(nil)
               retinue2:RemoveTag("letgo")
            end
        end
        retinue2:AddComponent("trader")
        retinue2.components.trader:SetAcceptTest(function(retinue2, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 30) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        retinue2.components.trader.onaccept = function(retinue2, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 29)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            retinue2.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            retinue2.components.health:SetMaxHealth(1000)
            retinue2.components.health:DoDelta(1000)
            retinue2.components.combat:SetDefaultDamage(60)
            retinue2:AddTag("highretinue")
            retinue2.components.locomotor.walkspeed = 15
        end
        retinue2.components.locomotor.walkspeed = 10
        retinue2.components.combat:SetAttackPeriod( 0.5 )
        retinue2.components.combat:SetRetargetFunction(3, function(retinue2)
           if not retinue2.components.health:IsDead() then
               return FindEntity(retinue2, 20, function(guy)
                   if guy.components.health and not guy.components.health:IsDead() then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end)
           end
        end )
        retinue2.components.combat:SetKeepTargetFunction(function(retinue2, target) return target and target:IsValid() end )
    end
    local chessjunk3 = SpawnPrefab("armormarble")
    chessjunk3.Transform:SetPosition(pt.x-3-2, 0, pt.z-3+2)
    chessjunk3.AnimState:SetBank("knight")
    chessjunk3.AnimState:SetBuild("knight_nightmare")
    chessjunk3.Transform:SetFourFaced()
    chessjunk3.AnimState:PlayAnimation("idle_loop", true)
    chessjunk3:AddTag("goodbye")
    chessjunk3.components.inventoryitem.canbepickedup = false
    chessjunk3:AddComponent("trader")
    chessjunk3.components.trader:SetAcceptTest(function(chessjunk3, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 15) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    chessjunk3.components.trader.onaccept = function(chessjunk3, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 14)
        repairboss.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        local retinue3 = SpawnPrefab("knight_nightmare")
        retinue3.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
        retinue3.components.follower:SetLeader(GetPlayer())
        retinue3.components.health:SetMaxHealth(500)
        retinue3.components.combat:SetDefaultDamage(15)
        retinue3:RemoveTag("monster")
        retinue3:AddTag("retinue")
        retinue3:AddTag("letgo")
	local minimap = retinue3.entity:AddMiniMapEntity()
	minimap:SetIcon( "chessjunk.png" )
        retinue3.components.inspectable.getstatus = function(retinue3)
            if not retinue3:HasTag("letgo") then
               local brain = require "brains/rookbrain"
               retinue3:SetBrain(brain)
               retinue3:RestartBrain()
               retinue3.components.follower:SetLeader(GetPlayer())
               retinue3:AddTag("letgo")
            else
               retinue3.components.locomotor:Stop()
               retinue3.components.follower:SetLeader(nil)
               retinue3:SetBrain(nil)
               retinue3:RemoveTag("letgo")
            end
        end
        retinue3:AddComponent("trader")
        retinue3.components.trader:SetAcceptTest(function(retinue3, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 15) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        retinue3.components.trader.onaccept = function(retinue3, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 14)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
            retinue3.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            retinue3.components.health:SetMaxHealth(1000)
            retinue3.components.health:DoDelta(1000)
            retinue3.components.combat:SetDefaultDamage(30)
            retinue3:AddTag("highretinue")
            retinue3.components.locomotor.walkspeed = 15
        end
        retinue3.components.locomotor.walkspeed = 10
        retinue3.components.combat:SetAttackPeriod( 0.5 )
        retinue3.components.combat:SetRetargetFunction(3, function(retinue3)
           if not retinue3.components.health:IsDead() then
               return FindEntity(retinue3, 20, function(guy)
                   if guy.components.health and not guy.components.health:IsDead() then
                      return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster")
                   end
               end)
           end
       end )
       retinue3.components.combat:SetKeepTargetFunction(function(retinue3, target) return target and target:IsValid() end )
    end
    local garbage1 = SpawnPrefab("armormarble")
    garbage1.Transform:SetPosition(pt.x+4-1, 0, pt.z-4-1)
    garbage1.AnimState:SetBank("researchlab2")
    garbage1.AnimState:SetBuild("researchlab2")
    garbage1.AnimState:PlayAnimation("proximity_loop", true)
    garbage1:AddTag("goodbye")
    garbage1.components.inventoryitem.canbepickedup = false
    local garbage2 = SpawnPrefab("armormarble")
    garbage2.Transform:SetPosition(pt.x+4+1, 0, pt.z-4+1)
    garbage2.AnimState:SetBank("researchlab2")
    garbage2.AnimState:SetBuild("researchlab2")
    garbage2.AnimState:PlayAnimation("proximity_loop", true)
    garbage2:AddTag("goodbye")
    garbage2.components.inventoryitem.canbepickedup = false
    local garbage3 = SpawnPrefab("armormarble")
    garbage3.Transform:SetPosition(pt.x+4+3, 0, pt.z-4+3)
    garbage3.AnimState:SetBank("researchlab2")
    garbage3.AnimState:SetBuild("researchlab2")
    garbage3.AnimState:PlayAnimation("proximity_loop", true)
    garbage3:AddTag("goodbye")
    garbage3.components.inventoryitem.canbepickedup = false
end
local function OnDeploy (inst, pt)
    repairshop(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("repairboss") then
        data.repairboss = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.repairboss then
       repairshop(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)

    ôʯֹӶϰ壨ˣóҪӹôӽҳɻеɻ3ƽĹǮϰڵϣϰ幺ӣŻƽϰÿ1ƽŻƽϰ屳ĻеԹӦƷֵĻеӶлеϬţÿֻ50ƽ𣬻еÿֻ30ƽ𣬻еÿֻ15ƽ𣬴սŰɡӶֹͣ棬ٴεɼ棬ʱвҪˡǽӶפںδʱԴСͼңʾΪͼꡣӵлеӶ󣬿ԽһΪŻƽԼĻеͬϬţ50ƽ30ƽ15ƽ𣩣ɽΪеӶϷоٶȶߡս֮󣬸ӶƽͬϣԽǵѪҪӶʱյɡʯսѡѽ£12ʯ4




.ֳ÷䳲ֳС죬׬ƽ

    ü±ϷĿ¼\data\scripts\prefabs\honeycomb.luaļinst:AddComponent("inspectable")һвݣ

local function penguinshop(inst)
    local pt = inst:GetPosition()
    local peddler = SpawnPrefab("honeycomb")
    peddler.Transform:SetPosition(pt.x, pt.y, pt.z)
    peddler.AnimState:SetBank("wilson")
    peddler.AnimState:SetBuild("willow")
    peddler.AnimState:OverrideSymbol("swap_hat", "hat_straw", "swap_hat")
    peddler.AnimState:Show("HAT")
    peddler.AnimState:Show("HAT_HAIR")
    peddler.AnimState:Hide("HAIR_NOHAT")
    peddler.AnimState:Hide("HAIR")
    peddler.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body")
    peddler.AnimState:Hide("ARM_carry") 
    peddler.AnimState:Show("ARM_normal") 
    peddler.Transform:SetFourFaced()
    peddler.AnimState:PlayAnimation("idle")
    peddler:AddTag("peddler")
    peddler:RemoveComponent("stackable")
    peddler:RemoveComponent("tradable")
    peddler:RemoveComponent("inventoryitem")
    local light = peddler.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    MakeLargeBurnable(peddler)
    MakeLargePropagator(peddler)
    peddler.components.inspectable.getstatus = function(peddler)
        peddler.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold")
        local pos = Vector3(peddler.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("penguin_2") then
               for k = 1, 20 do
                   SpawnPrefab("goldnugget").Transform:SetPosition(v.Transform:GetWorldPosition())
               end
               v:Remove()
            end
        end
    end
    peddler:AddComponent("trader")
    peddler.components.trader:SetAcceptTest(function(peddler, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 10) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    peddler.components.trader.onaccept = function(peddler, giver, item)
        peddler.AnimState:PlayAnimation("give")
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        local penguin = SpawnPrefab("honeycomb")
        penguin.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1)
        penguin.AnimState:SetBank("penguin")
        penguin.AnimState:SetBuild("penguin_build")
        penguin.Transform:SetFourFaced()
        penguin.AnimState:PlayAnimation("idle_loop", true)
        penguin.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
	penguin.entity:AddSoundEmitter()
	local minimap = penguin.entity:AddMiniMapEntity()
	minimap:SetIcon( "penguin.png" )
        MakeCharacterPhysics(penguin, 50, .5)
        penguin:AddComponent("follower")
        penguin.components.follower:SetLeader(GetPlayer())
        local brain = require "brains/abigailbrain"
        penguin:SetBrain(brain)
        penguin:AddComponent("locomotor")
        penguin.components.locomotor.walkspeed = 0.75
        penguin.components.locomotor.directdrive = false
        penguin:SetStateGraph("SGpenguin")
        penguin:AddComponent("combat")
        penguin.components.combat.hiteffectsymbol = "body"
        penguin.components.combat:SetAttackPeriod(1)
        penguin.components.combat:SetRange(2.5)
        penguin.components.combat:SetDefaultDamage(1)
        penguin:ListenForEvent("attacked", function(penguin, data) penguin.components.combat:SetTarget(data.attacker) end )
        penguin:AddComponent("health")
        penguin.components.health:SetMaxHealth(50)
        penguin.Transform:SetScale(0.7, 0.7, 0.7)
        penguin:RemoveComponent("stackable")
        penguin:RemoveComponent("tradable")
        penguin:RemoveComponent("inventoryitem")
        penguin:AddTag("retinue")
        penguin:AddTag("penguin_1")
        penguin:AddComponent("lootdropper")
        penguin.components.lootdropper:SetLoot({"smallmeat", "smallmeat"})
        penguin.components.inspectable.getstatus = function(penguin)
            if not penguin:HasTag("retinue") then
               local brain = require "brains/abigailbrain"
               penguin:SetBrain(brain)
               penguin.components.follower:SetLeader(GetPlayer())
               penguin.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
               penguin:AddTag("retinue")
            else
               local brain = require "brains/leifbrain"
               penguin:SetBrain(brain)
               penguin.components.follower:SetLeader(nil)
               penguin.AnimState:SetBloomEffectHandle("")
               penguin:RemoveTag("retinue")
            end
        end
        penguin:DoTaskInTime(math.random(480,560), function()
            if not penguin:HasTag("penguin_2") then
               penguin.AnimState:PlayAnimation("taunt")
               penguin.Transform:SetScale(1, 1, 1)
               penguin:AddTag("penguin_2")
               penguin.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"})
            end
        end )
        penguin:DoPeriodicTask(math.random(120,180), function()
            if penguin:HasTag("penguin_2") then
               SpawnPrefab("bird_egg").Transform:SetPosition(penguin.Transform:GetWorldPosition())
            end
        end)
    end
    local ice = SpawnPrefab("honeycomb")
    ice.Transform:SetPosition(pt.x+1, 0, pt.z+1)
    ice.AnimState:SetBank("penguin_ice")
    ice.AnimState:SetBuild("penguin_ice")
    ice.AnimState:PlayAnimation("idle")
    ice.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    ice.AnimState:SetLayer( LAYER_BACKGROUND )
    ice.AnimState:SetSortOrder( 1 )
    ice.Transform:SetRotation( 225 )
    ice:RemoveComponent("stackable")
    ice:RemoveComponent("tradable")
    ice:RemoveComponent("inventoryitem")
    ice:AddTag("goodbye")
    ice:AddTag("NOCLICK")
    MakeLargeBurnable(ice)
    MakeLargePropagator(ice)
    local model1 = SpawnPrefab("honeycomb")
    model1.Transform:SetPosition(pt.x+2-1, 0, pt.z-2-1)
    model1.AnimState:SetBank("penguin")
    model1.AnimState:SetBuild("penguin_build")
    model1.Transform:SetFourFaced()
    model1.AnimState:PlayAnimation("idle_loop", true)
    model1.Transform:SetRotation( 270 )
    model1.Transform:SetScale(2, 2, 2)
    model1:RemoveComponent("stackable")
    model1:RemoveComponent("tradable")
    model1:RemoveComponent("inventoryitem")
    model1.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    model1:AddTag("goodbye")
    MakeLargeBurnable(model1)
    MakeLargePropagator(model1)
    local model2 = SpawnPrefab("honeycomb")
    model2.Transform:SetPosition(pt.x-2-1, 0, pt.z+2-1)
    model2.AnimState:SetBank("penguin")
    model2.AnimState:SetBuild("penguin_build")
    model2.Transform:SetFourFaced()
    model2.AnimState:PlayAnimation("idle_loop", true)
    model2.Transform:SetRotation( 90 )
    model2.Transform:SetScale(2, 2, 2)
    model2:RemoveComponent("stackable")
    model2:RemoveComponent("tradable")
    model2:RemoveComponent("inventoryitem")
    model2.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    model2:AddTag("goodbye")
    MakeLargeBurnable(model2)
    MakeLargePropagator(model2)
end

local function OnDeploy (inst, pt)
    penguinshop(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("peddler") then data.peddler = true end
    if inst:HasTag("goodbye") then data.goodbye = true end
    if inst:HasTag("penguin_1") then data.penguin_1 = true end
    if inst:HasTag("penguin_2") then data.penguin_2 = true end
    if inst:HasTag("retinue") then data.retinue = true end
end
local function onload(inst, data)
    if data and data.peddler then
       penguinshop(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.penguin_1 then
        inst.AnimState:SetBank("penguin")
        inst.AnimState:SetBuild("penguin_build")
        inst.Transform:SetFourFaced()
        inst.AnimState:PlayAnimation("idle_loop", true)
	inst.entity:AddSoundEmitter()
	local minimap = inst.entity:AddMiniMapEntity()
	minimap:SetIcon( "penguin.png" )
        MakeCharacterPhysics(inst, 50, .5)
        inst:AddComponent("follower")
        inst.components.follower:SetLeader(nil)
        local brain = require "brains/leifbrain"
        inst:SetBrain(brain)
        inst:AddComponent("locomotor")
        inst.components.locomotor.walkspeed = 0.75
        inst.components.locomotor.directdrive = false
        inst:SetStateGraph("SGpenguin")
        inst:AddComponent("combat")
        inst.components.combat.hiteffectsymbol = "body"
        inst.components.combat:SetAttackPeriod(1)
        inst.components.combat:SetRange(2.5)
        inst.components.combat:SetDefaultDamage(1)
        inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end )
        inst:AddComponent("health")
        inst.components.health:SetMaxHealth(50)
        inst.Transform:SetScale(0.7, 0.7, 0.7)
        inst:RemoveComponent("stackable")
        inst:RemoveComponent("tradable")
        inst:RemoveComponent("inventoryitem")
        inst:AddTag("penguin_1")
        inst:AddComponent("lootdropper")
        inst.components.lootdropper:SetLoot({"smallmeat", "smallmeat"})
        inst.components.inspectable.getstatus = function(inst)
            if not inst:HasTag("retinue") then
               local brain = require "brains/abigailbrain"
               inst:SetBrain(brain)
               inst.components.follower:SetLeader(GetPlayer())
               inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
               inst:AddTag("retinue")
            else
               local brain = require "brains/leifbrain"
               inst:SetBrain(brain)
               inst.components.follower:SetLeader(nil)
               inst.AnimState:SetBloomEffectHandle("")
               inst:RemoveTag("retinue")
            end
        end
        inst:DoTaskInTime(math.random(480,560), function()
            if not inst:HasTag("penguin_2") then
               inst.AnimState:PlayAnimation("taunt")
               inst.Transform:SetScale(1, 1, 1)
               inst:AddTag("penguin_2")
               inst.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"})
            end
        end )
        inst:DoPeriodicTask(math.random(120,180), function()
            if inst:HasTag("penguin_2") then
               SpawnPrefab("bird_egg").Transform:SetPosition(inst.Transform:GetWorldPosition())
            end
        end)
    end
    if data and data.penguin_2 then
        inst.Transform:SetScale(1, 1, 1)
        inst:AddTag("penguin_2")
        inst.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"})
    end
    if data and data.retinue then
        local brain = require "brains/abigailbrain"
        inst:SetBrain(brain)
        inst.components.follower:SetLeader(GetPlayer())
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        inst:AddTag("retinue")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ÷䳲ֳ1䳲ԵҼŶ䳲򲻻ֳŻƽϰԹС죬ÿֻ10ƽС㣬ֹͣ棬ٵ棨ﲻҪɱǴ㽨ȦȦɣǽǽ߼ɡ1-2С쳤ɴ죬µԼǻ쵰ҲԴȥֳͣڱϣϰ壬ϵĴ죬չÿֻ20ƽ𡣱ȺӴһֵ˰ɡʧԴСͼңʾͼꡣɱС죬2С⣨޸ĹͳСӵ1-2ƽ𣩣ɱ22ȡҪֳʱյ




.ʱгجλʱгʱժջ񡢿

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\petals_evil.luaļinst:AddComponent("inspectable")һвݣ

local function createworker(inst)
    local pt = inst:GetPosition()
    local shopsign = SpawnPrefab("petals_evil")
    shopsign.Transform:SetPosition(pt.x, pt.y, pt.z)
    shopsign.AnimState:SetBank("sign_home")
    shopsign.AnimState:SetBuild("sign_home")
    shopsign.AnimState:PlayAnimation("idle")
    shopsign.Transform:SetScale(2, 2, 2)
    shopsign:AddTag("shopsign")
    shopsign:RemoveComponent("stackable")
    shopsign:RemoveComponent("tradable")
    shopsign:RemoveComponent("fuel")
    shopsign:RemoveComponent("inventoryitem")
    shopsign:RemoveComponent("edible")
    shopsign:RemoveComponent("perishable")
    shopsign:RemoveComponent("burnable")
    shopsign:RemoveComponent("propagator")
    shopsign:RemoveComponent("deployable")
    MakeLargeBurnable(shopsign)
    MakeLargePropagator(shopsign)
    local light = shopsign.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(5)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    shopsign:DoPeriodicTask(6, function(shopsign)
        shopsign.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        shopsign:DoTaskInTime(3, function() shopsign.AnimState:SetBloomEffectHandle("") end )
    end )
    shopsign.components.inspectable.getstatus = function(shopsign)
       local pos = Vector3(shopsign.Transform:GetWorldPosition())
       local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
       for k,v in pairs(ents) do
           if v:HasTag("workerman") then
              v:Remove()
           end
       end
       local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
       local worker1 = SpawnPrefab("petals_evil")
       worker1.Transform:SetPosition(pt.x+1+3, 0, pt.z+1-3)
       worker1.AnimState:SetBank("wilson")
       worker1.buildname = names[math.random(#names)]
       worker1.AnimState:SetBuild(worker1.buildname)
       worker1.Transform:SetFourFaced()
       worker1.AnimState:OverrideSymbol("swap_hat", "hat_bee", "swap_hat")
       worker1.AnimState:Show("HAT")
       worker1.AnimState:Show("HAT_HAIR")
       worker1.AnimState:Hide("HAIR_NOHAT")
       worker1.AnimState:Hide("HAIR")
       worker1.AnimState:Show("ARM_normal") 
       worker1.AnimState:Hide("ARM_carry") 
       worker1.AnimState:PlayAnimation("idle")
       local minimap = worker1.entity:AddMiniMapEntity()
       minimap:SetIcon( "mushroom_tree_med.png" )
       local sound = worker1.entity:AddSoundEmitter()
       local shadow = worker1.entity:AddDynamicShadow()
       MakeCharacterPhysics(worker1, 75, .5)
       shadow:SetSize( 1.3, .6 )
       worker1:AddComponent("health")
       worker1.components.health:SetMaxHealth(1000)
       worker1.components.health:SetInvincible(true)
       worker1.components.health.nofadeout = true
       worker1:AddComponent("combat")
       worker1:AddComponent("follower")
       worker1:AddComponent("knownlocations")
       worker1:AddComponent("locomotor")
       worker1.components.locomotor.walkspeed = 5
       worker1.components.locomotor.runspeed = 12
       worker1:SetStateGraph("SGshadowwaxwell")
       worker1:RemoveComponent("stackable")
       worker1:RemoveComponent("tradable")
       worker1:RemoveComponent("fuel")
       worker1:RemoveComponent("inventoryitem")
       worker1:RemoveComponent("edible")
       worker1:RemoveComponent("perishable")
       worker1:RemoveComponent("burnable")
       worker1:RemoveComponent("propagator")
       worker1:RemoveComponent("deployable")
       MakeLargeBurnable(worker1)
       MakeLargePropagator(worker1)
       worker1:AddTag("workerman")
       worker1:AddComponent("trader")
       worker1.components.trader:SetAcceptTest(function(worker1, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 20) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       worker1.components.trader.onaccept = function(worker1, giver, item)
           worker1:AddTag("myworker")
           worker1:RemoveTag("workerman")
           worker1:RemoveComponent("burnable")
           worker1:RemoveComponent("propagator")
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 19)
           worker1.task1 = worker1:DoPeriodicTask(0.5, function(worker1)
               local target = FindEntity(worker1, 10, function(guy) 
                   return guy.components.pickable and guy.components.pickable:CanBePicked() and guy.prefab ~= "flower" and guy.prefab ~= "red_mushroom" and guy.prefab ~= "green_mushroom" and guy.prefab ~= "blue_mushroom" and guy.prefab ~= "flint"
               end )
               if target then
                  worker1.components.locomotor:Stop()
                  worker1:SetBrain(nil)
                  worker1.components.follower:SetLeader(nil)
                  local pt1 = target:GetPosition()
                  worker1.components.locomotor:GoToPoint(pt1)
                  worker1.task2 = worker1:DoPeriodicTask(.25, function(worker1)
                      local target2 = FindEntity(worker1, 0.8, function(guy) 
                          return guy.components.pickable and guy.components.pickable:CanBePicked() and guy.prefab ~= "flower" and guy.prefab ~= "red_mushroom" and guy.prefab ~= "green_mushroom" and guy.prefab ~= "blue_mushroom" and guy.prefab ~= "flint"
                      end )
                      if target2 then
                         worker1.AnimState:PlayAnimation("pickup")
                         target2.components.pickable:Pick(GetPlayer())
                      end
                  end )
               else
                  worker1.components.follower:SetLeader(GetPlayer())
                  local brain = require "brains/chesterbrain"
                  worker1:SetBrain(brain)
                  worker1:RestartBrain()
                  if worker1.task2 then worker1.task2:Cancel() worker1.task2 = nil end
               end
           end )
       end
       worker1:ListenForEvent( "nighttime", function() worker1:Remove() end, GetWorld())
       local worker2 = SpawnPrefab("petals_evil")
       worker2.Transform:SetPosition(pt.x+1+1, 0, pt.z+1-1)
       worker2.AnimState:SetBank("wilson")
       worker2.buildname = names[math.random(#names)]
       worker2.AnimState:SetBuild(worker2.buildname)
       worker2.Transform:SetFourFaced()
       worker2.AnimState:OverrideSymbol("swap_hat", "hat_straw", "swap_hat")
       worker2.AnimState:Show("HAT")
       worker2.AnimState:Show("HAT_HAIR")
       worker2.AnimState:Hide("HAIR_NOHAT")
       worker2.AnimState:Hide("HAIR")
       worker2.AnimState:Show("ARM_normal") 
       worker2.AnimState:Hide("ARM_carry") 
       worker2.AnimState:PlayAnimation("idle")
       local minimap = worker2.entity:AddMiniMapEntity()
       minimap:SetIcon( "mushroom_tree_med.png" )
       local sound = worker2.entity:AddSoundEmitter()
       local shadow = worker2.entity:AddDynamicShadow()
       MakeCharacterPhysics(worker2, 75, .5)
       shadow:SetSize( 1.3, .6 )
       worker2:AddComponent("health")
       worker2.components.health:SetMaxHealth(1000)
       worker2.components.health:SetInvincible(true)
       worker2.components.health.nofadeout = true
       worker2:AddComponent("combat")
       worker2:AddComponent("follower")
       worker2:AddComponent("knownlocations")
       worker2:AddComponent("locomotor")
       worker2.components.locomotor.walkspeed = 5
       worker2.components.locomotor.runspeed = 12
       worker2:SetStateGraph("SGshadowwaxwell")
       worker2:RemoveComponent("stackable")
       worker2:RemoveComponent("tradable")
       worker2:RemoveComponent("fuel")
       worker2:RemoveComponent("inventoryitem")
       worker2:RemoveComponent("edible")
       worker2:RemoveComponent("perishable")
       worker2:RemoveComponent("burnable")
       worker2:RemoveComponent("propagator")
       worker2:RemoveComponent("deployable")
       MakeLargeBurnable(worker2)
       MakeLargePropagator(worker2)
       worker2:AddTag("workerman")
       worker2:AddComponent("trader")
       worker2.components.trader:SetAcceptTest(function(worker2, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 20) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       worker2.components.trader.onaccept = function(worker2, giver, item)
           worker2:AddTag("myworker")
           worker2:RemoveTag("workerman")
           worker2:RemoveComponent("burnable")
           worker2:RemoveComponent("propagator")
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 19)
           worker2.task1 = worker2:DoPeriodicTask(0.5, function(worker2)
               local target = FindEntity(worker2, 10, function(guy) 
                   return guy.components.crop and guy.components.crop.matured
               end )
               if target then
                  worker2.components.locomotor:Stop()
                  worker2:SetBrain(nil)
                  worker2.components.follower:SetLeader(nil)
                  local pt1 = target:GetPosition()
                  worker2.components.locomotor:GoToPoint(pt1)
                  worker2.task2 = worker2:DoPeriodicTask(.25, function(worker2)
                      local target2 = FindEntity(worker2, 0.8, function(guy) 
                          return guy.components.crop and guy.components.crop.matured
                      end )
                      if target2 then
                         worker2.AnimState:PlayAnimation("pickup")
                         target2.components.crop:Harvest(GetPlayer())
                      end
                      local target3 = FindEntity(worker2, 0.8, function(guy) 
                          return guy.components.grower and guy.components.grower:IsEmpty()
                      end )
                      if target3 then
                         target3.components.grower.cycles_left = target3.components.grower.max_cycles_left
                      end
                  end )
               else
                  worker2.components.follower:SetLeader(GetPlayer())
                  local brain = require "brains/chesterbrain"
                  worker2:SetBrain(brain)
                  worker2:RestartBrain()
                  if worker2.task2 then worker2.task2:Cancel() worker2.task2 = nil end
                  if worker2.task3 then worker2.task3:Cancel() worker2.task3 = nil end
               end
           end )
       end
       worker2:ListenForEvent( "nighttime", function() worker2:Remove() end, GetWorld())
       local worker3 = SpawnPrefab("petals_evil")
       worker3.Transform:SetPosition(pt.x+1-1, 0, pt.z+1+1)
       worker3.AnimState:SetBank("wilson")
       worker3.buildname = names[math.random(#names)]
       worker3.AnimState:SetBuild(worker3.buildname)
       worker3.Transform:SetFourFaced()
       worker3.AnimState:OverrideSymbol("swap_object", "swap_axe", "swap_axe")
       worker3.AnimState:Show("ARM_carry") 
       worker3.AnimState:Hide("ARM_normal") 
       worker3.AnimState:PlayAnimation("idle")
       local minimap = worker3.entity:AddMiniMapEntity()
       minimap:SetIcon( "mushroom_tree_med.png" )
       local sound = worker3.entity:AddSoundEmitter()
       local shadow = worker3.entity:AddDynamicShadow()
       MakeCharacterPhysics(worker3, 75, .5)
       shadow:SetSize( 1.3, .6 )
       worker3:AddComponent("health")
       worker3.components.health:SetMaxHealth(1000)
       worker3.components.health:SetInvincible(true)
       worker3.components.health.nofadeout = true
       worker3:AddComponent("combat")
       worker3:AddComponent("follower")
       worker3:AddComponent("knownlocations")
       worker3:AddComponent("locomotor")
       worker3.components.locomotor.walkspeed = 5
       worker3.components.locomotor.runspeed = 12
       worker3:SetStateGraph("SGshadowwaxwell")
       worker3:RemoveComponent("stackable")
       worker3:RemoveComponent("tradable")
       worker3:RemoveComponent("fuel")
       worker3:RemoveComponent("inventoryitem")
       worker3:RemoveComponent("edible")
       worker3:RemoveComponent("perishable")
       worker3:RemoveComponent("burnable")
       worker3:RemoveComponent("propagator")
       worker3:RemoveComponent("deployable")
       MakeLargeBurnable(worker3)
       MakeLargePropagator(worker3)
       worker3:AddTag("workerman")
       worker3:AddComponent("trader")
       worker3.components.trader:SetAcceptTest(function(worker3, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 20) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       worker3.components.trader.onaccept = function(worker3, giver, item)
           worker3:AddTag("myworker")
           worker3:RemoveTag("workerman")
           worker3:RemoveComponent("burnable")
           worker3:RemoveComponent("propagator")
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 19)
           worker3.task1 = worker3:DoPeriodicTask(0.5, function(worker3)
               local target = FindEntity(worker3, 15, function(guy) 
                   return guy:HasTag("tree") and guy.components.workable and guy.components.workable.workleft > 0
               end )
               if target then
                  worker3.components.locomotor:Stop()
                  worker3:SetBrain(nil)
                  worker3.components.follower:SetLeader(nil)
                  local pt1 = target:GetPosition()
                  worker3.components.locomotor:GoToPoint(pt1)
                  worker3.task2 = worker3:DoPeriodicTask(.25, function(worker3)
                      local target2 = FindEntity(worker3, 2, function(guy) 
                          return guy:HasTag("tree") and guy.components.workable and guy.components.workable.workleft > 0
                      end )
                      if target2 then
                         worker3.AnimState:PlayAnimation("pickup")
                         target2.components.workable:Destroy(worker3)
                      end
                  end )
               else
                  worker3.components.follower:SetLeader(GetPlayer())
                  local brain = require "brains/chesterbrain"
                  worker3:SetBrain(brain)
                  worker3:RestartBrain()
                  if worker3.task2 then worker3.task2:Cancel() worker3.task2 = nil end
               end
           end )
       end
       worker3:ListenForEvent( "nighttime", function() worker3:Remove() end, GetWorld())
       local worker4 = SpawnPrefab("petals_evil")
       worker4.Transform:SetPosition(pt.x+1-3, 0, pt.z+1+3)
       worker4.AnimState:SetBank("wilson")
       worker4.buildname = names[math.random(#names)]
       worker4.AnimState:SetBuild(worker4.buildname)
       worker4.Transform:SetFourFaced()
       worker4.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat")
       worker4.AnimState:Show("HAT")
       worker4.AnimState:Show("HAT_HAIR")
       worker4.AnimState:Hide("HAIR_NOHAT")
       worker4.AnimState:Hide("HAIR")
       worker4.AnimState:OverrideSymbol("swap_object", "swap_pickaxe", "swap_pickaxe")
       worker4.AnimState:Show("ARM_carry") 
       worker4.AnimState:Hide("ARM_normal") 
       worker4.AnimState:PlayAnimation("idle")
       local minimap = worker4.entity:AddMiniMapEntity()
       minimap:SetIcon( "mushroom_tree_med.png" )
       local sound = worker4.entity:AddSoundEmitter()
       local shadow = worker4.entity:AddDynamicShadow()
       MakeCharacterPhysics(worker4, 75, .5)
       shadow:SetSize( 1.3, .6 )
       worker4:AddComponent("health")
       worker4.components.health:SetMaxHealth(1000)
       worker4.components.health:SetInvincible(true)
       worker4.components.health.nofadeout = true
       worker4:AddComponent("combat")
       worker4:AddComponent("follower")
       worker4:AddComponent("knownlocations")
       worker4:AddComponent("locomotor")
       worker4.components.locomotor.walkspeed = 5
       worker4.components.locomotor.runspeed = 12
       worker4:SetStateGraph("SGshadowwaxwell")
       worker4:RemoveComponent("stackable")
       worker4:RemoveComponent("tradable")
       worker4:RemoveComponent("fuel")
       worker4:RemoveComponent("inventoryitem")
       worker4:RemoveComponent("edible")
       worker4:RemoveComponent("perishable")
       worker4:RemoveComponent("burnable")
       worker4:RemoveComponent("propagator")
       worker4:RemoveComponent("deployable")
       MakeLargeBurnable(worker4)
       MakeLargePropagator(worker4)
       worker4:AddTag("workerman")
       worker4:AddComponent("trader")
       worker4.components.trader:SetAcceptTest(function(worker4, item) 
           if GetPlayer().components.inventory:Has("goldnugget", 20) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
           return false
       end )
       worker4.components.trader.onaccept = function(worker4, giver, item)
           worker4:AddTag("myworker")
           worker4:RemoveTag("workerman")
           worker4:RemoveComponent("burnable")
           worker4:RemoveComponent("propagator")
           GetPlayer().components.inventory:ConsumeByName("goldnugget", 19)
           worker4.task1 = worker4:DoPeriodicTask(0.5, function(worker4)
               local target = FindEntity(worker4, 15, function(guy) 
                   return guy.prefab == "rock1" or guy.prefab == "rock2" or guy.prefab == "rock_flintless" or guy.prefab == "rock_flintless_med" or guy.prefab == "rock_flintless_low" or guy.prefab == "rock_ice"
               end )
               if target then
                  worker4.components.locomotor:Stop()
                  worker4:SetBrain(nil)
                  worker4.components.follower:SetLeader(nil)
                  local pt1 = target:GetPosition()
                  worker4.components.locomotor:GoToPoint(pt1)
                  worker4.task2 = worker4:DoPeriodicTask(.25, function(worker4)
                      local target2 = FindEntity(worker4, 2, function(guy) 
                          return guy.prefab == "rock1" or guy.prefab == "rock2" or guy.prefab == "rock_flintless" or guy.prefab == "rock_flintless_med" or guy.prefab == "rock_flintless_low" or guy.prefab == "rock_ice"
                      end )
                      if target2 then
                         worker4.AnimState:PlayAnimation("pickup")
                         target2.components.workable:Destroy(worker4)
                      end
                  end )
               else
                  worker4.components.follower:SetLeader(GetPlayer())
                  local brain = require "brains/chesterbrain"
                  worker4:SetBrain(brain)
                  worker4:RestartBrain()
                  if worker4.task2 then worker4.task2:Cancel() worker4.task2 = nil end
               end
           end )
       end
       worker4:ListenForEvent( "nighttime", function() worker4:Remove() end, GetWorld())
    end
    local shopsign1 = SpawnPrefab("petals_evil")
    shopsign1.Transform:SetPosition(pt.x+2+3, 0, pt.z+2-3)
    shopsign1.AnimState:SetBank("sign_home")
    shopsign1.AnimState:SetBuild("sign_home")
    shopsign1.AnimState:PlayAnimation("idle")
    shopsign1.Transform:SetScale(0.5, 0.5, 0.5)
    shopsign1:RemoveComponent("stackable")
    shopsign1:RemoveComponent("tradable")
    shopsign1:RemoveComponent("fuel")
    shopsign1:RemoveComponent("inventoryitem")
    shopsign1:RemoveComponent("edible")
    shopsign1:RemoveComponent("perishable")
    shopsign1:RemoveComponent("burnable")
    shopsign1:RemoveComponent("propagator")
    shopsign1:RemoveComponent("deployable")
    MakeLargeBurnable(shopsign1)
    MakeLargePropagator(shopsign1)
    shopsign1:AddTag("goodbye")
    local shopsign2 = SpawnPrefab("petals_evil")
    shopsign2.Transform:SetPosition(pt.x+2+1, 0, pt.z+2-1)
    shopsign2.AnimState:SetBank("sign_home")
    shopsign2.AnimState:SetBuild("sign_home")
    shopsign2.AnimState:PlayAnimation("idle")
    shopsign2.Transform:SetScale(0.5, 0.5, 0.5)
    shopsign2:RemoveComponent("stackable")
    shopsign2:RemoveComponent("tradable")
    shopsign2:RemoveComponent("fuel")
    shopsign2:RemoveComponent("inventoryitem")
    shopsign2:RemoveComponent("edible")
    shopsign2:RemoveComponent("perishable")
    shopsign2:RemoveComponent("burnable")
    shopsign2:RemoveComponent("propagator")
    shopsign2:RemoveComponent("deployable")
    MakeLargeBurnable(shopsign2)
    MakeLargePropagator(shopsign2)
    shopsign2:AddTag("goodbye")
    local shopsign3 = SpawnPrefab("petals_evil")
    shopsign3.Transform:SetPosition(pt.x+2-1, 0, pt.z+2+1)
    shopsign3.AnimState:SetBank("sign_home")
    shopsign3.AnimState:SetBuild("sign_home")
    shopsign3.AnimState:PlayAnimation("idle")
    shopsign3.Transform:SetScale(0.5, 0.5, 0.5)
    shopsign3:RemoveComponent("stackable")
    shopsign3:RemoveComponent("tradable")
    shopsign3:RemoveComponent("fuel")
    shopsign3:RemoveComponent("inventoryitem")
    shopsign3:RemoveComponent("edible")
    shopsign3:RemoveComponent("perishable")
    shopsign3:RemoveComponent("burnable")
    shopsign3:RemoveComponent("propagator")
    shopsign3:RemoveComponent("deployable")
    MakeLargeBurnable(shopsign3)
    MakeLargePropagator(shopsign3)
    shopsign3:AddTag("goodbye")
    local shopsign4 = SpawnPrefab("petals_evil")
    shopsign4.Transform:SetPosition(pt.x+2-3, 0, pt.z+2+3)
    shopsign4.AnimState:SetBank("sign_home")
    shopsign4.AnimState:SetBuild("sign_home")
    shopsign4.AnimState:PlayAnimation("idle")
    shopsign4.Transform:SetScale(0.5, 0.5, 0.5)
    shopsign4:RemoveComponent("stackable")
    shopsign4:RemoveComponent("tradable")
    shopsign4:RemoveComponent("fuel")
    shopsign4:RemoveComponent("inventoryitem")
    shopsign4:RemoveComponent("edible")
    shopsign4:RemoveComponent("perishable")
    shopsign4:RemoveComponent("burnable")
    shopsign4:RemoveComponent("propagator")
    shopsign4:RemoveComponent("deployable")
    MakeLargeBurnable(shopsign4)
    MakeLargePropagator(shopsign4)
    shopsign4:AddTag("goodbye")
end
local function OnDeploy (inst, pt)
    createworker(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("shopsign") then
        data.shopsign = true
    end
    if inst:HasTag("workerman") then
        data.workerman = true
    end
    if inst:HasTag("myworker") then
        data.myworker = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
end
local function onload(inst, data)
    if data and data.shopsign then
       createworker(inst)
       inst:Remove()
    end
    if data and data.workerman then
       inst:Remove()
    end
    if data and data.myworker then
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    جλʱг1جλԵҼŶجλ꣬򲻻ֳƣ4ʱӦƸҷֱǲժժֲũջũﲢʩʣľ󹤣󣩣Ӷʲô֣Żƽÿÿ20ƽٴεƣԻͬӦƸԱѡ񡣹Ӷʱ㣬Զʼɻ档ɴСͼѯʱλãʾΪɫĢͼꡣʱÿҹʱ°࣬㻨ѵĹʸֵã;Ӷǡʱʹ浵˳ٶǾͱǲɢˡҪʱгʱյ




Ű.ҵĹ֭꣨ҩֹ֭꣬Լ֭˿Ź

    ü±ϷĿ¼\data\scripts\prefabs\healingsalve.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "cave_banana" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)}
local widgetbuttoninfo = {
    text = "Start",
    position = Vector3(0, -165, 0),
    fn = function(inst)
      if inst:HasTag("juicer") and inst.components.container:Has("cave_banana", 1) and inst.components.container:Has("pomegranate", 1) and inst.components.container:Has("dragonfruit", 1) then
         inst.components.container:ConsumeByName("cave_banana", 1)
         inst.components.container:ConsumeByName("pomegranate", 1)
         inst.components.container:ConsumeByName("dragonfruit", 1)
         GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
         local sweets = SpawnPrefab("healingsalve")
         sweets.AnimState:SetBank("food")
         sweets.AnimState:SetBuild("cook_pot_food")
         sweets.AnimState:PlayAnimation("fruitmedley", false)
         sweets:RemoveComponent("stackable")
         sweets:RemoveComponent("deployable")
         sweets.components.healer:SetHealthAmount(TUNING.HEALING_SUPERHUGE)
         sweets.components.inventoryitem:ChangeImageName("fruitmedley")
         sweets.Transform:SetScale(1.2, 1.2, 1.2)
         sweets:AddTag("sweets")
         GetPlayer().components.inventory:GiveItem(sweets)
      end
    end }
    inst:AddComponent("container")
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,180,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.canbeopened = false
local function sweetshop(inst)
    local pt = inst:GetPosition()
    local shop = SpawnPrefab("healingsalve")
    shop.Transform:SetPosition(pt.x, pt.y, pt.z)
    shop.AnimState:SetBank("rabbithouse")
    shop.AnimState:SetBuild("rabbit_house")
    shop.AnimState:PlayAnimation("idle", true)
    shop.Transform:SetScale(0.8, 0.8, 0.8)
    shop:RemoveComponent("stackable")
    shop:RemoveComponent("inventoryitem")
    shop:RemoveComponent("healer")
    shop:RemoveComponent("deployable")
    local light = shop.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(5)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    MakeLargeBurnable(shop)
    MakeLargePropagator(shop)
    shop:AddTag("shop")
    shop:DoPeriodicTask(2, function(shop)
        shop.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        shop:DoTaskInTime(1, function() shop.AnimState:SetBloomEffectHandle("") end )
    end )
    shop:AddComponent("trader")
    shop.components.trader:SetAcceptTest(function(shop, item) 
        if item.prefab == "goldnugget" then
           return true
        end
        return false
    end )
    shop.components.trader.onaccept = function(shop, giver, item)
        local names = {"cave_banana","pomegranate","dragonfruit"}
        local name = names[math.random(#names)]
        local veggie = SpawnPrefab(name)
        if item.prefab == "goldnugget" then
           giver.components.inventory:GiveItem(veggie)
        end
    end
    local counter = SpawnPrefab("healingsalve")
    counter.Transform:SetPosition(pt.x+2+1.8, 0, pt.z+2-1.8)
    counter.AnimState:SetBank("winter_meter")
    counter.AnimState:SetBuild("winter_meter")
    counter.AnimState:SetPercent("meter", 0)
    counter.Transform:SetScale(1.2, 1.2, 1.2)
    counter.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    counter.AnimState:SetLayer( LAYER_BACKGROUND )
    counter.AnimState:SetSortOrder( 1 )
    counter.Transform:SetRotation( 135 )
    counter.AnimState:SetMultColour(255/255,255/255,255/255,0)
    counter:RemoveComponent("stackable")
    counter:RemoveComponent("inventoryitem")
    counter:RemoveComponent("healer")
    counter:RemoveComponent("deployable")
    MakeLargeBurnable(counter)
    MakeLargePropagator(counter)
    counter:AddTag("NOCLICK")
    counter:AddTag("goodbye")
    local juicer = SpawnPrefab("healingsalve")
    juicer.Transform:SetPosition(pt.x+1-2, 0, pt.z+1+2)
    juicer.AnimState:SetBank("researchlab2")
    juicer.AnimState:SetBuild("researchlab2")
    juicer.AnimState:PlayAnimation("idle")
    juicer.Transform:SetScale(0.8, 0.8, 0.8)
    juicer.AnimState:SetMultColour(255/255,105/255,0/255,1)
    juicer:RemoveComponent("stackable")
    juicer:RemoveComponent("inventoryitem")
    juicer:RemoveComponent("healer")
    juicer:RemoveComponent("deployable")
    juicer.components.container.canbeopened = true
    MakeLargeBurnable(juicer)
    MakeLargePropagator(juicer)
    juicer:AddTag("juicer")
    juicer:AddTag("goodbye")
    local sweetsign = SpawnPrefab("healingsalve")
    sweetsign.Transform:SetPosition(pt.x+1+2, 0, pt.z+1-2)
    sweetsign.AnimState:SetBank("sign_home")
    sweetsign.AnimState:SetBuild("sign_home")
    sweetsign.AnimState:PlayAnimation("idle")
    sweetsign.Transform:SetScale(0.8, 0.8, 0.8)
    sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1)
    MakeLargeBurnable(sweetsign)
    MakeLargePropagator(sweetsign)
    sweetsign:AddTag("goodbye")
    sweetsign:RemoveComponent("stackable")
    sweetsign:RemoveComponent("inventoryitem")
    sweetsign:RemoveComponent("healer")
    sweetsign:RemoveComponent("deployable")
    sweetsign:ListenForEvent( "nighttime", function()
        sweetsign:RemoveTag("openshop")
        GetPlayer().SoundEmitter:KillSound("beavermusic")
        sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1)
        local pos = Vector3(sweetsign.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
        for k,v in pairs(ents) do
            if v:HasTag("customers") then
               v:Remove()
            end
        end
    end, GetWorld())
    sweetsign.components.inspectable.getstatus = function(sweetsign)
      if not sweetsign:HasTag("openshop") then
        local target0 = FindEntity(sweetsign, 10, function(guy) 
            return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld()
        end )
        if target0 then
           sweetsign:AddTag("openshop")
           GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic")
           sweetsign.AnimState:SetMultColour(0/255,255/255,0/255,1)
           for k = 1, math.random(8,16) do
               local pt1 = sweetsign:GetPosition()
               local customer = SpawnPrefab("healingsalve")
               customer.Transform:SetPosition(pt1.x+(math.random(30)-math.random(30)), 0, pt1.z+(math.random(30)-math.random(30)))
               customer.AnimState:SetBank("wilson")
               local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
               local buildname = names[math.random(#names)]
               customer.AnimState:SetBuild(buildname)
               local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter"}
               local hat = hats[math.random(#hats)]
               customer.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
               local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood"}
               local armor = armors[math.random(#armors)]
               customer.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
               customer.AnimState:Show("HAT")
               customer.AnimState:Show("HAT_HAIR")
               customer.AnimState:Hide("HAIR_NOHAT")
               customer.AnimState:Hide("HAIR")
               customer.AnimState:Hide("ARM_carry")
               customer.AnimState:Show("ARM_normal")
               customer.AnimState:PlayAnimation("idle")
               customer.Transform:SetFourFaced()
               local sound = customer.entity:AddSoundEmitter()
               local shadow = customer.entity:AddDynamicShadow()
               shadow:SetSize( 1.3, .6 )
               customer:RemoveComponent("stackable")
               customer:RemoveComponent("inventoryitem")
               customer:RemoveComponent("healer")
               customer:RemoveComponent("deployable")
               customer:AddComponent("locomotor")
               customer.components.locomotor.walkspeed = 4
               customer.components.locomotor.runspeed = 8
               customer:SetStateGraph("SGshadowwaxwell")
               local brain = require "brains/frogbrain"
               customer:SetBrain(brain)
               customer:AddComponent("health")
               customer.components.health:SetMaxHealth(1000)
               customer.components.health:SetInvincible(true)
               customer.components.health.nofadeout = true
               customer:AddComponent("combat")
               customer:AddComponent("knownlocations")
               customer:AddTag("customers")
               customer:AddTag("goodbye")
               customer.task1 = customer:DoPeriodicTask(3, function(customer)
                   if math.random() < 0.1 then
                      local target = FindEntity(customer, 100, function(guy) 
                          return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld()
                      end )
                      if target then
                         customer.components.locomotor:Stop()
                         customer:SetBrain(nil)
                         customer.components.locomotor:GoToEntity(target)
                         customer.task2 = customer:DoPeriodicTask(.25, function(customer)
                             local target2 = FindEntity(customer, 1, function(guy) 
                                 return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld()
                             end )
                             if target2 then
                                customer.AnimState:PlayAnimation("pickup")
                                for k = 1, 6 do
                                    SpawnPrefab("goldnugget").Transform:SetPosition(target2.Transform:GetWorldPosition())
                                end
                                target2:Remove()
                                local brain = require "brains/frogbrain"
                                customer:SetBrain(brain)
                                customer:RestartBrain()
                                if customer.task2 then customer.task2:Cancel() customer.task2 = nil end
                             end
                         end )
                         customer:DoTaskInTime(8, function(customer)
                             local brain = require "brains/frogbrain"
                             customer:SetBrain(brain)
                             customer:RestartBrain()
                             if customer.task2 then customer.task2:Cancel() customer.task2 = nil end
                         end )
                      else
                         local brain = require "brains/frogbrain"
                         customer:SetBrain(brain)
                         customer:RestartBrain()
                         if customer.task2 then customer.task2:Cancel() customer.task2 = nil end
                      end
                   end
               end )
           end
        end
      else
        sweetsign:RemoveTag("openshop")
        GetPlayer().SoundEmitter:KillSound("beavermusic")
        sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1)
        local pos = Vector3(sweetsign.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
        for k,v in pairs(ents) do
            if v:HasTag("customers") then
               v:Remove()
            end
        end
      end
    end
end
local function OnDeploy (inst, pt)
    sweetshop(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("shop") then
        data.shop = true
    end
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("sweets") then
        data.sweets = true
    end
end
local function onload(inst, data)
    if data and data.shop then
       sweetshop(inst)
       inst:Remove()
    end
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.sweets then
       inst.AnimState:SetBank("food")
       inst.AnimState:SetBuild("cook_pot_food")
       inst.AnimState:PlayAnimation("fruitmedley", false)
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("deployable")
       inst.components.healer:SetHealthAmount(TUNING.HEALING_SUPERHUGE)
       inst.components.inventoryitem:ChangeImageName("fruitmedley")
       inst.Transform:SetScale(1.2, 1.2, 1.2)
       inst:AddTag("sweets")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ҩҵĹ֭꣨1ҩԵҼŶҩ࣬򲻻ֳŻƽԿⷿܲԹ֭ԭϣֱǻ㽶ʯÿˮ1ƽ𣬵ȻҲԼֵˮˮұߵե֭ˮե֭ȻStartťʼե֭ե֭ԶװƷ֭ڹ̨ϣϰ͸ĳΣߵӾͿԿˣ̨ûй֭޷ţй˿Źÿۼ6ƽȣٴεӼɡҹʱԶȣؼϢɣȻҲٴεӿţҹĹ˿Ͷ˯۵Ĺ֭ԼҲԺȣƷԹ֭ҼɴֵҪ֭ʱյɣǵȴŶҩѡף£2ҡ1ʯͷ1֩




ž.гľ̿г̯λϰƷ30ˢһΣȫһ3ƽ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\charcoal.luaļinst:AddComponent("inspectable")һвݣ

local function createfleashop(inst)
    local pt = inst:GetPosition()
    local seller = SpawnPrefab("charcoal")
    seller.Transform:SetPosition(pt.x, pt.y, pt.z)
    seller.AnimState:SetBank("wilson")
    local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
    local buildname = buildnames[math.random(#buildnames)]
    seller.AnimState:SetBuild(buildname)
    local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"}
    local hat = hats[math.random(#hats)]
    seller.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
    local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"}
    local armor = armors[math.random(#armors)]
    seller.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
    seller.AnimState:Show("HAT")
    seller.AnimState:Show("HAT_HAIR")
    seller.AnimState:Hide("HAIR_NOHAT")
    seller.AnimState:Hide("HAIR")
    seller.AnimState:Hide("ARM_carry")
    seller.AnimState:Show("ARM_normal")
    seller.AnimState:PlayAnimation("idle")
    seller.Transform:SetFourFaced()
    seller:RemoveComponent("stackable")
    seller:RemoveComponent("fuel")
    seller:RemoveComponent("inventoryitem")
    seller:RemoveComponent("burnable")
    seller:RemoveComponent("propagator")
    seller:RemoveComponent("deployable")
    seller:RemoveComponent("bait")
    seller:RemoveTag("molebait")
    seller:AddComponent("talker")
    seller:AddComponent("workable")
    seller.components.workable:SetWorkAction(ACTIONS.HAMMER)
    seller.components.workable:SetWorkLeft(3)
    seller.components.workable:SetOnFinishCallback(function(seller)
        SpawnPrefab("collapse_big").Transform:SetPosition(seller.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos = Vector3(seller.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 6)
        for k,v in pairs(ents) do
            if v:HasTag("commodity") then
               v:Remove()
            end
            if v:HasTag("fleas") then
               v:Remove()
            end
        end
        seller:Remove()
    end )
    seller:AddTag("sellers")
    local flea = SpawnPrefab("charcoal")
    flea.Transform:SetPosition(pt.x+2.8+1.2, 0, pt.z-2.8+1.2)
    flea.AnimState:SetBank("winter_meter")
    flea.AnimState:SetBuild("winter_meter")
    flea.AnimState:SetPercent("meter", 0)
    flea.Transform:SetScale(1.5, 1.5, 1.5)
    flea.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    flea.AnimState:SetLayer( LAYER_BACKGROUND )
    flea.AnimState:SetSortOrder( 1 )
    flea.Transform:SetRotation( 135 )
    flea.AnimState:SetMultColour(255/255,255/255,255/255,0)
    flea:RemoveComponent("stackable")
    flea:RemoveComponent("fuel")
    flea:RemoveComponent("inventoryitem")
    flea:RemoveComponent("burnable")
    flea:RemoveComponent("propagator")
    flea:RemoveComponent("deployable")
    flea:RemoveComponent("bait")
    flea:RemoveTag("molebait")
    flea:AddTag("NOCLICK")
    flea:AddTag("fleas")
    local light = flea.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(5)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    for k = 0,4 do
        local names = {"amulet","blueamulet","purpleamulet","orangeamulet","greenamulet","yellowamulet","armorgrass","armormarble","armorruins","armor_sanity","armorslurper","armorsnurtleshell","armorwood","axe","goldenaxe","multitool_axe_pickaxe","bandage","batbat","bedroll_furry","bedroll_straw","trunkvest_summer","blowdart_sleep","blowdart_fire","blowdart_pipe","boomerang","bugnet","butter","cane","compass","deerclops_eyeball","diviningrod","eyeturret_item","fishingrod","gunpowder","hambat","hammer","footballhat","strawhat","tophat","flowerhat","beefalohat","featherhat","beehat","walrushat","earmuffshat","winterhat","minerhat","spiderhat","bushhat","slurtlehat","ruinshat","healingsalve","heatrock","nightsword","lantern","panflute","pickaxe","goldenpickaxe","pitchfork","razor","ruins_bat","shovel","goldenshovel","spear","icestaff","firestaff","telestaff","orangestaff","greenstaff","yellowstaff","sweatervest","teleportato_ring","teleportato_box","teleportato_crank","teleportato_potato","tentaclespike","torch","trunkvest_winter","umbrella","fertilizer","bell","spear_wathgrithr","grass_umbrella","rainhat","icehat","watermelonhat","catcoonhat","wathgrithrhat","raincoat","molehat","armordragonfly","beargervest","featherfan","staff_tornado","nightstick","eyebrellahat","reflectivevest","hawaiianshirt"}
        local name = names[math.random(#names)]
        local commodity = SpawnPrefab(name)
        commodity.Transform:SetPosition(pt.x+2+1.3-k*1, 0, pt.z-2+1.3+k*1)
        commodity.components.inventoryitem.canbepickedup = false
        commodity.persists = false
        commodity:AddComponent("trader")
        commodity.components.trader:SetAcceptTest(function(commodity, item) 
            if GetPlayer().components.inventory:Has("goldnugget", 3) then
               if item.prefab == "goldnugget" then
                  return true
               end
            end
            return false
        end )
        commodity.components.trader.onaccept = function(commodity, giver, item)
            GetPlayer().components.inventory:ConsumeByName("goldnugget", 2)
            commodity.components.inventoryitem.canbepickedup = true
            commodity:RemoveTag("commodity")
            GetPlayer().components.inventory:GiveItem(commodity)
            commodity:RemoveComponent("trader")
            commodity.persists = true
        end
        commodity:AddTag("commodity")
    end
    seller:DoPeriodicTask(30, function(seller)
        seller.components.talker:Say("everythings, 3 golds", 5, false)
        seller.AnimState:PlayAnimation("give")
        local pos = Vector3(seller.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 6)
        for k,v in pairs(ents) do
            if v:HasTag("commodity") then
               v:Remove()
            end
        end
        for k = 0,4 do
            local names = {"amulet","blueamulet","purpleamulet","orangeamulet","greenamulet","yellowamulet","armorgrass","armormarble","armorruins","armor_sanity","armorslurper","armorsnurtleshell","armorwood","axe","goldenaxe","multitool_axe_pickaxe","bandage","batbat","bedroll_furry","bedroll_straw","trunkvest_summer","blowdart_sleep","blowdart_fire","blowdart_pipe","boomerang","bugnet","butter","cane","compass","deerclops_eyeball","diviningrod","eyeturret_item","fishingrod","gunpowder","hambat","hammer","footballhat","strawhat","tophat","flowerhat","beefalohat","featherhat","beehat","walrushat","earmuffshat","winterhat","minerhat","spiderhat","bushhat","slurtlehat","ruinshat","healingsalve","heatrock","nightsword","lantern","panflute","pickaxe","goldenpickaxe","pitchfork","razor","ruins_bat","shovel","goldenshovel","spear","icestaff","firestaff","telestaff","orangestaff","greenstaff","yellowstaff","sweatervest","teleportato_ring","teleportato_box","teleportato_crank","teleportato_potato","tentaclespike","torch","trunkvest_winter","umbrella","fertilizer","bell","spear_wathgrithr","grass_umbrella","rainhat","icehat","watermelonhat","catcoonhat","wathgrithrhat","raincoat","molehat","armordragonfly","beargervest","featherfan","staff_tornado","nightstick","eyebrellahat","reflectivevest","hawaiianshirt"}
            local name = names[math.random(#names)]
            local commodity = SpawnPrefab(name)
            commodity.Transform:SetPosition(pt.x+2+1.3-k*1, 0, pt.z-2+1.3+k*1)
            commodity.components.inventoryitem.canbepickedup = false
            commodity.persists = false
            commodity:AddTag("commodity")
            commodity:AddComponent("trader")
            commodity.components.trader:SetAcceptTest(function(commodity, item) 
                if GetPlayer().components.inventory:Has("goldnugget", 3) then
                   if item.prefab == "goldnugget" then
                      return true
                   end
                end
                return false
            end )
            commodity.components.trader.onaccept = function(commodity, giver, item)
                GetPlayer().components.inventory:ConsumeByName("goldnugget", 2)
                commodity.components.inventoryitem.canbepickedup = true
                commodity:RemoveTag("commodity")
                GetPlayer().components.inventory:GiveItem(commodity)
                commodity:RemoveComponent("trader")
                commodity.persists = true
            end
        end
    end)
end
local function OnDeploy (inst, pt)
   createfleashop(inst)
   inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("sellers") then
        data.sellers = true
    end
    if inst:HasTag("fleas") then
        data.fleas = true
    end
end
local function onload(inst, data)
    if data and data.sellers then
       createfleashop(inst)
       inst:Remove()
    end
    if data and data.fleas then
       inst:Remove()
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    1ľ̿ԿյصҼֳг̯λöľֳ̿ÿ30չʾ5ƷļŻƽǼƷȫһ3ƽ𡣵Ϊֶг̯λγƷһ֣̯λ䲻Ҫ̫ӰչʾƷҪгʱôҵɣǨ




.СëƤ̸СҩסԺ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bedroll_furry.luaļinst:AddComponent("inspectable")һвݣ

local function createhospital(inst)
    local pt = inst:GetPosition()
    local nurse = SpawnPrefab("bedroll_furry")
    nurse.Transform:SetPosition(pt.x, pt.y, pt.z)
    nurse.AnimState:SetBank("wilson")
    nurse.AnimState:SetBuild("wendy")
    nurse.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body")
    nurse.AnimState:Hide("ARM_carry")
    nurse.AnimState:Show("ARM_normal")
    nurse.Transform:SetFourFaced()
    nurse.AnimState:PlayAnimation("idle")
    nurse:RemoveComponent("inventoryitem")
    nurse:RemoveComponent("finiteuses")
    nurse:RemoveComponent("fuel")
    nurse:RemoveComponent("sleepingbag")
    nurse:RemoveComponent("deployable")
    MakeLargeBurnable(nurse)
    MakeLargePropagator(nurse)
    nurse:AddTag("nurse")
    local light = nurse.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(5)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    nurse:AddComponent("trader")
    nurse.components.trader:SetAcceptTest(function(nurse, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    nurse.components.trader.onaccept = function(nurse, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        GetPlayer().components.playercontroller:Enable(false)
        nurse.AnimState:OverrideSymbol("swap_object", "swap_hammer", "swap_hammer")
        nurse.AnimState:Hide("ARM_normal")
        nurse.AnimState:Show("ARM_carry")
        nurse.task = nurse:DoPeriodicTask(1, function(nurse)
            nurse.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180)
            nurse.AnimState:PlayAnimation("pickaxe_pre")
            nurse.AnimState:PlayAnimation("pickaxe_loop", false)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
            GetPlayer().sg:GoToState("hit")
        end )
        nurse:DoTaskInTime(5, function()
            TheFrontEnd:Fade(false,1)
            if nurse.task then nurse.task:Cancel() nurse.task = nil end
            nurse.Transform:SetRotation(0)
            nurse:DoTaskInTime(1, function()
                nurse.AnimState:Hide("ARM_carry")
                nurse.AnimState:Show("ARM_normal")
                nurse.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                nurse:DoTaskInTime(3, function() nurse.AnimState:PlayAnimation("idle") end )
                TheFrontEnd:Fade(true,1)
                GetPlayer().components.health:DoDelta(GetPlayer().components.health.maxhealth)
                if GetPlayer():HasTag("poisoning") or GetPlayer():HasTag("fever") then
                   if GetPlayer():HasTag("poisoning") then GetPlayer():RemoveTag("poisoning") end
                   if GetPlayer():HasTag("fever") then GetPlayer():RemoveTag("fever") end
                   if GetPlayer().poison then GetPlayer().poison:Cancel() GetPlayer().poison = nil end
                   if GetPlayer().fever then GetPlayer().fever:Cancel() GetPlayer().fever = nil end
                   GetPlayer().AnimState:SetMultColour(255/255,255/255,255/255,1)
                   GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
                   GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
                   GetPlayer().components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
                end
                GetPlayer().sg:GoToState("wakeup")
                GetPlayer().components.playercontroller:Enable(true)
            end )
        end )
    end
    local medicinebox = SpawnPrefab("bedroll_furry")
    medicinebox.Transform:SetPosition(pt.x+1.2, 0, pt.z-1.2)
    medicinebox.AnimState:SetBank("icebox")
    medicinebox.AnimState:SetBuild("ice_box")
    medicinebox.AnimState:PlayAnimation("closed")
    medicinebox.Transform:SetScale(0.5, 0.5, 0.5)
    medicinebox:RemoveComponent("inventoryitem")
    medicinebox:RemoveComponent("finiteuses")
    medicinebox:RemoveComponent("fuel")
    medicinebox:RemoveComponent("sleepingbag")
    medicinebox:RemoveComponent("deployable")
    MakeLargeBurnable(medicinebox)
    MakeLargePropagator(medicinebox)
    medicinebox:AddTag("goodbye")
    medicinebox:AddComponent("trader")
    medicinebox.components.trader:SetAcceptTest(function(medicinebox, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    medicinebox.components.trader.onaccept = function(medicinebox, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        local medicine = SpawnPrefab("bedroll_furry")
        medicine.AnimState:SetBank("carrot")
        medicine.AnimState:SetBuild("carrot")
        medicine.AnimState:PlayAnimation("cooked")
        medicine.components.inventoryitem:ChangeImageName("carrot_cooked")
        medicine:RemoveComponent("finiteuses")
        medicine:RemoveComponent("fuel")
        medicine:RemoveComponent("sleepingbag")
        medicine:RemoveComponent("burnable")
        medicine:RemoveComponent("propagator")
        medicine:RemoveComponent("deployable")
        medicine:AddComponent("edible")
        medicine.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5
        medicine.components.edible.hungervalue = 0
        medicine.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5
        medicine.components.edible.foodtype = "VEGGIE"
        medicine:AddTag("medicine")
        GetPlayer().components.inventory:GiveItem(medicine)
    end
    local hospital = SpawnPrefab("bedroll_furry")
    hospital.Transform:SetPosition(pt.x-2, 0, pt.z-2)
    hospital.AnimState:SetBank("tent")
    hospital.AnimState:SetBuild("tent")
    hospital.AnimState:PlayAnimation("idle", true)
    hospital.Transform:SetScale(1.2, 1.2, 1.2)
    hospital:RemoveComponent("inventoryitem")
    hospital:RemoveComponent("finiteuses")
    hospital:RemoveComponent("fuel")
    hospital:RemoveComponent("sleepingbag")
    hospital:RemoveComponent("deployable")
    MakeLargeBurnable(hospital)
    MakeLargePropagator(hospital)
    hospital:AddTag("goodbye")
    hospital:AddComponent("trader")
    hospital.components.trader:SetAcceptTest(function(hospital, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 5) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    hospital.components.trader.onaccept = function(hospital, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
        GetPlayer().components.playercontroller:Enable(false)
        TheFrontEnd:Fade(false,1)
        hospital:DoTaskInTime(2, function()
            TheFrontEnd:Fade(true,1)
            GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
            GetPlayer().components.playercontroller:Enable(true)
        end )
    end
end
local function OnDeploy (inst, pt)
    createhospital(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("nurse") then
        data.nurse = true
    end
    if inst:HasTag("medicine") then
        data.medicine = true
    end
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.nurse then
       createhospital(inst)
       inst:Remove()
    end
    if data and data.medicine then
       inst.AnimState:SetBank("carrot")
       inst.AnimState:SetBuild("carrot")
       inst.AnimState:PlayAnimation("cooked")
       inst.components.inventoryitem:ChangeImageName("carrot_cooked")
       inst:RemoveComponent("finiteuses")
       inst:RemoveComponent("fuel")
       inst:RemoveComponent("sleepingbag")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveComponent("deployable")
       inst:AddComponent("edible")
       inst.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5
       inst.components.edible.hungervalue = 0
       inst.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5
       inst.components.edible.foodtype = "VEGGIE"
       inst:AddTag("medicine")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ëƤ̸Сʿ5ƽŻƽԻʿΪֵָͬʱ޸ˡСС֡Ҳðʳж5ƽסԺֵָ󡣸ҩ5ƽ𣬿һҩ˿ɲһֵҪСʱյɡëƤ̸ѡף£1ϯ2β




һ.֩루ʳƤֶ֩볡֩ׯPKӮ

    ü±ϷĿ¼\data\scripts\prefabs\slurperpelt.luaļinst:AddComponent("inspectable")һвݣ

local colours=
{
    {198/255,43/255,43/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {233/255,208/255,69/255},
    {109/255,50/255,163/255},
    {222/255,126/255,39/255},
}
local function boxing(inst)
    local pt = inst:GetPosition()
    local boxer = SpawnPrefab("slurper_pelt")
    boxer.Transform:SetPosition(pt.x, pt.y, pt.z)
    boxer.AnimState:SetBank("wilson")
    boxer.AnimState:SetBuild("wes")
    boxer.AnimState:OverrideSymbol("swap_hat", "hat_top", "swap_hat")
    boxer.AnimState:Show("HAT")
    boxer.AnimState:Show("HAT_HAIR")
    boxer.AnimState:Hide("HAIR_NOHAT")
    boxer.AnimState:Hide("HAIR")
    boxer.AnimState:Hide("ARM_carry")
    boxer.AnimState:Show("ARM_normal")
    boxer.Transform:SetFourFaced()
    boxer.AnimState:PlayAnimation("idle")
    boxer:RemoveComponent("stackable")
    boxer:RemoveComponent("tradable")
    boxer:RemoveComponent("inventoryitem")
    boxer:RemoveComponent("edible")
    boxer:RemoveComponent("deployable")
    MakeLargeBurnable(boxer)
    MakeLargePropagator(boxer)
    boxer:AddTag("boxer")
    boxer:AddComponent("trader")
    boxer.components.trader:SetAcceptTest(function(boxer, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 100) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    boxer.components.trader.onaccept = function(boxer, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 99)
        boxer.AnimState:PlayAnimation("give")
        local cricket = SpawnPrefab("slurper_pelt")
        cricket.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5)
        cricket.AnimState:SetBank("spider_queen")
        cricket.AnimState:SetBuild("spider_queen_build")
        cricket.AnimState:PlayAnimation("idle", true)
        cricket.Transform:SetFourFaced()
        cricket.entity:AddSoundEmitter()
        cricket.Transform:SetScale(0.3, 0.3, 0.3)
        cricket.colour_idx = math.random(#colours)
        cricket.AnimState:SetMultColour(colours[cricket.colour_idx][1],colours[cricket.colour_idx][2],colours[cricket.colour_idx][3],1)
        cricket.components.inventoryitem:ChangeImageName("spidereggsack")
        cricket:RemoveComponent("stackable")
        cricket:RemoveComponent("tradable")
        cricket:RemoveComponent("edible")
        cricket:RemoveComponent("burnable")
        cricket:RemoveComponent("propagator")
        cricket:RemoveComponent("deployable")
        local brain = require "brains/abigailbrain"
        cricket:SetBrain(brain)
        cricket:AddComponent("lootdropper")
        cricket.components.lootdropper:SetLoot({"silk"})
        cricket:AddComponent("locomotor")
        cricket.components.locomotor.walkspeed = 5
        cricket.components.locomotor.runspeed = 8
        cricket:SetStateGraph("SGspiderqueen")
        cricket:AddComponent("follower")
        cricket.components.follower:SetLeader(GetPlayer())
        cricket.health_num = math.random(100,300)
        cricket.damage_num = math.random(20,50)
        cricket:AddComponent("health")
        cricket.components.health:SetMaxHealth(cricket.health_num)
        cricket:AddComponent("trader")
        cricket.components.trader:SetAcceptTest(function(cricket, item) 
            if item.prefab == "smallmeat" then
               return cricket.components.health:GetPercent() < 1
            end
            return false
        end )
        cricket.components.trader.onaccept = function(cricket, giver, item)
            cricket.components.health:DoDelta(300)
        end
        cricket:AddComponent("combat")
        cricket.components.combat:SetRetargetFunction(1, function(cricket)
            if not cricket.components.health:IsDead() then
                return FindEntity(cricket, 20, function(guy)
                    if guy.components.health and not guy.components.health:IsDead() then
                       return guy:HasTag("cricket") or guy:HasTag("cricket0")
                    end
                end )
            end
        end )
        cricket.components.combat:SetKeepTargetFunction(function(cricket, target) return target and target:IsValid() end )
        cricket.components.combat:SetAttackPeriod(2)
        cricket.components.combat:SetRange(1, 2)
        cricket.components.combat:SetDefaultDamage(cricket.damage_num)
        cricket:AddTag("cricket")
    end
    boxer.components.inspectable.getstatus = function(boxer)
        if not boxer:HasTag("startgame") then
           if GetPlayer().components.inventory:Has("goldnugget", 100) then
              local target0 = FindEntity(boxer, 30, function(guy) 
                  return guy:HasTag("cricket") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld()
              end )
              if target0 then
                 boxer:AddTag("startgame")
                 boxer.AnimState:PlayAnimation("give")
                 GetPlayer().components.playercontroller:Enable(false)
                 TheCamera:SetTarget(target0)
                 target0:RemoveComponent("inventoryitem")
                 boxer.task = boxer:DoPeriodicTask(1, function(boxer)
                     if target0.components.health:IsDead() then
                        if boxer.task then boxer.task:Cancel() boxer.task = nil end
                        GetPlayer().components.inventory:ConsumeByName("goldnugget", 100)
                        TheCamera:SetTarget(GetPlayer())
                        GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                        boxer.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                        boxer:DoTaskInTime(2, function()
                            boxer.AnimState:PlayAnimation("idle")
                            local target1 = FindEntity(boxer, 30, function(guy) 
                                return guy:HasTag("cricket0")
                            end )
                            if target1 then
                               target1:Remove()
                            end
                            boxer:RemoveTag("startgame")
                            GetPlayer().components.playercontroller:Enable(true)
                        end )
                     end
                 end )
                 local cricket0 = SpawnPrefab("slurper_pelt")
                 cricket0.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5)
                 cricket0.AnimState:SetBank("spider_queen")
                 cricket0.AnimState:SetBuild("spider_queen_build")
                 cricket0.AnimState:PlayAnimation("idle", true)
                 cricket0.Transform:SetFourFaced()
                 cricket0.entity:AddSoundEmitter()
                 cricket0.Transform:SetScale(0.3, 0.3, 0.3)
                 cricket0:RemoveComponent("stackable")
                 cricket0:RemoveComponent("tradable")
                 cricket0:RemoveComponent("inventoryitem")
                 cricket0:RemoveComponent("edible")
                 cricket0:RemoveComponent("burnable")
                 cricket0:RemoveComponent("propagator")
                 cricket0:RemoveComponent("deployable")
                 local brain = require "brains/abigailbrain"
                 cricket0:SetBrain(brain)
                 cricket0:AddComponent("lootdropper")
                 cricket0.components.lootdropper:SetLoot({"silk"})
                 cricket0:AddComponent("locomotor")
                 cricket0.components.locomotor.walkspeed = 5
                 cricket0.components.locomotor.runspeed = 8
                 cricket0:SetStateGraph("SGspiderqueen")
                 cricket0:AddComponent("follower")
                 cricket0.components.follower:SetLeader(boxer)
                 cricket0:AddComponent("health")
                 cricket0.components.health:SetMaxHealth(math.random(110,330))
                 cricket0:AddComponent("combat")
                 cricket0.components.combat:SetRetargetFunction(1, function(cricket0)
                     if not cricket0.components.health:IsDead() then
                         return FindEntity(cricket0, 20, function(guy)
                             if guy.components.health and not guy.components.health:IsDead() then
                                return guy:HasTag("cricket")
                             end
                         end )
                     end
                 end )
                 cricket0.components.combat:SetKeepTargetFunction(function(cricket0, target) return target and target:IsValid() end )
                 cricket0.components.combat:SetAttackPeriod(2)
                 cricket0.components.combat:SetRange(1, 2)
                 cricket0.components.combat:SetDefaultDamage(math.random(22,55))
                 cricket0:ListenForEvent("death", function()
                     boxer.AnimState:PlayAnimation("give")
                     if boxer.task then boxer.task:Cancel() boxer.task = nil end
                     for k = 1, 100 do
                         local goldnugget = SpawnPrefab("goldnugget")
                         GetPlayer().components.inventory:GiveItem(goldnugget)
                     end
                     boxer:RemoveTag("startgame")
                     GetPlayer().components.playercontroller:Enable(true)
                     TheCamera:SetTarget(GetPlayer())
                     target0:AddComponent("inventoryitem")
                     target0.components.inventoryitem:ChangeImageName("spidereggsack")
                 end )
                 cricket0:AddTag("cricket0")
                 cricket0:AddTag("goodbye")
              end
           end
        end
    end
    local advert = SpawnPrefab("slurper_pelt")
    advert.Transform:SetPosition(pt.x-2, 0, pt.z-2)
    advert.AnimState:SetBank("barrel")
    advert.AnimState:SetBuild("monkey_barrel")
    advert.AnimState:PlayAnimation("idle", true)
    advert.Transform:SetScale(1.5, 1.5, 1.5)
    advert:RemoveComponent("stackable")
    advert:RemoveComponent("tradable")
    advert:RemoveComponent("inventoryitem")
    advert:RemoveComponent("edible")
    advert:RemoveComponent("deployable")
    MakeLargeBurnable(advert)
    MakeLargePropagator(advert)
    advert:AddTag("lightningrod")
    local light = advert.entity:AddLight()
    light:SetFalloff(1)
    light:SetIntensity(.8)
    light:SetRadius(10)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    advert:DoPeriodicTask(6, function(advert)
        advert.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        advert:DoTaskInTime(3, function(advert) advert.AnimState:SetBloomEffectHandle("") end )
    end )
    advert:AddTag("goodbye")
end
local function OnDeploy (inst, pt)
    boxing(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodbye") then
        data.goodbye = true
    end
    if inst:HasTag("boxer") then
        data.boxer = true
    end
    if inst:HasTag("cricket") then
        data.cricket = true
    end
    data.colour_idx = inst.colour_idx
    data.health_num = inst.health_num
    data.damage_num = inst.damage_num
end
local function onload(inst, data)
    if data and data.goodbye then
       inst:Remove()
    end
    if data and data.boxer then
       boxing(inst)
       inst:Remove()
    end
    if data and data.cricket then
        inst.AnimState:SetBank("spider_queen")
        inst.AnimState:SetBuild("spider_queen_build")
        inst.AnimState:PlayAnimation("idle", true)
        inst.Transform:SetFourFaced()
        inst.entity:AddSoundEmitter()
        inst.Transform:SetScale(0.3, 0.3, 0.3)
        inst.colour_idx = math.random(#colours)
        inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
        inst.components.inventoryitem:ChangeImageName("spidereggsack")
        inst:RemoveComponent("stackable")
        inst:RemoveComponent("tradable")
        inst:RemoveComponent("edible")
        inst:RemoveComponent("burnable")
        inst:RemoveComponent("propagator")
        inst:RemoveComponent("deployable")
        local brain = require "brains/abigailbrain"
        inst:SetBrain(brain)
        inst:AddComponent("lootdropper")
        inst.components.lootdropper:SetLoot({"silk"})
        inst:AddComponent("locomotor")
        inst.components.locomotor.walkspeed = 5
        inst.components.locomotor.runspeed = 8
        inst:SetStateGraph("SGspiderqueen")
        inst:AddComponent("follower")
        inst.components.follower:SetLeader(GetPlayer())
        inst.health_num = math.random(100,300)
        inst.damage_num = math.random(20,50)
        inst:AddComponent("health")
        inst.components.health:SetMaxHealth(inst.health_num)
        inst:AddComponent("trader")
        inst.components.trader:SetAcceptTest(function(inst, item) 
            if item.prefab == "smallmeat" then
               return inst.components.health:GetPercent() < 1
            end
            return false
        end )
        inst.components.trader.onaccept = function(inst, giver, item)
            inst.components.health:DoDelta(300)
        end
        inst:AddComponent("combat")
        inst.components.combat:SetRetargetFunction(1, function(inst)
            if not inst.components.health:IsDead() then
                return FindEntity(inst, 20, function(guy)
                    if guy.components.health and not guy.components.health:IsDead() then
                       return guy:HasTag("cricket") or guy:HasTag("cricket0")
                    end
                end )
            end
        end )
        inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end )
        inst.components.combat:SetAttackPeriod(2)
        inst.components.combat:SetRange(1, 2)
        inst.components.combat:SetDefaultDamage(inst.damage_num)
        inst:AddTag("cricket")
    end
    if data and data.colour_idx then
       inst.colour_idx = math.min(#colours, data.colour_idx)
       inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)
    end
    if data and data.health_num then
       inst.health_num = data.health_num
       inst.components.health:SetMaxHealth(inst.health_num)
       inst.components.health:DoDelta(inst.components.health.maxhealth)
    end
    if data and data.damage_num then
       inst.damage_num = data.damage_num
       inst.components.combat:SetDefaultDamage(inst.damage_num)
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ʳƤֶ֩볡1ʳƤԵҼŶʳƤ򲻻ֳׯ100ƽŻƽׯҵɹ֩룬֩룬ɽƷʾΪ֩ѵͼꡣׯұ100ƽ𣬽Լһֻ֩ׯǰׯңׯһóһֻ֩֩PKӮˣӮ100ƽĽ˾100ƽ𣬲ʧԼ֩롣Ϊֹףǲָͣÿֻ֩Ѫͬ֩룬һҪĺǻΪҡǮ֩ιһС⣨С֩Ϊ䲹ѪҲԶֻ֩룬ڲPKѡõƷ֣ׯҶԶģʤʡҪ֩볡ˣյɡʳƤԴʳ߻ãҲڡͳСУ1-3ƽ𹺵




.Ӫ԰ûֶ԰ֳС׬ƱǮ

    ü±ϷĿ¼\data\scripts\prefabs\butter.luaļinst:AddComponent("inspectable")һвݣ

local slotpos = { Vector3(0,-100,0)}
local function itemtest(inst, item, slot)
    if item.prefab == "carrot" then
       return true
    end
    return false
end
local widgetbuttoninfo = {
    text = "Sell",
    position = Vector3(0, -30, 0),
    fn = function(inst)
        local target = FindEntity(inst, 9, function(guy) 
            return guy:HasTag("zoobaby")
        end )
        if target then
           for k = 1,20 do
               local pt5 = target:GetPosition()
               SpawnPrefab("goldnugget").Transform:SetPosition(pt5.x, 0, pt5.z)
               GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
               target:Remove()
           end
        end
end }
local function OnDeploy (inst, pt)
    local brand = SpawnPrefab("butter")
    brand.Transform:SetPosition(pt.x, pt.y, pt.z)
    brand.AnimState:SetBank("sign_home")
    brand.AnimState:SetBuild("sign_home")
    brand.AnimState:PlayAnimation("idle")
    brand.Transform:SetScale(0.8, 0.8, 0.8)
    brand.AnimState:SetMultColour(0/255,255/255,0/255,1)
    brand:RemoveComponent("stackable")
    brand:RemoveComponent("inventoryitem")
    brand:RemoveComponent("edible")
    brand:RemoveComponent("perishable")
    brand:RemoveComponent("deployable")
    brand:RemoveComponent("container")
    brand:AddTag("brand")
    local slotpos1 = { Vector3(0,-75,0)}
    brand:AddComponent("container")
    brand.components.container:SetNumSlots(#slotpos1)
    brand.components.container.widgetslotpos = slotpos1
    brand.components.container.widgetpos = Vector3(0,180,0)
    brand.components.container.side_align_tip = 160
    brand.components.container.acceptsstacks = false
    brand.components.container.itemtestfn = function(brand, item, slot)
        if item.prefab == "charcoal" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "walrus_tusk" or item.prefab == "cave_banana" then
           return true
        end
        return false
    end
    brand.components.container.widgetbuttoninfo = {
        text = "Buy",
        position = Vector3(0, -145, 0),
        fn = function(brand)
            if GetPlayer().components.inventory:Has("goldnugget", 30) then
               if brand.components.container:Has("charcoal", 1) then
                  brand.components.container:ConsumeByName("charcoal", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = brand:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("krampus")
                  zoobaby.AnimState:SetBuild("krampus_build")
                  zoobaby.AnimState:PlayAnimation("idle", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.AnimState:Hide("SACK")
                  zoobaby.AnimState:Show("ARM")
                  zoobaby.Transform:SetScale(0.7,0.7,0.7)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkrampus")
                  zoobaby:AddTag("zoobaby1")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if brand.components.container:Has("trunk_summer", 1) then
                  brand.components.container:ConsumeByName("trunk_summer", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = brand:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("koalefant")
                  zoobaby.AnimState:SetBuild("koalefant_summer_build")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.5,0.5,0.5)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkoalefant")
                  zoobaby:AddTag("zoobaby2")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if brand.components.container:Has("trunk_winter", 1) then
                  brand.components.container:ConsumeByName("trunk_winter", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = brand:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("koalefant")
                  zoobaby.AnimState:SetBuild("koalefant_winter_build")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.5,0.5,0.5)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkoalefant")
                  zoobaby:AddTag("zoobaby3")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if brand.components.container:Has("walrus_tusk", 1) then
                  brand.components.container:ConsumeByName("walrus_tusk", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = brand:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("walrus")
                  zoobaby.AnimState:SetBuild("walrus_baby_build")
                  zoobaby.AnimState:PlayAnimation("idle_happy")
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.8,0.8,0.8)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGwalrus")
                  zoobaby:AddTag("zoobaby4")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if brand.components.container:Has("cave_banana", 1) then
                  brand.components.container:ConsumeByName("cave_banana", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = brand:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("kiki")
                  zoobaby.AnimState:SetBuild("kiki_basic")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
	          zoobaby.soundtype = ""
                  zoobaby.Transform:SetScale(1.2,1.2,1.2)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGmonkey")
                  zoobaby:AddTag("zoobaby5")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
            end
    end }
    local zooroom = SpawnPrefab("butter")
    zooroom.Transform:SetPosition(pt.x-7, 0, pt.z-7)
    zooroom.AnimState:SetBank("rabbithouse")
    zooroom.AnimState:SetBuild("rabbit_house")
    zooroom.AnimState:PlayAnimation("idle", true)
    zooroom.Transform:SetScale(0.4, 0.4, 0.4)
    zooroom:RemoveComponent("stackable")
    zooroom:RemoveComponent("inventoryitem")
    zooroom:RemoveComponent("edible")
    zooroom:RemoveComponent("perishable")
    zooroom:RemoveComponent("deployable")
    zooroom.components.container.canbeopened = true
    zooroom.entity:AddLight()
    zooroom.Light:SetFalloff(1)
    zooroom.Light:SetIntensity(.8)
    zooroom.Light:SetRadius(15)
    zooroom.Light:SetColour(180/255, 195/255, 50/255)
    zooroom.Light:Enable(true)
    zooroom:AddTag("zooroom")
    zooroom:DoPeriodicTask(180, function(zooroom)
        local target = FindEntity(zooroom, 9, function(guy) 
            return guy:HasTag("zoobaby")
        end )
        if target then
           local target1 = FindEntity(zooroom, 9, function(guy) 
               return guy.prefab == "poop"
           end )
           if not target1 then
              for k = 1,math.random(5,10) do
                  local pt2 = zooroom:GetPosition()
                  SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5)
              end
           else
              for k = 1,math.random(1,3) do
                  local pt2 = zooroom:GetPosition()
                  SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5)
              end
           end
           if zooroom.components.container:Has("carrot", 3) then
              zooroom.components.container:ConsumeByName("carrot", 3)
              if math.random()<0.1 then
                 if target:HasTag("zoobaby1") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("krampus")
                    zoobaby.AnimState:SetBuild("krampus_build")
                    zoobaby.AnimState:PlayAnimation("idle", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.AnimState:Hide("SACK")
                    zoobaby.AnimState:Show("ARM")
                    zoobaby.Transform:SetScale(0.7,0.7,0.7)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkrampus")
                    zoobaby:AddTag("zoobaby1")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby2") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("koalefant")
                    zoobaby.AnimState:SetBuild("koalefant_summer_build")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.5,0.5,0.5)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkoalefant")
                    zoobaby:AddTag("zoobaby2")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby3") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("koalefant")
                    zoobaby.AnimState:SetBuild("koalefant_winter_build")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.5,0.5,0.5)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkoalefant")
                    zoobaby:AddTag("zoobaby3")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby4") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("walrus")
                    zoobaby.AnimState:SetBuild("walrus_baby_build")
                    zoobaby.AnimState:PlayAnimation("idle_happy")
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.8,0.8,0.8)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGwalrus")
                    zoobaby:AddTag("zoobaby4")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby5") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("kiki")
                    zoobaby.AnimState:SetBuild("kiki_basic")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
	            zoobaby.soundtype = ""
                    zoobaby.Transform:SetScale(1.2,1.2,1.2)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGmonkey")
                    zoobaby:AddTag("zoobaby5")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
              end
           else
              target.components.health:Kill()
           end
        end
    end )
    zooroom:AddComponent("workable")
    zooroom.components.workable:SetWorkAction(ACTIONS.HAMMER)
    zooroom.components.workable:SetWorkLeft(3)
    zooroom.components.workable:SetOnFinishCallback(function(zooroom)
        local pos = Vector3(zooroom.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("zoofence") or v:HasTag("brand") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               v:Remove()
            end
        end
        zooroom:Remove()
    end )
    local pt0 = Vector3(zooroom.Transform:GetWorldPosition())
    for k = 1, 40 do
        local result_offset = FindValidPositionByFan(1 * 2 * PI, 8, 40, function(offset)
            local x,y,z = (pt0 + offset):Get()
            local ents = TheSim:FindEntities(x,y,z , 1)
            return not next(ents) 
        end)
        if result_offset then
           local zoofence = SpawnPrefab("butter")
           zoofence.AnimState:SetBank("wall")
           zoofence.AnimState:SetBuild("wall_wood")
           zoofence.AnimState:PlayAnimation("1_2", false)
           MakeObstaclePhysics(zoofence, .5)
           zoofence:RemoveComponent("stackable")
           zoofence:RemoveComponent("inventoryitem")
           zoofence:RemoveComponent("edible")
           zoofence:RemoveComponent("perishable")
           zoofence:RemoveComponent("deployable")
           zoofence:RemoveComponent("container")
           zoofence:AddTag("zoofence")
           zoofence.Transform:SetPosition((pt0 + result_offset):Get())
           zoofence.components.inspectable.getstatus = function(zoofence)
               zoofence.Transform:SetScale(1, 0.1, 1)
               zoofence.Physics:SetActive(false)
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               zoofence:DoTaskInTime(5, function(zoofence)
                   zoofence.Transform:SetScale(1, 1, 1)
                   zoofence.Physics:SetActive(true)
                   GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               end )
           end
        end
    end
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,180,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.canbeopened = false
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
local function onsave(inst, data)
    if inst:HasTag("brand") then
        data.brand = true
    end
    if inst:HasTag("zooroom") then
        data.zooroom = true
    end
    if inst:HasTag("zoofence") then
        data.zoofence = true
    end
    if inst:HasTag("zoobaby1") then
        data.zoobaby1 = true
    end
    if inst:HasTag("zoobaby2") then
        data.zoobaby2 = true
    end
    if inst:HasTag("zoobaby3") then
        data.zoobaby3 = true
    end
    if inst:HasTag("zoobaby4") then
        data.zoobaby4 = true
    end
    if inst:HasTag("zoobaby5") then
        data.zoobaby5 = true
    end
    if inst:HasTag("followme") then
        data.followme = true
    end
end
local function onload(inst, data)
  if data and data.brand then
    inst.AnimState:SetBank("sign_home")
    inst.AnimState:SetBuild("sign_home")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.AnimState:SetMultColour(0/255,255/255,0/255,1)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    inst:AddTag("brand")
    local slotpos1 = { Vector3(0,-75,0)}
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos1)
    inst.components.container.widgetslotpos = slotpos1
    inst.components.container.widgetpos = Vector3(0,180,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.acceptsstacks = false
    inst.components.container.itemtestfn = function(inst, item, slot)
        if item.prefab == "charcoal" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "walrus_tusk" or item.prefab == "cave_banana" then
           return true
        end
        return false
    end
    inst.components.container.widgetbuttoninfo = {
        text = "Buy",
        position = Vector3(0, -145, 0),
        fn = function(inst)
            if GetPlayer().components.inventory:Has("goldnugget", 30) then
               if inst.components.container:Has("charcoal", 1) then
                  inst.components.container:ConsumeByName("charcoal", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = inst:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("krampus")
                  zoobaby.AnimState:SetBuild("krampus_build")
                  zoobaby.AnimState:PlayAnimation("idle", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.AnimState:Hide("SACK")
                  zoobaby.AnimState:Show("ARM")
                  zoobaby.Transform:SetScale(0.7,0.7,0.7)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkrampus")
                  zoobaby:AddTag("zoobaby1")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if inst.components.container:Has("trunk_summer", 1) then
                  inst.components.container:ConsumeByName("trunk_summer", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = inst:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("koalefant")
                  zoobaby.AnimState:SetBuild("koalefant_summer_build")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.5,0.5,0.5)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkoalefant")
                  zoobaby:AddTag("zoobaby2")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if inst.components.container:Has("trunk_winter", 1) then
                  inst.components.container:ConsumeByName("trunk_winter", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = inst:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("koalefant")
                  zoobaby.AnimState:SetBuild("koalefant_winter_build")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.5,0.5,0.5)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGkoalefant")
                  zoobaby:AddTag("zoobaby3")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if inst.components.container:Has("walrus_tusk", 1) then
                  inst.components.container:ConsumeByName("walrus_tusk", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = inst:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("walrus")
                  zoobaby.AnimState:SetBuild("walrus_baby_build")
                  zoobaby.AnimState:PlayAnimation("idle_happy")
	          zoobaby.entity:AddSoundEmitter()
                  zoobaby.Transform:SetScale(0.8,0.8,0.8)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGwalrus")
                  zoobaby:AddTag("zoobaby4")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
               if inst.components.container:Has("cave_banana", 1) then
                  inst.components.container:ConsumeByName("cave_banana", 1)
                  local zoobaby = SpawnPrefab("butter")
                  local pt1 = inst:GetPosition()
                  zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6)
                  zoobaby.AnimState:SetBank("kiki")
                  zoobaby.AnimState:SetBuild("kiki_basic")
                  zoobaby.AnimState:PlayAnimation("idle_loop", true)
	          zoobaby.entity:AddSoundEmitter()
	          zoobaby.soundtype = ""
                  zoobaby.Transform:SetScale(1.2,1.2,1.2)
                  zoobaby:AddComponent("locomotor")
                  zoobaby.components.locomotor.walkspeed = 3
                  zoobaby.components.locomotor.runspeed = 6
                  zoobaby:SetStateGraph("SGmonkey")
                  zoobaby:AddTag("zoobaby5")
                  local brain = require "brains/frogbrain"
                  zoobaby:SetBrain(brain)
                  zoobaby.Transform:SetFourFaced()
                  MakeCharacterPhysics(zoobaby, 15, .5)
                  zoobaby:AddComponent("knownlocations")
                  zoobaby:AddComponent("combat")
                  zoobaby:AddComponent("health")
                  zoobaby.components.health:SetMaxHealth(100)
                  zoobaby:RemoveComponent("stackable")
                  zoobaby:RemoveComponent("inventoryitem")
                  zoobaby:RemoveComponent("edible")
                  zoobaby:RemoveComponent("perishable")
                  zoobaby:RemoveComponent("deployable")
                  zoobaby:RemoveComponent("container")
                  local minimap = zoobaby.entity:AddMiniMapEntity()
                  minimap:SetIcon("monkey_barrel.png")
                  zoobaby:AddComponent("follower")
                  zoobaby.components.inspectable.getstatus = function(zoobaby)
                      if not zoobaby:HasTag("followme") then
                         local brain = require "brains/abigailbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(GetPlayer())
                         zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                         zoobaby:AddTag("followme")
                      else
                         local brain = require "brains/frogbrain"
                         zoobaby:SetBrain(brain)
                         zoobaby:RestartBrain()
                         zoobaby.components.follower:SetLeader(nil)
                         zoobaby.AnimState:SetBloomEffectHandle("")
                         zoobaby:RemoveTag("followme")
                      end
                  end
                  zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                      SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                  end )
                  zoobaby:AddComponent("lootdropper")
                  zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                  zoobaby:AddTag("zoobaby")
                  GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
                  GetPlayer().components.inventory:ConsumeByName("goldnugget", 30)
               end
            end
    end }
  end
  if data and data.zooroom then
    inst.AnimState:SetBank("rabbithouse")
    inst.AnimState:SetBuild("rabbit_house")
    inst.AnimState:PlayAnimation("idle", true)
    inst.Transform:SetScale(0.4, 0.4, 0.4)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst.entity:AddLight()
    inst.Light:SetFalloff(1)
    inst.Light:SetIntensity(.8)
    inst.Light:SetRadius(15)
    inst.Light:SetColour(180/255, 195/255, 50/255)
    inst.Light:Enable(true)
    inst:AddTag("zooroom")
    inst:DoPeriodicTask(180, function(inst)
        local target = FindEntity(inst, 9, function(guy) 
            return guy:HasTag("zoobaby")
        end )
        if target then
           local target1 = FindEntity(inst, 9, function(guy) 
               return guy.prefab == "poop"
           end )
           if not target1 then
              for k = 1,math.random(5,10) do
                  local pt2 = inst:GetPosition()
                  SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5)
              end
           else
              for k = 1,math.random(1,3) do
                  local pt2 = inst:GetPosition()
                  SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5)
              end
           end
           if inst.components.container:Has("carrot", 3) then
              inst.components.container:ConsumeByName("carrot", 3)
              if math.random()<0.1 then
                 if target:HasTag("zoobaby1") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("krampus")
                    zoobaby.AnimState:SetBuild("krampus_build")
                    zoobaby.AnimState:PlayAnimation("idle", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.AnimState:Hide("SACK")
                    zoobaby.AnimState:Show("ARM")
                    zoobaby.Transform:SetScale(0.7,0.7,0.7)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkrampus")
                    zoobaby:AddTag("zoobaby1")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby2") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("koalefant")
                    zoobaby.AnimState:SetBuild("koalefant_summer_build")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.5,0.5,0.5)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkoalefant")
                    zoobaby:AddTag("zoobaby2")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby3") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("koalefant")
                    zoobaby.AnimState:SetBuild("koalefant_winter_build")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.5,0.5,0.5)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGkoalefant")
                    zoobaby:AddTag("zoobaby3")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby4") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("walrus")
                    zoobaby.AnimState:SetBuild("walrus_baby_build")
                    zoobaby.AnimState:PlayAnimation("idle_happy")
                    zoobaby.entity:AddSoundEmitter()
                    zoobaby.Transform:SetScale(0.8,0.8,0.8)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGwalrus")
                    zoobaby:AddTag("zoobaby4")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
                 if target:HasTag("zoobaby5") then
                    local zoobaby = SpawnPrefab("butter")
                    local pt4 = target:GetPosition()
                    zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z)
                    zoobaby.AnimState:SetBank("kiki")
                    zoobaby.AnimState:SetBuild("kiki_basic")
                    zoobaby.AnimState:PlayAnimation("idle_loop", true)
                    zoobaby.entity:AddSoundEmitter()
	            zoobaby.soundtype = ""
                    zoobaby.Transform:SetScale(1.2,1.2,1.2)
                    zoobaby:AddComponent("locomotor")
                    zoobaby.components.locomotor.walkspeed = 3
                    zoobaby.components.locomotor.runspeed = 6
                    zoobaby:SetStateGraph("SGmonkey")
                    zoobaby:AddTag("zoobaby5")
                    local brain = require "brains/frogbrain"
                    zoobaby:SetBrain(brain)
                    zoobaby.Transform:SetFourFaced()
                    MakeCharacterPhysics(zoobaby, 15, .5)
                    zoobaby:AddComponent("knownlocations")
                    zoobaby:AddComponent("combat")
                    zoobaby:AddComponent("health")
                    zoobaby.components.health:SetMaxHealth(100)
                    zoobaby:RemoveComponent("stackable")
                    zoobaby:RemoveComponent("inventoryitem")
                    zoobaby:RemoveComponent("edible")
                    zoobaby:RemoveComponent("perishable")
                    zoobaby:RemoveComponent("deployable")
                    zoobaby:RemoveComponent("container")
                    local minimap = zoobaby.entity:AddMiniMapEntity()
                    minimap:SetIcon("monkey_barrel.png")
                    zoobaby:AddComponent("follower")
                    zoobaby.components.inspectable.getstatus = function(zoobaby)
                        if not zoobaby:HasTag("followme") then
                           local brain = require "brains/abigailbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(GetPlayer())
                           zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
                           zoobaby:AddTag("followme")
                        else
                           local brain = require "brains/frogbrain"
                           zoobaby:SetBrain(brain)
                           zoobaby:RestartBrain()
                           zoobaby.components.follower:SetLeader(nil)
                           zoobaby.AnimState:SetBloomEffectHandle("")
                           zoobaby:RemoveTag("followme")
                        end
                    end
                    zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby)
                        SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition())
                    end )
                    zoobaby:AddComponent("lootdropper")
                    zoobaby.components.lootdropper:SetLoot({"smallmeat"})
                    zoobaby:AddTag("zoobaby")
                 end
              end
           else
              target.components.health:Kill()
           end
        end
    end )
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        local pos = Vector3(inst.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("zoofence") or v:HasTag("brand") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               v:Remove()
            end
        end
        inst:Remove()
    end )
  end
  if data and data.zoofence then
    inst.AnimState:SetBank("wall")
    inst.AnimState:SetBuild("wall_wood")
    inst.AnimState:PlayAnimation("1_2", false)
    MakeObstaclePhysics(inst, .5)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    inst:AddTag("zoofence")
    inst.components.inspectable.getstatus = function(inst)
        inst.Transform:SetScale(1, 0.1, 1)
        inst.Physics:SetActive(false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:DoTaskInTime(5, function(inst)
            inst.Transform:SetScale(1, 1, 1)
            inst.Physics:SetActive(true)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        end )
    end
  end
  if data and data.zoobaby1 then
    inst.AnimState:SetBank("krampus")
    inst.AnimState:SetBuild("krampus_build")
    inst.AnimState:PlayAnimation("idle", true)
    inst.entity:AddSoundEmitter()
    inst.AnimState:Hide("SACK")
    inst.AnimState:Show("ARM")
    inst.Transform:SetScale(0.7,0.7,0.7)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 6
    inst:SetStateGraph("SGkrampus")
    inst:AddTag("zoobaby1")
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 15, .5)
    inst:AddComponent("knownlocations")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(100)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("monkey_barrel.png")
    inst:AddComponent("follower")
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("followme") then
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBloomEffectHandle("")
           inst:RemoveTag("followme")
        end
    end
    inst:DoPeriodicTask(math.random(360, 480), function(inst)
        SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddTag("zoobaby")
  end
  if data and data.zoobaby2 then
    inst.AnimState:SetBank("koalefant")
    inst.AnimState:SetBuild("koalefant_summer_build")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.entity:AddSoundEmitter()
    inst.Transform:SetScale(0.5,0.5,0.5)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 6
    inst:SetStateGraph("SGkoalefant")
    inst:AddTag("zoobaby2")
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 15, .5)
    inst:AddComponent("knownlocations")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(100)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("monkey_barrel.png")
    inst:AddComponent("follower")
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("followme") then
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBloomEffectHandle("")
           inst:RemoveTag("followme")
        end
    end
    inst:DoPeriodicTask(math.random(360, 480), function(inst)
        SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddTag("zoobaby")
  end
  if data and data.zoobaby3 then
    inst.AnimState:SetBank("koalefant")
    inst.AnimState:SetBuild("koalefant_winter_build")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.entity:AddSoundEmitter()
    inst.Transform:SetScale(0.5,0.5,0.5)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 6
    inst:SetStateGraph("SGkoalefant")
    inst:AddTag("zoobaby3")
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 15, .5)
    inst:AddComponent("knownlocations")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(100)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("monkey_barrel.png")
    inst:AddComponent("follower")
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("followme") then
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBloomEffectHandle("")
           inst:RemoveTag("followme")
        end
    end
    inst:DoPeriodicTask(math.random(360, 480), function(inst)
        SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddTag("zoobaby")
  end
  if data and data.zoobaby4 then
    inst.AnimState:SetBank("walrus")
    inst.AnimState:SetBuild("walrus_baby_build")
    inst.AnimState:PlayAnimation("idle_happy")
    inst.entity:AddSoundEmitter()
    inst.Transform:SetScale(0.8,0.8,0.8)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 6
    inst:SetStateGraph("SGwalrus")
    inst:AddTag("zoobaby4")
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 15, .5)
    inst:AddComponent("knownlocations")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(100)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("monkey_barrel.png")
    inst:AddComponent("follower")
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("followme") then
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBloomEffectHandle("")
           inst:RemoveTag("followme")
        end
    end
    inst:DoPeriodicTask(math.random(360, 480), function(inst)
        SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddTag("zoobaby")
  end
  if data and data.zoobaby5 then
    inst.AnimState:SetBank("kiki")
    inst.AnimState:SetBuild("kiki_basic")
    inst.AnimState:PlayAnimation("idle_loop", true)
    inst.entity:AddSoundEmitter()
    inst.soundtype = ""
    inst.Transform:SetScale(1.2,1.2,1.2)
    inst:AddComponent("locomotor")
    inst.components.locomotor.walkspeed = 3
    inst.components.locomotor.runspeed = 6
    inst:SetStateGraph("SGmonkey")
    inst:AddTag("zoobaby5")
    local brain = require "brains/frogbrain"
    inst:SetBrain(brain)
    inst.Transform:SetFourFaced()
    MakeCharacterPhysics(inst, 15, .5)
    inst:AddComponent("knownlocations")
    inst:AddComponent("combat")
    inst:AddComponent("health")
    inst.components.health:SetMaxHealth(100)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("perishable")
    inst:RemoveComponent("deployable")
    inst:RemoveComponent("container")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon("monkey_barrel.png")
    inst:AddComponent("follower")
    inst.components.inspectable.getstatus = function(inst)
        if not inst:HasTag("followme") then
           local brain = require "brains/abigailbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(GetPlayer())
           inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           inst:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           inst:SetBrain(brain)
           inst:RestartBrain()
           inst.components.follower:SetLeader(nil)
           inst.AnimState:SetBloomEffectHandle("")
           inst:RemoveTag("followme")
        end
    end
    inst:DoPeriodicTask(math.random(360, 480), function(inst)
        SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
    end )
    inst:AddComponent("lootdropper")
    inst.components.lootdropper:SetLoot({"smallmeat"})
    inst:AddTag("zoobaby")
  end
  if data and data.followme then
     local brain = require "brains/abigailbrain"
     inst:SetBrain(brain)
     inst:RestartBrain()
     inst.components.follower:SetLeader(GetPlayer())
     inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
     inst:AddTag("followme")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڿĿյϣûֶ԰30ƽʱӣɴ򿪸ӣľ̿BuyťһֻС30ƽ𣻷ǵBuyťС󣻷붬ǵBuyťС󣻷뺣BuyťС󣻷㽶Buyťӡľդɿţ5Զšмĺܲɴ򿪸ӣСﰮԵĺܲÿ9ĺܲ3ʱȦĶｫ½԰жʱÿ춼յ15-30ƽƱǮǰ棩㣬ʱɨƱǮ½Ϊ1/3ʳ㣬СﻹһʻֳᷱܲϷSellťȦеĶÿֻ20ƽܳȦᣬ춯ת㶯ﲻҪ㣬ٴ㶯ȡ档СͼʾΪӵͼꡣҪ԰ʱôҵܲɡͿԴã޸ˡͳСҲɻ1-3ƽ𹺵




.ɽɽ򣬻Сܸ桢̣

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\lightninggoathorn.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local goodgoat = SpawnPrefab("lightninggoathorn")
    goodgoat.Transform:SetPosition(pt.x, pt.y, pt.z)
    goodgoat.AnimState:SetBank("lightning_goat")
    goodgoat.AnimState:SetBuild("lightning_goat_build")
    goodgoat.AnimState:PlayAnimation("idle_loop", true)
    goodgoat.Transform:SetFourFaced()
    goodgoat.entity:AddSoundEmitter()
    local shadow = goodgoat.entity:AddDynamicShadow()
    shadow:SetSize(1.75,.75)
    MakeCharacterPhysics(goodgoat, 100, 1)
    goodgoat.entity:AddLight()
    goodgoat.Light:Enable(false)
    local minimap = goodgoat.entity:AddMiniMapEntity()
    minimap:SetIcon( "toothtrap.png" )
    goodgoat:RemoveComponent("stackable")
    goodgoat:RemoveComponent("inventoryitem")
    goodgoat:RemoveComponent("deployable")
    goodgoat:AddComponent("knownlocations")
    goodgoat:AddComponent("leader")
    goodgoat:AddComponent("follower")
    goodgoat.components.follower:SetLeader(GetPlayer())
    goodgoat.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    goodgoat:AddTag("followme")
    goodgoat:AddComponent("locomotor")
    goodgoat.components.locomotor.walkspeed = 4
    goodgoat.components.locomotor.runspeed = 8
    goodgoat:SetStateGraph("SGlightninggoat")
    local brain = require "brains/chesterbrain"
    goodgoat:SetBrain(brain)
    goodgoat:AddComponent("health")
    goodgoat.components.health:SetMaxHealth(200)
    goodgoat:AddComponent("combat")
    goodgoat.components.combat.hiteffectsymbol = "lightning_goat_body"
    goodgoat.components.combat:SetAttackPeriod(1)
    goodgoat.components.combat:SetRange(1, 2)
    goodgoat.components.combat:SetDefaultDamage(10)
    goodgoat:AddComponent("lootdropper")
    goodgoat.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat"})
    goodgoat:ListenForEvent("attacked", function(goodgoat, data)
        if data.attacker ~= GetPlayer() then
           goodgoat.components.combat:SetTarget(data.attacker)
           goodgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10)
        else
           goodgoat.components.health:Kill()
        end
    end )
    goodgoat.components.inspectable.getstatus = function(goodgoat)
        if not goodgoat:HasTag("followme") then
           local brain = require "brains/chesterbrain"
           goodgoat:SetBrain(brain)
           goodgoat:RestartBrain()
           goodgoat.components.follower:SetLeader(GetPlayer())
           goodgoat.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           goodgoat:AddTag("followme")
        else
           local brain = require "brains/frogbrain"
           goodgoat:SetBrain(brain)
           goodgoat:RestartBrain()
           goodgoat.components.follower:SetLeader(nil)
           goodgoat.AnimState:SetBloomEffectHandle("")
           goodgoat:RemoveTag("followme")
        end
    end
    goodgoat:DoPeriodicTask(math.random(180, 360), function(goodgoat)
        SpawnPrefab("goatmilk").Transform:SetPosition(goodgoat.Transform:GetWorldPosition())
    end )
    goodgoat:ListenForEvent( "nighttime", function()
        if math.random()<.3 then
           local pt0 = goodgoat:GetPosition()
           local smallgoat = SpawnPrefab("lightninggoathorn")
           smallgoat.Transform:SetPosition(pt0.x, pt0.y, pt0.z)
           smallgoat.AnimState:SetBank("lightning_goat")
           smallgoat.AnimState:SetBuild("lightning_goat_build")
           smallgoat.AnimState:PlayAnimation("idle_loop", true)
           smallgoat.Transform:SetFourFaced()
           smallgoat.Transform:SetScale(0.6, 0.6, 0.6)
           smallgoat.entity:AddSoundEmitter()
           local shadow = smallgoat.entity:AddDynamicShadow()
           shadow:SetSize(1,.5)
           MakeCharacterPhysics(smallgoat, 60, 0.6)
           smallgoat.entity:AddLight()
           smallgoat.Light:Enable(false)
           local minimap = smallgoat.entity:AddMiniMapEntity()
           minimap:SetIcon( "toothtrap.png" )
           smallgoat:RemoveComponent("stackable")
           smallgoat:RemoveComponent("inventoryitem")
           smallgoat:RemoveComponent("deployable")
           smallgoat:AddComponent("knownlocations")
           smallgoat:AddComponent("follower")
           smallgoat:AddComponent("locomotor")
           smallgoat.components.locomotor.walkspeed = 4
           smallgoat.components.locomotor.runspeed = 8
           smallgoat:SetStateGraph("SGlightninggoat")
           smallgoat:AddComponent("health")
           smallgoat.components.health:SetMaxHealth(100)
           smallgoat:AddComponent("combat")
           smallgoat.components.combat.hiteffectsymbol = "lightning_goat_body"
           smallgoat.components.combat:SetAttackPeriod(1)
           smallgoat.components.combat:SetRange(1, 2)
           smallgoat.components.combat:SetDefaultDamage(5)
           smallgoat:AddComponent("lootdropper")
           smallgoat.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"})
           smallgoat:ListenForEvent("attacked", function(smallgoat, data)
               if data.attacker ~= GetPlayer() then
                  smallgoat.components.combat:SetTarget(data.attacker)
                  smallgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10)
               else
                  smallgoat.components.health:Kill()
               end
           end )
           smallgoat:DoPeriodicTask(math.random(180, 360), function(smallgoat)
               SpawnPrefab("poop").Transform:SetPosition(smallgoat.Transform:GetWorldPosition())
           end )
           smallgoat:DoTaskInTime(1, function(smallgoat)
               local mama = FindEntity(smallgoat, 100, function(guy)
                   return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
               end)
               if mama then
                  local brain = require "brains/chesterbrain"
                  smallgoat:SetBrain(brain)
                  smallgoat:RestartBrain()
                  smallgoat.components.follower:SetLeader(mama)
               else
                  local brain = require "brains/frogbrain"
                  smallgoat:SetBrain(brain)
                  smallgoat:RestartBrain()
                  smallgoat.components.follower:SetLeader(nil)
	       end
           end )
           smallgoat.components.inspectable.getstatus = function(smallgoat)
               local mama = FindEntity(smallgoat, 100, function(guy)
                   return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
               end)
               if mama then
                  local brain = require "brains/chesterbrain"
                  smallgoat:SetBrain(brain)
                  smallgoat:RestartBrain()
                  smallgoat.components.follower:SetLeader(mama)
               else
                  local brain = require "brains/frogbrain"
                  smallgoat:SetBrain(brain)
                  smallgoat:RestartBrain()
                  smallgoat.components.follower:SetLeader(nil)
	       end
           end
           smallgoat:AddTag("smallgoats")
        end
    end , GetWorld())
    goodgoat:AddTag("goodgoats")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("goodgoats") then
        data.goodgoats = true
    end
    if inst:HasTag("followme") then
        data.followme = true
    end
    if inst:HasTag("smallgoats") then
        data.smallgoats = true
    end
end
local function onload(inst, data)
    if data and data.goodgoats then
       inst.AnimState:SetBank("lightning_goat")
       inst.AnimState:SetBuild("lightning_goat_build")
       inst.AnimState:PlayAnimation("idle_loop", true)
       inst.Transform:SetFourFaced()
       inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize(1.75,.75)
       MakeCharacterPhysics(inst, 100, 1)
       inst.entity:AddLight()
       inst.Light:Enable(false)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "toothtrap.png" )
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("deployable")
       inst:AddComponent("knownlocations")
       inst:AddComponent("leader")
       inst:AddComponent("follower")
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 4
       inst.components.locomotor.runspeed = 8
       inst:SetStateGraph("SGlightninggoat")
       local brain = require "brains/frogbrain"
       inst:SetBrain(brain)
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(200)
       inst:AddComponent("combat")
       inst.components.combat.hiteffectsymbol = "lightning_goat_body"
       inst.components.combat:SetAttackPeriod(1)
       inst.components.combat:SetRange(1, 2)
       inst.components.combat:SetDefaultDamage(10)
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat"})
       inst:ListenForEvent("attacked", function(inst, data)
           if data.attacker ~= GetPlayer() then
              inst.components.combat:SetTarget(data.attacker)
              inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10)
           else
              inst.components.health:Kill()
           end
       end )
       inst.components.inspectable.getstatus = function(inst)
           if not inst:HasTag("followme") then
              local brain = require "brains/chesterbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(GetPlayer())
              inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
              inst:AddTag("followme")
           else
              local brain = require "brains/frogbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(nil)
              inst.AnimState:SetBloomEffectHandle("")
              inst:RemoveTag("followme")
           end
       end
       inst:DoPeriodicTask(math.random(180, 360), function(inst)
           SpawnPrefab("goatmilk").Transform:SetPosition(inst.Transform:GetWorldPosition())
       end )
       inst:ListenForEvent( "nighttime", function()
           if math.random()<.3 then
              local pt0 = inst:GetPosition()
              local smallgoat = SpawnPrefab("lightninggoathorn")
              smallgoat.Transform:SetPosition(pt0.x, pt0.y, pt0.z)
              smallgoat.AnimState:SetBank("lightning_goat")
              smallgoat.AnimState:SetBuild("lightning_goat_build")
              smallgoat.AnimState:PlayAnimation("idle_loop", true)
              smallgoat.Transform:SetFourFaced()
              smallgoat.Transform:SetScale(0.6, 0.6, 0.6)
              smallgoat.entity:AddSoundEmitter()
              local shadow = smallgoat.entity:AddDynamicShadow()
              shadow:SetSize(1,.5)
              MakeCharacterPhysics(smallgoat, 60, 0.6)
              smallgoat.entity:AddLight()
              smallgoat.Light:Enable(false)
              local minimap = smallgoat.entity:AddMiniMapEntity()
              minimap:SetIcon( "toothtrap.png" )
              smallgoat:RemoveComponent("stackable")
              smallgoat:RemoveComponent("inventoryitem")
              smallgoat:RemoveComponent("deployable")
              smallgoat:AddComponent("knownlocations")
              smallgoat:AddComponent("follower")
              smallgoat:AddComponent("locomotor")
              smallgoat.components.locomotor.walkspeed = 4
              smallgoat.components.locomotor.runspeed = 8
              smallgoat:SetStateGraph("SGlightninggoat")
              smallgoat:AddComponent("health")
              smallgoat.components.health:SetMaxHealth(100)
              smallgoat:AddComponent("combat")
              smallgoat.components.combat.hiteffectsymbol = "lightning_goat_body"
              smallgoat.components.combat:SetAttackPeriod(1)
              smallgoat.components.combat:SetRange(1, 2)
              smallgoat.components.combat:SetDefaultDamage(5)
              smallgoat:AddComponent("lootdropper")
              smallgoat.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"})
              smallgoat:ListenForEvent("attacked", function(smallgoat, data)
                  if data.attacker ~= GetPlayer() then
                     smallgoat.components.combat:SetTarget(data.attacker)
                     smallgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10)
                  else
                     smallgoat.components.health:Kill()
                  end
              end )
              smallgoat:DoPeriodicTask(math.random(180, 360), function(smallgoat)
                  SpawnPrefab("poop").Transform:SetPosition(smallgoat.Transform:GetWorldPosition())
              end )
              smallgoat:DoTaskInTime(1, function(smallgoat)
                  local mama = FindEntity(smallgoat, 100, function(guy)
                      return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
                  end)
                  if mama then
                     local brain = require "brains/chesterbrain"
                     smallgoat:SetBrain(brain)
                     smallgoat:RestartBrain()
                     smallgoat.components.follower:SetLeader(mama)
                  else
                     local brain = require "brains/frogbrain"
                     smallgoat:SetBrain(brain)
                     smallgoat:RestartBrain()
                     smallgoat.components.follower:SetLeader(nil)
	          end
              end )
              smallgoat.components.inspectable.getstatus = function(smallgoat)
                  local mama = FindEntity(smallgoat, 100, function(guy)
                      return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
                  end)
                  if mama then
                     local brain = require "brains/chesterbrain"
                     smallgoat:SetBrain(brain)
                     smallgoat:RestartBrain()
                     smallgoat.components.follower:SetLeader(mama)
                  else
                     local brain = require "brains/frogbrain"
                     smallgoat:SetBrain(brain)
                     smallgoat:RestartBrain()
                     smallgoat.components.follower:SetLeader(nil)
	          end
              end
              smallgoat:AddTag("smallgoats")
           end
       end , GetWorld())
       inst:AddTag("goodgoats")
    end
    if data and data.followme then
       local brain = require "brains/chesterbrain"
       inst:SetBrain(brain)
       inst:RestartBrain()
       inst.components.follower:SetLeader(GetPlayer())
       inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
       inst:AddTag("followme")
    end
    if data and data.smallgoats then
       inst.AnimState:SetBank("lightning_goat")
       inst.AnimState:SetBuild("lightning_goat_build")
       inst.AnimState:PlayAnimation("idle_loop", true)
       inst.Transform:SetFourFaced()
       inst.Transform:SetScale(0.6, 0.6, 0.6)
       inst.entity:AddSoundEmitter()
       local shadow = inst.entity:AddDynamicShadow()
       shadow:SetSize(1,.5)
       MakeCharacterPhysics(inst, 60, 0.6)
       inst.entity:AddLight()
       inst.Light:Enable(false)
       local minimap = inst.entity:AddMiniMapEntity()
       minimap:SetIcon( "toothtrap.png" )
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("inventoryitem")
       inst:RemoveComponent("deployable")
       inst:AddComponent("knownlocations")
       inst:AddComponent("follower")
       inst:AddComponent("locomotor")
       inst.components.locomotor.walkspeed = 4
       inst.components.locomotor.runspeed = 8
       inst:SetStateGraph("SGlightninggoat")
       inst:AddComponent("health")
       inst.components.health:SetMaxHealth(100)
       inst:AddComponent("combat")
       inst.components.combat.hiteffectsymbol = "lightning_goat_body"
       inst.components.combat:SetAttackPeriod(1)
       inst.components.combat:SetRange(1, 2)
       inst.components.combat:SetDefaultDamage(5)
       inst:AddComponent("lootdropper")
       inst.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"})
       inst:ListenForEvent("attacked", function(inst, data)
           if data.attacker ~= GetPlayer() then
              inst.components.combat:SetTarget(data.attacker)
              inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10)
           else
              inst.components.health:Kill()
           end
       end )
       inst:DoPeriodicTask(math.random(180, 360), function(inst)
           SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition())
       end )
       inst:DoTaskInTime(1, function(inst)
           local mama = FindEntity(inst, 100, function(guy)
               return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
           end)
           if mama then
              local brain = require "brains/chesterbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(mama)
           else
              local brain = require "brains/frogbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(nil)
           end
       end )
       inst.components.inspectable.getstatus = function(inst)
           local mama = FindEntity(inst, 100, function(guy)
               return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead()
           end)
           if mama then
              local brain = require "brains/chesterbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(mama)
           else
              local brain = require "brains/frogbrain"
              inst:SetBrain(brain)
              inst:RestartBrain()
              inst.components.follower:SetLeader(nil)
	   end
       end
       inst:AddTag("smallgoats")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ɽɽﲻҪˣɸ棬ٴεȡ档ɽÿɲ1-2̣ҹﻹһСɱɽɵ6⡣СֻɱС裬ܣʱһֻС򣬿µ衣С㣬᳤󣬿ΪʳԴ׺õ3ǣǿɽ׳ȺɽСͼʾΪȮͼꡣǿɴã޸ˡͳСҲɻ1-3ƽ𹺵




.ҵɿþҵɿ20ƽһΣչɳĿʯǮ׬Ǯע

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\transistor.luaļinst:AddComponent("inspectable")һвݣ

local function makeluckypit(inst)
    local pt = inst:GetPosition()
    local luckypit = SpawnPrefab("transistor")
    luckypit.Transform:SetPosition(pt.x, pt.y, pt.z)
    luckypit.AnimState:SetBank("coldfirepit")
    luckypit.AnimState:SetBuild("coldfirepit")
    luckypit.AnimState:PlayAnimation("idle",false)
    luckypit.entity:AddSoundEmitter()
    luckypit.Transform:SetScale(1.5,1.5,1.5)
    luckypit:RemoveComponent("stackable")
    luckypit:RemoveComponent("inventoryitem")
    luckypit:RemoveComponent("deployable")
    luckypit:AddComponent("workable")
    luckypit.components.workable:SetWorkAction(ACTIONS.HAMMER)
    luckypit.components.workable:SetWorkLeft(3)
    luckypit.components.workable:SetOnFinishCallback(function(luckypit)
        SpawnPrefab("collapse_big").Transform:SetPosition(luckypit.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        luckypit:Remove()
    end )
    luckypit:AddComponent("trader")
    luckypit.components.trader:SetAcceptTest(function(luckypit, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 20) then
           if not luckypit:HasTag("domining") then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
        end
        if item.prefab == "rocks" or item.prefab == "nitre" or item.prefab == "flint" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "thulecite" or item.prefab == "ice" then
           return true
        end
        return false
    end )
    luckypit.components.trader.onaccept = function(luckypit, giver, item)
        if item.prefab == "goldnugget" then
           giver.components.inventory:ConsumeByName("goldnugget", 19)
           GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
           luckypit:AddTag("domining")
           luckypit.task = luckypit:DoPeriodicTask(1, function()
               local pt0 = luckypit:GetPosition()
               luckypit.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
               luckypit:DoTaskInTime(0.5, function() luckypit.AnimState:SetBloomEffectHandle("") end )
               SpawnPrefab("collapse_small").Transform:SetPosition(pt0.x, 1, pt0.z)
               luckypit.SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
               GetPlayer().components.playercontroller:ShakeCamera(luckypit, "FULL", 0.7, 0.02, .5, 40)
               local ores = {"rocks","nitre","flint","redgem","bluegem","purplegem","greengem","orangegem","yellowgem","thulecite","ice","goldnugget","ash"}
               local ore = ores[math.random(#ores)]
               local myore = SpawnPrefab(ore)
               myore.Transform:SetPosition(pt0.x, 0, pt0.z)
               myore.components.inventoryitem.canbepickedup = false
	       myore:AddComponent("complexprojectile")
	       myore.components.complexprojectile.yOffset = 2.5
               myore.components.complexprojectile:Launch(Point(pt0.x+(math.random(10)-math.random(10)), 0, pt0.z+(math.random(10)-math.random(10))))
	       myore.components.complexprojectile:SetOnHit(function()
                   SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(myore.Transform:GetWorldPosition())
                   myore:RemoveComponent("complexprojectile")
                   myore.components.inventoryitem.canbepickedup = true
               end )
           end )
           luckypit:DoTaskInTime(math.random(10,60), function()
               SpawnPrefab("collapse_big").Transform:SetPosition(luckypit.Transform:GetWorldPosition())
               luckypit.SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
               if luckypit.task then luckypit.task:Cancel() luckypit.task = nil end
               luckypit:RemoveTag("domining")
           end )
        end
        if item.prefab == "thulecite" then
           for k = 1, 3 do
               local goldnugget = SpawnPrefab("goldnugget")
               giver.components.inventory:GiveItem(goldnugget)
           end
        end
        if item.prefab == "rocks" or item.prefab == "nitre" or item.prefab == "flint" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "ice" then
           local goldnugget = SpawnPrefab("goldnugget")
           giver.components.inventory:GiveItem(goldnugget)
        end
    end
    luckypit:AddTag("luckypit")
end
local function OnDeploy (inst, pt)
    makeluckypit(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("luckypit") then
       data.luckypit = true
    end
end
local function onload(inst, data)
  if data and data.luckypit then
     makeluckypit(inst)
     inst:Remove()
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    þҵɿ1ܶԵҼŶ򲻻ֳ20ƽŻƽԲɿһΣɳĿʯȷһʲɳҡԽʯãҲҵɿſʯԲɿʯ3ƽ⣬ÿʯ1ƽܷƽ֧𣬾ҪˣҵİɡҪҵɿˣôҵɡھѡŰɫʯ£2ƽ1ʯש




.˾òֻ˾յᵽûƽ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cutgrass.luaļinst:AddComponent("inspectable")һвݣ

local function makegrinder(inst)
    local pt = inst:GetPosition()
    local redmark = SpawnPrefab("cutgrass")
    redmark.Transform:SetPosition(pt.x, pt.y, pt.z)
    redmark.AnimState:SetBank("gridplacer")
    redmark.AnimState:SetBuild("gridplacer")
    redmark.AnimState:PlayAnimation("anim", true)
    redmark.Transform:SetScale(1.5, 1.5, 1.5)
    redmark.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    redmark.AnimState:SetLayer( LAYER_BACKGROUND )
    redmark.AnimState:SetSortOrder( 3 )
    redmark.Transform:SetRotation( 45 )
    redmark.AnimState:SetMultColour(255/255,0/255,0/255,1)
    redmark.AnimState:SetLightOverride(1)
    redmark:AddTag("NOCLICK")
    redmark:RemoveComponent("stackable")
    redmark:RemoveComponent("edible")
    redmark:RemoveComponent("tradable")
    redmark:RemoveComponent("fuel")
    redmark:RemoveComponent("burnable")
    redmark:RemoveComponent("propagator")
    redmark:RemoveComponent("repairer")
    redmark:RemoveComponent("inventoryitem")
    redmark:RemoveComponent("deployable")
    redmark:RemoveTag("cattoy")
    redmark:AddTag("redmark")
    local yellowmark = SpawnPrefab("cutgrass")
    yellowmark.Transform:SetPosition(pt.x-12.5, 0, pt.z+12.5)
    yellowmark.AnimState:SetBank("gridplacer")
    yellowmark.AnimState:SetBuild("gridplacer")
    yellowmark.AnimState:PlayAnimation("anim", true)
    yellowmark.Transform:SetScale(2, 2, 2)
    yellowmark.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
    yellowmark.AnimState:SetLayer( LAYER_BACKGROUND )
    yellowmark.AnimState:SetSortOrder( 3 )
    yellowmark.Transform:SetRotation( 45 )
    yellowmark.AnimState:SetMultColour(255/255,255/255,0/255,1)
    yellowmark.AnimState:SetLightOverride(1)
    yellowmark:AddTag("NOCLICK")
    yellowmark:RemoveComponent("stackable")
    yellowmark:RemoveComponent("edible")
    yellowmark:RemoveComponent("tradable")
    yellowmark:RemoveComponent("fuel")
    yellowmark:RemoveComponent("burnable")
    yellowmark:RemoveComponent("propagator")
    yellowmark:RemoveComponent("repairer")
    yellowmark:RemoveComponent("inventoryitem")
    yellowmark:RemoveComponent("deployable")
    yellowmark:RemoveTag("cattoy")
    yellowmark:ListenForEvent( "daytime", function()
        for k = 1,math.random(6,12) do
            local pt1 = yellowmark:GetPosition()
            local trash = SpawnPrefab("cutgrass")
            trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6)))
            trash.AnimState:SetBank("fertilizer")
            trash.AnimState:SetBuild("fertilizer")
            trash.AnimState:PlayAnimation("idle")
            trash.Transform:SetScale(1.5, 1.5, 1.5)
            trash.AnimState:SetMultColour(0/255,255/255,0/255,1)
            trash.components.inventoryitem:ChangeImageName("fertilizer")
            trash:RemoveComponent("stackable")
            trash:RemoveComponent("edible")
            trash:RemoveComponent("tradable")
            trash:RemoveComponent("fuel")
            trash:RemoveComponent("burnable")
            trash:RemoveComponent("propagator")
            trash:RemoveComponent("repairer")
            trash:RemoveComponent("deployable")
            trash:RemoveTag("cattoy")
            trash:AddComponent("named")
            trash.components.named:SetName("Refuse")
            trash.flies = trash:SpawnChild("flies")
            trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end )
            trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            MakeSmallBurnable(trash)
            MakeSmallPropagator(trash)
            trash:AddTag("trash")
        end
    end , GetWorld() )
    yellowmark:ListenForEvent( "nighttime", function()
        for k = 1,math.random(3,5) do
            local pt1 = yellowmark:GetPosition()
            local trash = SpawnPrefab("cutgrass")
            trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6)))
            trash.AnimState:SetBank("fertilizer")
            trash.AnimState:SetBuild("fertilizer")
            trash.AnimState:PlayAnimation("idle")
            trash.Transform:SetScale(1.5, 1.5, 1.5)
            trash.AnimState:SetMultColour(0/255,255/255,0/255,1)
            trash.components.inventoryitem:ChangeImageName("fertilizer")
            trash:RemoveComponent("stackable")
            trash:RemoveComponent("edible")
            trash:RemoveComponent("tradable")
            trash:RemoveComponent("fuel")
            trash:RemoveComponent("burnable")
            trash:RemoveComponent("propagator")
            trash:RemoveComponent("repairer")
            trash:RemoveComponent("deployable")
            trash:RemoveTag("cattoy")
            trash:AddComponent("named")
            trash.components.named:SetName("Refuse")
            trash.flies = trash:SpawnChild("flies")
            trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end )
            trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            MakeSmallBurnable(trash)
            MakeSmallPropagator(trash)
            trash:AddTag("trash")
        end
    end , GetWorld() )
    yellowmark:ListenForEvent( "dusktime", function()
        for k = 1,math.random(5,7) do
            local pt1 = yellowmark:GetPosition()
            local trash = SpawnPrefab("cutgrass")
            trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6)))
            trash.AnimState:SetBank("fertilizer")
            trash.AnimState:SetBuild("fertilizer")
            trash.AnimState:PlayAnimation("idle")
            trash.Transform:SetScale(1.5, 1.5, 1.5)
            trash.AnimState:SetMultColour(0/255,255/255,0/255,1)
            trash.components.inventoryitem:ChangeImageName("fertilizer")
            trash:RemoveComponent("stackable")
            trash:RemoveComponent("edible")
            trash:RemoveComponent("tradable")
            trash:RemoveComponent("fuel")
            trash:RemoveComponent("burnable")
            trash:RemoveComponent("propagator")
            trash:RemoveComponent("repairer")
            trash:RemoveComponent("deployable")
            trash:RemoveTag("cattoy")
            trash:AddComponent("named")
            trash.components.named:SetName("Refuse")
            trash.flies = trash:SpawnChild("flies")
            trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end )
            trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end )
            MakeSmallBurnable(trash)
            MakeSmallPropagator(trash)
            trash:AddTag("trash")
        end
    end , GetWorld() )
    yellowmark:AddTag("yellowmark")
    local footbell = SpawnPrefab("cutgrass")
    footbell.Transform:SetPosition(pt.x-5, 0, pt.z+5)
    footbell.AnimState:SetBank("bell")
    footbell.AnimState:SetBuild("bell")
    footbell.AnimState:PlayAnimation("idle")
    footbell.AnimState:SetMultColour(255/255,255/255,0/255,1)
    footbell.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    footbell:RemoveComponent("stackable")
    footbell:RemoveComponent("edible")
    footbell:RemoveComponent("tradable")
    footbell:RemoveComponent("fuel")
    footbell:RemoveComponent("burnable")
    footbell:RemoveComponent("propagator")
    footbell:RemoveComponent("repairer")
    footbell:RemoveComponent("inventoryitem")
    footbell:RemoveComponent("deployable")
    footbell:RemoveTag("cattoy")
    footbell:AddComponent("named")
    footbell.components.named:SetName("Bell")
    footbell:AddTag("footbell")
    footbell:AddComponent("workable")
    footbell.components.workable:SetWorkAction(ACTIONS.HAMMER)
    footbell.components.workable:SetWorkLeft(3)
    footbell.components.workable:SetOnFinishCallback(function()
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(footbell.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        local pos2 = Vector3(footbell.Transform:GetWorldPosition())
        local ents2 = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 30)
        for k,v in pairs(ents2) do
            if v:HasTag("redmark") or v:HasTag("yellowmark") or v:HasTag("trash") or v:HasTag("footfoot") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               v:Remove()
            end
        end
        footbell:Remove()
    end )
    footbell.components.inspectable.getstatus = function()
        GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
        local foot = SpawnPrefab("cutgrass")
        foot.Transform:SetPosition(pt.x, 10, pt.z)
        foot.AnimState:SetBank("foot")
        foot.AnimState:SetBuild("foot_build")
        foot.AnimState:PlayAnimation("idle")
        foot.Transform:SetFourFaced()
        foot.Transform:SetRotation( 270 )
        foot:RemoveComponent("stackable")
        foot:RemoveComponent("edible")
        foot:RemoveComponent("tradable")
        foot:RemoveComponent("fuel")
        foot:RemoveComponent("burnable")
        foot:RemoveComponent("propagator")
        foot:RemoveComponent("repairer")
        foot:RemoveComponent("inventoryitem")
        foot:RemoveComponent("deployable")
        foot:RemoveTag("cattoy")
        foot:AddTag("footfoot")
        foot.falling = foot:DoPeriodicTask(.01, function() foot.Physics:SetMotorVelOverride(0,-55,0) end)
        foot:DoTaskInTime(0.1, function()
            if foot.falling then foot.falling:Cancel() foot.falling = nil end
            GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
            GetPlayer().components.playercontroller:ShakeCamera(foot, "FULL", 0.5, 0.05, 2, 40)
            SpawnPrefab("collapse_big").Transform:SetPosition(pt.x, 0, pt.z)
            local pos = Vector3(foot.Transform:GetWorldPosition())
            local ents = TheSim:FindEntities(pos.x,0,pos.z, 5)
            for k,v in pairs(ents) do
                if v:HasTag("trash") and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
                   SpawnPrefab("goldnugget").Transform:SetPosition(v.Transform:GetWorldPosition())
                   v:Remove()
                end
                if v:HasTag("player") then
                   v.AnimState:PlayAnimation("hit")
                   v.components.health:DoDelta(-5)
                end
            end
            foot:DoTaskInTime(0.5, function()
                GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop")
                SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(foot.Transform:GetWorldPosition())
                foot:Remove()
            end )
        end )
    end
end
local function OnDeploy (inst, pt)
    makegrinder(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("redmark") then
        data.redmark = true
    end
    if inst:HasTag("yellowmark") then
        data.yellowmark = true
    end
    if inst:HasTag("trash") then
        data.trash = true
    end
    if inst:HasTag("footbell") then
        data.footbell = true
    end
    if inst:HasTag("footfoot") then
        data.footfoot = true
    end
end
local function onload(inst, data)
    if data and data.redmark then
       makegrinder(inst)
       inst:Remove()
    end
    if data and data.yellowmark then
       inst:Remove()
    end
    if data and data.footbell then
       inst:Remove()
    end
    if data and data.footfoot then
       inst:Remove()
    end
    if data and data.trash then
       inst.AnimState:SetBank("fertilizer")
       inst.AnimState:SetBuild("fertilizer")
       inst.AnimState:PlayAnimation("idle")
       inst.Transform:SetScale(1.5, 1.5, 1.5)
       inst.AnimState:SetMultColour(0/255,255/255,0/255,1)
       inst.components.inventoryitem:ChangeImageName("fertilizer")
       inst:RemoveComponent("stackable")
       inst:RemoveComponent("edible")
       inst:RemoveComponent("tradable")
       inst:RemoveComponent("fuel")
       inst:RemoveComponent("burnable")
       inst:RemoveComponent("propagator")
       inst:RemoveComponent("repairer")
       inst:RemoveComponent("deployable")
       inst:RemoveTag("cattoy")
       inst:AddComponent("named")
       inst.components.named:SetName("Refuse")
       inst.flies = inst:SpawnChild("flies")
       inst.components.inventoryitem:SetOnDroppedFn(function() inst.flies = inst:SpawnChild("flies") end )
       inst.components.inventoryitem:SetOnPickupFn(function() if inst.flies then inst.flies:Remove() inst.flies = nil end end )
       inst.components.inventoryitem:SetOnPutInInventoryFn(function() if inst.flies then inst.flies:Remove() inst.flies = nil end end )
       MakeSmallBurnable(inst)
       MakeSmallPropagator(inst)
       inst:AddTag("trash")
    end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڿĿյϣòֻ˾1ݶԵҼŶ򲻻ֳÿ졢ҹ͵ǰᵽϵ壬ɽ飬еĹƽ𣩽ڵϣǻ˾ԴʱҪվںᱻˣ5Ѫ粻ʱԽԽ࣬ʵڴԽյûˡǼΨһһһ˾½ˣеⰹֳߵҵɡҪ˾ˣôҵ弴




.ľʲƷÿ峿Զƽ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\boards.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    local vending = SpawnPrefab("boards")
    vending.Transform:SetPosition(pt.x, pt.y, pt.z)
    vending.AnimState:SetBank("icebox")
    vending.AnimState:SetBuild("ice_box")
    vending.AnimState:PlayAnimation("closed")
    vending.Transform:SetScale(1.3, 1.3, 1.3)
    vending.AnimState:SetMultColour(255/255,255/255,0/255,1)
    vending:RemoveComponent("stackable")
    vending:RemoveComponent("tradable")
    vending:RemoveComponent("edible")
    vending:RemoveComponent("inventoryitem")
    vending:RemoveComponent("repairer")
    vending:RemoveComponent("fuel")
    vending:RemoveComponent("burnable")
    vending:RemoveComponent("propagator")
    vending:RemoveComponent("deployable")
    vending.components.container.canbeopened = true
    vending:DoPeriodicTask(2, function(vending)
        vending.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        vending:DoTaskInTime(1, function() vending.AnimState:SetBloomEffectHandle("") end )
    end )
    vending:AddComponent("workable")
    vending.components.workable:SetWorkAction(ACTIONS.HAMMER)
    vending.components.workable:SetWorkLeft(3)
    vending.components.workable:SetOnFinishCallback(function(vending)
        SpawnPrefab("collapse_big").Transform:SetPosition(vending.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        vending:Remove()
    end )
    vending:ListenForEvent( "daytime", function()
        local num_found = 0
        for k,v in pairs(vending.components.container.slots) do
            if v and v.prefab ~= "goldnugget" and v.prefab ~= "spoiled_food" then
               num_found = num_found + v.components.stackable:StackSize()
               v:Remove()
            end
        end
        for k = 1, num_found do
            local goldnugget = SpawnPrefab("goldnugget")
            vending.components.container:GiveItem(goldnugget)
        end
    end, GetWorld())
    vending:AddTag("vendings")
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("vendings") then
        data.vendings = true
    end
end
local function onload(inst, data)
  if data and data.vendings then
    inst.AnimState:SetBank("icebox")
    inst.AnimState:SetBuild("ice_box")
    inst.AnimState:PlayAnimation("closed")
    inst.Transform:SetScale(1.3, 1.3, 1.3)
    inst.AnimState:SetMultColour(255/255,255/255,0/255,1)
    inst:RemoveComponent("stackable")
    inst:RemoveComponent("tradable")
    inst:RemoveComponent("edible")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("repairer")
    inst:RemoveComponent("fuel")
    inst:RemoveComponent("burnable")
    inst:RemoveComponent("propagator")
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst:DoPeriodicTask(2, function(inst)
        inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end )
    end )
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
        SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:ListenForEvent( "daytime", function()
        local num_found = 0
        for k,v in pairs(inst.components.container.slots) do
            if v and v.prefab ~= "goldnugget" and v.prefab ~= "spoiled_food" then
               num_found = num_found + v.components.stackable:StackSize()
               v:Remove()
            end
        end
        for k = 1, num_found do
            local goldnugget = SpawnPrefab("goldnugget")
            inst.components.container:GiveItem(goldnugget)
        end
    end, GetWorld())
    inst:AddTag("vendings")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
local slotpos = {}
for y = 3, 0, -1 do
    for x = 0, 2 do
        table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0))
    end
end
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,100,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.canbeopened = false
    inst.components.container.onopenfn = function(inst) inst.AnimState:PlayAnimation("open") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst.components.container.onclosefn = function(inst) inst.AnimState:PlayAnimation("close") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end
    inst.components.container.itemtestfn = function(inst, item, slot)
        if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" or item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" or item.prefab == "spoiled_food" or item.prefab == "butter" or item.prefab == "butterflywings" or item.prefab == "cutlichen" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "goatmilk" or item.prefab == "goldnugget" then
           return true
        end
        return false
    end
    inst:AddTag("fridge")

    ľɴ򿪸ӣ߲˺ʲƷУÿ峿ȫÿۼ1ƽ𣬽Ļƽȡ÷ʣĲƷˡԳ۵ʲƷ㽶ܲסϹϡӡʯ񡢻⡢ϡ⡢С⡢㡢㡢ȡ񵰡ȡ⡢̦͡޺ҶӡۡӫĢĢĢꡢجλꡣҪˣôҵɡҪ롰ľ˷һͬ޸




.ըͣúɫըͣңըڵϰDelete

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_DELETE, function()
    GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
    inst:DoTaskInTime(0.1, function() 
        local pos = Vector3(inst.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 100)
        for k,v in pairs(ents) do
            if v:HasTag("bomballright") and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
               local pos1 = Vector3(v.Transform:GetWorldPosition())
               local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 15)
               for k,i in pairs(ents1) do
                   if i.components.combat and i.components.health and not i.components.health:IsDead() and not i:HasTag("player") then
                      SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(i.Transform:GetWorldPosition())
                      i.components.health:Kill()
                   end
                   if i.components.workable and i.components.workable.workleft > 0 and not i.components.inventoryitem then
                      SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(i.Transform:GetWorldPosition())
                      i.components.workable:Destroy(v)
                   end
               end
               GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground")
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition())
               SpawnPrefab("groundpoundring_fx").Transform:SetPosition(v.Transform:GetWorldPosition())
               GetClock():DoLightningLighting()
               GetPlayer().components.playercontroller:ShakeCamera(v, "FULL", 0.7, 0.02, .5, 40)
               v:Remove()
            end
        end
    end )
end )


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\amulet.luaļinst.AnimState:PlayAnimation("redamulet")һвݣ

local function makebomber(inst)
    local pt = inst:GetPosition()
    local bomber = SpawnPrefab("amulet")
    bomber.Transform:SetPosition(pt.x, pt.y, pt.z)
    bomber.AnimState:SetBank("wilson")
    bomber.AnimState:SetBuild("wx78")
    bomber.AnimState:OverrideSymbol("swap_hat", "hat_catcoon", "swap_hat")
    bomber.AnimState:OverrideSymbol("swap_body", "swap_krampus_sack", "backpack")
    bomber.AnimState:OverrideSymbol("swap_body", "swap_krampus_sack", "swap_body")
    bomber.AnimState:Show("HAT")
    bomber.AnimState:Show("HAT_HAIR")
    bomber.AnimState:Hide("HAIR_NOHAT")
    bomber.AnimState:Hide("HAIR")
    bomber.AnimState:Hide("ARM_carry")
    bomber.AnimState:Show("ARM_normal")
    bomber.Transform:SetFourFaced()
    bomber.AnimState:PlayAnimation("idle")
    bomber:RemoveComponent("equippable")
    bomber:RemoveComponent("inventoryitem")
    bomber:RemoveComponent("finiteuses")
    bomber:RemoveComponent("deployable")
    MakeLargeBurnable(bomber)
    MakeLargePropagator(bomber)
    bomber:AddComponent("trader")
    bomber.components.trader:SetAcceptTest(function(bomber, item) 
        if GetPlayer().components.inventory:Has("goldnugget", 10) then
           if item.prefab == "goldnugget" then
              return true
           end
        end
        return false
    end )
    bomber.components.trader.onaccept = function(bomber, giver, item)
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        bomber.AnimState:PlayAnimation("give")
        local bomb = SpawnPrefab("amulet")
        bomb.AnimState:SetBank("bee_mine_maxwell")
        bomb.AnimState:SetBuild("bee_mine_maxwell")
        bomb.AnimState:PlayAnimation("idle")
        bomb.Transform:SetScale(0.8, 0.8, 0.8)
        bomb.AnimState:SetMultColour(255/255,255/255,0/255,1)
        bomb.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
        bomb:AddComponent("named")
        bomb.components.named:SetName("Bomb")
        local minimap = bomb.entity:AddMiniMapEntity()
        minimap:SetIcon( "beemine.png" )
        bomb:RemoveComponent("equippable")
        bomb:RemoveComponent("inventoryitem")
        bomb:RemoveComponent("finiteuses")
        bomb:RemoveComponent("deployable")
        bomb:AddComponent("inventoryitem")
        bomb.components.inventoryitem:ChangeImageName("beemine")
        bomb.components.inventoryitem:SetOnDroppedFn(function()
            bomb:AddTag("bomballright")
        end )
        bomb.components.inventoryitem:SetOnPickupFn(function()
            bomb:RemoveTag("bomballright")
        end )
        bomb.components.inventoryitem:SetOnPutInInventoryFn(function()
            bomb:RemoveTag("bomballright")
        end )
        bomb:AddTag("bomb")
        GetPlayer().components.inventory:GiveItem(bomb)
    end
    bomber:AddTag("bomber")
    for k = 1, 11 do
        local result_offset = FindValidPositionByFan(1 * 2 * PI, 2, 11, function(offset)
            local x,y,z = (pt + offset):Get()
            local ents = TheSim:FindEntities(x,y,z , 1)
            return not next(ents) 
        end)
        if result_offset then
           local bombbye = SpawnPrefab("amulet")
           bombbye.Transform:SetPosition((pt + result_offset):Get())
           bombbye.AnimState:SetBank("bee_mine_maxwell")
           bombbye.AnimState:SetBuild("bee_mine_maxwell")
           bombbye.AnimState:PlayAnimation("idle")
           bombbye.Transform:SetScale(0.8, 0.8, 0.8)
           bombbye.AnimState:SetMultColour(255/255,255/255,0/255,1)
           bombbye.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
           bombbye:RemoveComponent("equippable")
           bombbye:RemoveComponent("inventoryitem")
           bombbye:RemoveComponent("finiteuses")
           bombbye:RemoveComponent("deployable")
           MakeLargeBurnable(bombbye)
           MakeLargePropagator(bombbye)
           bombbye:AddTag("NOCLICK")
           bombbye:AddTag("bombbye")
        end
    end
end
local function OnDeploy (inst, pt)
    makebomber(inst)
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("bomber") then
       data.bomber = true
    end
    if inst:HasTag("bombbye") then
       data.bombbye = true
    end
    if inst:HasTag("bomb") then
       data.bomb = true
    end
    if inst:HasTag("bomballright") then
       data.bomballright = true
    end
end
local function onload(inst, data)
  if data and data.bomber then
    makebomber(inst)
    inst:Remove()
  end
  if data and data.bombbye then
    inst:Remove()
  end
  if data and data.bomb then
    inst.AnimState:SetBank("bee_mine_maxwell")
    inst.AnimState:SetBuild("bee_mine_maxwell")
    inst.AnimState:PlayAnimation("idle")
    inst.Transform:SetScale(0.8, 0.8, 0.8)
    inst.AnimState:SetMultColour(255/255,255/255,0/255,1)
    inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    inst:AddComponent("named")
    inst.components.named:SetName("Bomb")
    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "beemine.png" )
    inst:RemoveComponent("equippable")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("finiteuses")
    inst:RemoveComponent("deployable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem:ChangeImageName("beemine")
    inst.components.inventoryitem:SetOnDroppedFn(function()
        inst:AddTag("bomballright")
    end )
    inst.components.inventoryitem:SetOnPickupFn(function()
        inst:RemoveTag("bomballright")
    end )
    inst.components.inventoryitem:SetOnPutInInventoryFn(function()
        inst:RemoveTag("bomballright")
    end )
    inst:AddTag("bomb")
  end
  if data and data.bomballright then
    inst:AddTag("bomballright")
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    úɫըͣը10ƽŻƽը͵ɹңըըڵϣDeleteңըκըٽľȡңըСͼʾΪըͼ꣬ʱҪͬ鿿ҪըˣյɣŻҼɫħѡźã£3ƽ2جȼϡ1챦ʯ




.ٱǮޣְٱǮޣÿ3ƽ㻨Ǯɱ͡׻ԣ

    ü±ϷĿ¼\data\scripts\prefabs\fishingrod.luaļinst:AddComponent("inspectable")һвݣ

local function itemtest(inst, item, slot)
    if item.prefab == "goldnugget" then
       return true
    end
    return false
end
local slotpos = { Vector3(0,-75,0)}
local widgetbuttoninfo = {
    text = "Change",
    position = Vector3(0, -15, 0),
    fn = function(inst)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup")
        inst:RemoveTag("doll_1") inst:RemoveTag("doll_2") inst:RemoveTag("doll_3") inst:RemoveTag("doll_4") inst:RemoveTag("doll_5") inst:RemoveTag("doll_6") inst:RemoveTag("doll_7") inst:RemoveTag("doll_8") inst:RemoveTag("doll_9") inst:RemoveTag("doll_10")
        if math.random()<.08 then
           inst:AddTag("doll_1")
           inst.AnimState:SetBank("bearger")
           inst.AnimState:SetBuild("bearger_build")
           inst.AnimState:PlayAnimation("idle_loop")
           inst.Transform:SetScale(0.2,0.2,0.2)
        elseif math.random()<.16 then
           inst:AddTag("doll_2")
           inst.AnimState:SetBank("lightning_goat")
           inst.AnimState:SetBuild("lightning_goat_build")
           inst.AnimState:PlayAnimation("idle_loop")
           inst.Transform:SetScale(0.6,0.6,0.6)
        elseif math.random()<.24 then
           inst:AddTag("doll_3")
           inst.AnimState:SetBank("leif")
           inst.AnimState:SetBuild("leif_build")
           inst.AnimState:PlayAnimation("idle_loop")
           inst.Transform:SetScale(0.35,0.35,0.35)
        elseif math.random()<.32 then
           inst:AddTag("doll_4")
           inst.AnimState:SetBank("beefalo")
           inst.AnimState:SetBuild("beefalo_build")
           inst.AnimState:PlayAnimation("idle_loop")
           inst.Transform:SetScale(0.5,0.5,0.5)
        elseif math.random()<.4 then
           inst:AddTag("doll_5")
           inst.AnimState:SetBank("rook")
           inst.AnimState:SetBuild("rook_build")
           inst.AnimState:PlayAnimation("idle")
           inst.Transform:SetScale(0.3,0.3,0.3)
        elseif math.random()<.48 then
           inst:AddTag("doll_6")
           inst.AnimState:SetBank("deerclops")
           inst.AnimState:SetBuild("deerclops_build")
           inst.AnimState:PlayAnimation("idle_loop")
           inst.Transform:SetScale(0.35,0.35,0.35)
        elseif math.random()<.56 then
           inst:AddTag("doll_7")
           inst.AnimState:SetBank("rook")
           inst.AnimState:SetBuild("rook_rhino")
           inst.AnimState:PlayAnimation("idle")
           inst.Transform:SetScale(0.3,0.3,0.3)
        elseif math.random()<.64 then
           inst:AddTag("doll_8")
           inst.AnimState:SetBank("Pig_King")
           inst.AnimState:SetBuild("Pig_King")
           inst.AnimState:PlayAnimation("idle")
           inst.Transform:SetScale(0.4,0.4,0.4)
        elseif math.random()<.72 then
           inst:AddTag("doll_9")
           inst.AnimState:SetBank("goosemoose")
           inst.AnimState:SetBuild("goosemoose_build")
           inst.AnimState:PlayAnimation("idle")
           inst.Transform:SetScale(0.3,0.3,0.3)
        elseif math.random()<.95 then
           inst:AddTag("doll_10")
           inst.AnimState:SetBank("dragonfly")
           inst.AnimState:SetBuild("dragonfly_build")
           inst.AnimState:PlayAnimation("idle")
           inst.Transform:SetScale(0.3,0.3,0.3)
        else
           inst.AnimState:SetBank("trinkets")
           inst.AnimState:SetBuild("trinkets")
           inst.AnimState:PlayAnimation(tostring(4))
           inst.Transform:SetScale(1.5,1.5,1.5)
        end
    end }
local function OnDeploy (inst, pt)
    local doll = SpawnPrefab("fishingrod")
    doll.Transform:SetPosition(pt.x, pt.y, pt.z)
    doll.AnimState:SetBank("trinkets")
    doll.AnimState:SetBuild("trinkets")
    doll.AnimState:PlayAnimation(tostring(4))
    doll.Transform:SetFourFaced()
    doll.Transform:SetScale(1.5,1.5,1.5)
    local light = doll.entity:AddLight()
    light:SetFalloff(0.5)
    light:SetIntensity(.8)
    light:SetRadius(3.0)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    MakeObstaclePhysics(doll, 0.5)
    doll:RemoveComponent("fishingrod")
    doll:RemoveComponent("finiteuses")
    doll:RemoveComponent("inventoryitem")
    doll:RemoveComponent("equippable")
    if doll.components.weapon then doll:RemoveComponent("weapon") end
    doll:RemoveComponent("deployable")
    doll.components.container.canbeopened = true
    doll:AddComponent("named")
    doll.components.named:SetName("Piggy bank")
    doll:AddComponent("sanityaura")
    doll.components.sanityaura.aura = TUNING.SANITYAURA_MED
    doll:AddTag("lightningrod")
    doll:ListenForEvent("lightningstrike", function()
        doll.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
        doll:DoTaskInTime(60, function()
            doll.AnimState:SetBloomEffectHandle("")
        end )
    end )
    doll:AddComponent("workable")
    doll.components.workable:SetWorkAction(ACTIONS.HAMMER)
    doll.components.workable:SetWorkLeft(3)
    doll.components.workable:SetOnFinishCallback(function(doll)
	doll.Light:Enable(false)
	doll.components.container:DropEverything()
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(doll.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        doll:Remove()
    end )
    doll:ListenForEvent( "daytime", function()
        for k = 1, 3 do
            local goldnugget = SpawnPrefab("goldnugget")
            doll.components.container:GiveItem(goldnugget)
        end
    end, GetWorld())
    doll:AddTag("scarytoprey")
    doll:AddTag("dolls")
    inst:Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("dolls") then
       data.dolls = true
    end
    if inst:HasTag("doll_1") then
       data.doll_1 = true
    end
    if inst:HasTag("doll_2") then
       data.doll_2 = true
    end
    if inst:HasTag("doll_3") then
       data.doll_3 = true
    end
    if inst:HasTag("doll_4") then
       data.doll_4 = true
    end
    if inst:HasTag("doll_5") then
       data.doll_5 = true
    end
    if inst:HasTag("doll_6") then
       data.doll_6 = true
    end
    if inst:HasTag("doll_7") then
       data.doll_7 = true
    end
    if inst:HasTag("doll_8") then
       data.doll_8 = true
    end
    if inst:HasTag("doll_9") then
       data.doll_9 = true
    end
    if inst:HasTag("doll_10") then
       data.doll_10 = true
    end
end
local function onload(inst, data)
  if data and data.dolls then
    inst.AnimState:SetBank("trinkets")
    inst.AnimState:SetBuild("trinkets")
    inst.AnimState:PlayAnimation(tostring(4))
    inst.Transform:SetFourFaced()
    inst.Transform:SetScale(1.5,1.5,1.5)
    local light = inst.entity:AddLight()
    light:SetFalloff(0.5)
    light:SetIntensity(.8)
    light:SetRadius(3.0)
    light:SetColour(180/255, 195/255, 50/255)
    light:Enable(true)
    MakeObstaclePhysics(inst, 0.5)
    inst:RemoveComponent("fishingrod")
    inst:RemoveComponent("finiteuses")
    inst:RemoveComponent("inventoryitem")
    inst:RemoveComponent("equippable")
    if inst.components.weapon then inst:RemoveComponent("weapon") end
    inst:RemoveComponent("deployable")
    inst.components.container.canbeopened = true
    inst:AddComponent("named")
    inst.components.named:SetName("Piggy bank")
    inst:AddComponent("sanityaura")
    inst.components.sanityaura.aura = TUNING.SANITYAURA_MED
    inst:AddTag("lightningrod")
    inst:ListenForEvent("lightningstrike", function()
        inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
        inst:DoTaskInTime(60, function()
            inst.AnimState:SetBloomEffectHandle("")
        end )
    end )
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(3)
    inst.components.workable:SetOnFinishCallback(function(inst)
	inst.Light:Enable(false)
	inst.components.container:DropEverything()
        SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        inst:Remove()
    end )
    inst:ListenForEvent( "daytime", function()
        for k = 1, 3 do
            local goldnugget = SpawnPrefab("goldnugget")
            inst.components.container:GiveItem(goldnugget)
        end
    end, GetWorld())
    inst:AddTag("scarytoprey")
    inst:AddTag("dolls")
  end
  if data and data.doll_1 then
     inst:AddTag("doll_1")
     inst.AnimState:SetBank("bearger")
     inst.AnimState:SetBuild("bearger_build")
     inst.AnimState:PlayAnimation("idle_loop")
     inst.Transform:SetScale(0.2,0.2,0.2)
  end
  if data and data.doll_2 then
     inst:AddTag("doll_2")
     inst.AnimState:SetBank("lightning_goat")
     inst.AnimState:SetBuild("lightning_goat_build")
     inst.AnimState:PlayAnimation("idle_loop")
     inst.Transform:SetScale(0.6,0.6,0.6)
    end
  if data and data.doll_3 then
     inst:AddTag("doll_3")
     inst.AnimState:SetBank("leif")
     inst.AnimState:SetBuild("leif_build")
     inst.AnimState:PlayAnimation("idle_loop")
     inst.Transform:SetScale(0.35,0.35,0.35)
  end
  if data and data.doll_4 then
     inst:AddTag("doll_4")
     inst.AnimState:SetBank("beefalo")
     inst.AnimState:SetBuild("beefalo_build")
     inst.AnimState:PlayAnimation("idle_loop")
     inst.Transform:SetScale(0.5,0.5,0.5)
  end
  if data and data.doll_5 then
     inst:AddTag("doll_5")
     inst.AnimState:SetBank("rook")
     inst.AnimState:SetBuild("rook_build")
     inst.AnimState:PlayAnimation("idle")
     inst.Transform:SetScale(0.3,0.3,0.3)
  end
  if data and data.doll_6 then
     inst:AddTag("doll_6")
     inst.AnimState:SetBank("deerclops")
     inst.AnimState:SetBuild("deerclops_build")
     inst.AnimState:PlayAnimation("idle_loop")
     inst.Transform:SetScale(0.35,0.35,0.35)
  end
  if data and data.doll_7 then
     inst:AddTag("doll_7")
     inst.AnimState:SetBank("rook")
     inst.AnimState:SetBuild("rook_rhino")
     inst.AnimState:PlayAnimation("idle")
     inst.Transform:SetScale(0.3,0.3,0.3)
  end
  if data and data.doll_8 then
     inst:AddTag("doll_8")
     inst.AnimState:SetBank("Pig_King")
     inst.AnimState:SetBuild("Pig_King")
     inst.AnimState:PlayAnimation("idle")
     inst.Transform:SetScale(0.4,0.4,0.4)
  end
  if data and data.doll_9 then
     inst:AddTag("doll_9")
     inst.AnimState:SetBank("goosemoose")
     inst.AnimState:SetBuild("goosemoose_build")
     inst.AnimState:PlayAnimation("idle")
     inst.Transform:SetScale(0.3,0.3,0.3)
  end
  if data and data.doll_10 then
     inst:AddTag("doll_10")
     inst.AnimState:SetBank("dragonfly")
     inst.AnimState:SetBuild("dragonfly_build")
     inst.AnimState:PlayAnimation("idle")
     inst.Transform:SetScale(0.3,0.3,0.3)
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload
    inst:AddComponent("container")
    inst.components.container:SetNumSlots(#slotpos)
    inst.components.container.widgetslotpos = slotpos
    inst.components.container.widgetpos = Vector3(0,150,0)
    inst.components.container.side_align_tip = 160
    inst.components.container.itemtestfn = itemtest
    inst.components.container.widgetbuttoninfo = widgetbuttoninfo
    inst.components.container.canbeopened = false

    ְٱǮޣǮ޿ɴ򿪸ӣÿ콫3ƽ㻨ǮڸȡϷġChangeťʹǮ޸ĻΪ¹ܵ͡ٱǮ޷ڼУɷ׻Ჹԣҿ𼦡ӵСǲ͵ڵϵʳҪٱǮˣôҵɣĻƽڵϡѡף£2֦2˿




.ȼӪأB޶ȼӪأʩһӦȫٰB˷

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_B, function()
    if not inst:HasTag("campsite") then
       if inst.components.inventory:Has("goldnugget", 50) then
          inst.components.inventory:ConsumeByName("goldnugget", 50)
          GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
          inst:AddTag("campsite")
          local pt = inst:GetPosition()
          local pt0 = Vector3(inst.Transform:GetWorldPosition())
          for k = 1, 50 do
              local result_offset = FindValidPositionByFan(1 * 2 * PI, 8.5, 50, function(offset)
                  local x,y,z = (pt0 + offset):Get()
                  local ents = TheSim:FindEntities(x,y,z , 1)
                  return not next(ents) 
              end )
              if result_offset then
                 local wall = SpawnPrefab("wall_wood")
                 wall.Transform:SetScale(0.65,0.65,0.65)
                 MakeObstaclePhysics(wall, .25)
                 wall:RemoveComponent("workable")
                 wall.components.health:SetInvincible(true)
                 wall.persists = false
                 wall:AddTag("tempbuilding")
                 wall.Transform:SetPosition((pt0 + result_offset):Get())
                 wall.components.inspectable.getstatus = function(wall)
                     wall.Transform:SetScale(0.65, 0.1, 0.65)
                     wall.Physics:SetActive(false)
                     GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                     wall:DoTaskInTime(5, function(wall)
                         wall.Transform:SetScale(0.65, 0.65, 0.65)
                         wall.Physics:SetActive(true)
                         GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
                     end )
                 end
              end
          end
          local building1 = SpawnPrefab("tent")
          building1.Transform:SetPosition(pt.x-4, 0, pt.z-4)
          building1.AnimState:SetMultColour(255/255,105/255,0/255,1)
          building1.persists = false
          building1:AddTag("tempbuilding")
          local building2 = SpawnPrefab("ancient_altar")
          building2.Transform:SetPosition(pt.x-4+2.5, 0, pt.z-4-2.5)
          building2.Transform:SetScale(0.45,0.45,0.45)
          building2.persists = false
          building2:AddTag("NOCLICK")
          building2:AddTag("tempbuilding")
          local building3 = SpawnPrefab("lightning_rod")
          building3.Transform:SetPosition(pt.x-4-2.4, 0, pt.z-4+2.4)
          building3.Transform:SetScale(0.7,0.7,0.7)
          building3.persists = false
          building3:AddTag("NOCLICK")
          building3:AddTag("tempbuilding")
          local building4 = SpawnPrefab("ruins_table")
          building4.Transform:SetPosition(pt.x+3.3, 0, pt.z-3.3)
          building4.persists = false
          building4:AddTag("NOCLICK")
          building4:AddTag("tempbuilding")
          local building5 = SpawnPrefab("ruins_chair")
          building5.Transform:SetPosition(pt.x+4.9, 0, pt.z-4.9)
          building5.persists = false
          building5:AddTag("NOCLICK")
          building5:AddTag("tempbuilding")
          local building6 = SpawnPrefab("cookpot")
          building6.Transform:SetPosition(pt.x+4.3, 0, pt.z+4.3)
          building6.Transform:SetScale(0.7,0.7,0.7)
          building6.persists = false
          building6:AddTag("tempbuilding")
          local building7 = SpawnPrefab("icebox")
          building7.Transform:SetPosition(pt.x+4.5-1.3, 0, pt.z+4.5+1.3)
          building7.persists = false
          building7:AddTag("tempbuilding")
          for k = 1, 3 do
              local foodnames = {"butterflymuffin","frogglebunwich","taffy","pumpkincookie","stuffedeggplant","fishsticks","honeynuggets","honeyham","dragonpie","kabobs","mandrakesoup","baconeggs","meatballs","bonestew","perogies","turkeydinner","ratatouille","jammypreserves","fruitmedley","fishtacos","waffles","unagi","flowersalad","icecream","watermelonicle","trailmix","hotchili","guacamole"}
              local foodname = foodnames[math.random(#foodnames)]
              local food = SpawnPrefab(foodname)
              building7.components.container:GiveItem(food)
          end
          local building8 = SpawnPrefab("dragonflychest")
          building8.Transform:SetPosition(pt.x+3.8+3, 0, pt.z-3.8+3)
          building8.persists = false
          building8:AddTag("tempbuilding")
          local lantern = SpawnPrefab("lantern")
          building8.components.container:GiveItem(lantern)
          if not GetSeasonManager():IsSummer() then
             local building9 = SpawnPrefab("firepit")
             building9.Transform:SetPosition(pt.x, 0, pt.z)
             building9:RemoveAllEventCallbacks()
             building9:ListenForEvent("onextinguish", function(building9)
                 if building9.components.cooker then
                    building9:RemoveComponent("cooker")
                 end
                 if building9.components.fueled then
                    building9.components.fueled:InitializeFuelLevel(0)
                 end
             end )
             building9:ListenForEvent("onignite", function(building9)
                 if not building9.components.cooker then
                    building9:AddComponent("cooker")
                 end
             end )
             building9.persists = false
             building9:AddTag("tempbuilding")
             for k = 1, 10 do
                 local log = SpawnPrefab("log")
                 building8.components.container:GiveItem(log)
             end
          else
             local building9 = SpawnPrefab("coldfirepit")
             building9.Transform:SetPosition(pt.x, 0, pt.z)
             building9.persists = false
             building9:AddTag("tempbuilding")
             for k = 1, 10 do
                 local nitre = SpawnPrefab("nitre")
                 building8.components.container:GiveItem(nitre)
             end
          end
          local building10 = SpawnPrefab("firesuppressor")
          building10.Transform:SetPosition(pt.x-4+3, 0, pt.z+4+3)
          building10.Transform:SetScale(0.8,0.8,0.8)
          building10.persists = false
          building10:AddTag("tempbuilding")
          local building11 = SpawnPrefab("eyeturret")
          building11.Transform:SetPosition(pt.x-4+1, 0, pt.z+4+1)
          building11.components.combat:SetAttackPeriod(0.5)
          if building11.components.machine then building11:RemoveComponent("machine") end
          building11.persists = false
          building11:AddTag("tempbuilding")
          local building12 = SpawnPrefab("pumpkin_lantern")
          building12.Transform:SetPosition(pt.x-4-2, 0, pt.z+4-2)
          building12.Transform:SetScale(1.5,1.5,1.5)
          building12.components.inventoryitem.canbepickedup = false
          building12.persists = false
          building12:AddTag("NOCLICK")
          building12:AddTag("tempbuilding")
       end
    else
       GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
       inst:RemoveTag("campsite")
       local pos = Vector3(inst.Transform:GetWorldPosition())
       local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000)
       for k,v in pairs(ents) do
           if v:HasTag("tempbuilding") then
              v:Remove()
           end
       end
    end
end )

    50ƽʱڿտĵطB޶ȼӪأϻƽʱ޷ޣٴΰB˷ȼӪΧǽΧǽɿţ5Զţлѡ񡢹ӡ䡢ϹϵƵʩ۾Ȱȫ豸лȼϣΪʯ༾Ϊľͷṩһյƹʹã3ƷҰҲƷζڻԭ򣬶ȼӪΪʱʩ浵˳ٶȼӪؽʧǵ֮ǰȡе˽ƷŶ




һ.βֶ򳡣Ȧ60벻򵽣Ӯ50ƽ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\coontail.luaļinst:AddComponent("inspectable")һвݣ

local function makecourt(inst)
    local pt = inst:GetPosition()
    local caddie = SpawnPrefab("coontail")
    caddie.Transform:SetPosition(pt.x, pt.y, pt.z)
    caddie.AnimState:SetBank("wilson")
    caddie.AnimState:SetBuild("wes")
    caddie.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat")
    caddie.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body")
    caddie.AnimState:Show("HAT")
    caddie.AnimState:Show("HAT_HAIR")
    caddie.AnimState:Hide("HAIR_NOHAT")
    caddie.AnimState:Hide("HAIR")
    caddie.AnimState:Hide("ARM_carry")
    caddie.AnimState:Show("ARM_normal")
    caddie.Transform:SetFourFaced()
    caddie.AnimState:PlayAnimation("idle")
    caddie:RemoveComponent("inventoryitem")
    caddie:RemoveComponent("stackable")
    caddie:RemoveComponent("deployable")
    caddie:RemoveTag("cattoy")
    caddie:AddComponent("workable")
    caddie.components.workable:SetWorkAction(ACTIONS.HAMMER)
    caddie.components.workable:SetWorkLeft(1)
    caddie.components.workable:SetOnFinishCallback(function(caddie)
        SpawnPrefab("collapse_big").Transform:SetPosition(caddie.Transform:GetWorldPosition())
        GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
        GetPlayer().SoundEmitter:KillSound("beavermusic")
        local pos = Vector3(caddie.Transform:GetWorldPosition())
        local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
        for k,v in pairs(ents) do
            if v:HasTag("border") or v:HasTag("landmine") then
               SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition())
               v:Remove()
            end
        end
        caddie:Remove()
    end )
    caddie:AddComponent("named")
    caddie.components.named:SetName("Pitcher")
    caddie:AddComponent("talker")
    caddie:AddComponent("trader")
    caddie.components.trader:SetAcceptTest(function(caddie, item)
        if not caddie:HasTag("startgame") then
           if GetPlayer().components.inventory:Has("goldnugget", 10) then
              if item.prefab == "goldnugget" then
                 return true
              end
           end
        end
        return false
    end )
    caddie.components.trader.onaccept = function(caddie, giver, item)
        caddie:AddTag("startgame")
        GetPlayer().components.inventory:ConsumeByName("goldnugget", 9)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available")
        caddie.components.talker:Say("Are you ready ?", 3, false)
        GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic")
        for k = 1, 10 do
            local landmine = SpawnPrefab("coontail")
            landmine.Transform:SetPosition(pt.x+(math.random(7)-math.random(7)), 0, pt.z+(math.random(7)-math.random(7)))
            landmine.AnimState:SetBank("bee_mine")
            landmine.AnimState:SetBuild("bee_mine")
            landmine.AnimState:PlayAnimation("idle")
            landmine.Transform:SetScale(1.2, 1.2, 1.2)
            landmine.AnimState:SetMultColour(255/255,105/255,0/255,1)
            landmine.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
            landmine:RemoveComponent("inventoryitem")
            landmine:RemoveComponent("stackable")
            landmine:RemoveComponent("deployable")
            landmine:RemoveTag("cattoy")
            landmine.persists = false
	    landmine:DoPeriodicTask(0.01, function()
                local pos0 = Vector3(landmine.Transform:GetWorldPosition())
                local ents0 = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 1)
                for k,v in pairs(ents0) do
                    if v and v:HasTag("player") and not v:HasTag("pain")then
                       v:AddTag("pain")
                       v.sg:GoToState("hit")
                       if v.components.health then v.components.health:DoDelta(-3) end
                       v:DoTaskInTime(0.5, function() v:RemoveTag("pain") end )
                    end
                end
	    end )
            landmine:AddTag("landmine")
        end
        caddie:DoTaskInTime(3, function()
            caddie.components.talker:Say("Go !", 1, false)
            GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
            caddie.task = caddie:DoPeriodicTask(0.4, function(caddie)
                local target = FindEntity(caddie, 9, function(guy) 
                    return guy:HasTag("player")
                end )
                if target then
                   caddie.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180)
                   caddie.AnimState:PlayAnimation("give")
                   local dodgeball = SpawnPrefab("coontail")
                   dodgeball.AnimState:SetBank("bulb")
                   dodgeball.AnimState:SetBuild("bulb")
                   dodgeball.AnimState:PlayAnimation("idle")
                   dodgeball.Transform:SetPosition(pt.x, 0, pt.z)
                   dodgeball:RemoveComponent("inventoryitem")
                   dodgeball:RemoveComponent("stackable")
                   dodgeball:RemoveComponent("deployable")
                   dodgeball:RemoveTag("cattoy")
                   dodgeball.persists = false
	           dodgeball:AddComponent("complexprojectile")
	           dodgeball.components.complexprojectile.yOffset = 1
                   if math.random()<.5 then
                      local targetpos = target:GetPosition()
                      dodgeball.components.complexprojectile:Launch(targetpos)
                   else
                      dodgeball.components.complexprojectile:Launch(Point(pt.x+(math.random(9)-math.random(9)), 0, pt.z+(math.random(9)-math.random(9))))
                   end
	           dodgeball.components.complexprojectile:SetOnHit(function()
                       SpawnPrefab("small_puff").Transform:SetPosition(dodgeball.Transform:GetWorldPosition())
                       dodgeball:Remove()
                   end )
	           dodgeball:DoPeriodicTask(0.01, function()
                       local pos = Vector3(dodgeball.Transform:GetWorldPosition())
                       local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 1)
                       for k,v in pairs(ents) do
                           if v and v:HasTag("player") then
                              v.sg:GoToState("hit")
                              if caddie.task then caddie.task:Cancel() caddie.task = nil end
                              if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end
                              caddie.Transform:SetRotation( 0 )
                              caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                              caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end )
                              caddie.components.talker:Say("Game over !", 3, false)
                              GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                              GetPlayer().SoundEmitter:KillSound("beavermusic")
                              SpawnPrefab("collapse_small").Transform:SetPosition(dodgeball.Transform:GetWorldPosition())
                              dodgeball:Remove()
                              local pos1 = Vector3(caddie.Transform:GetWorldPosition())
                              local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10)
                              for k,v in pairs(ents1) do
                                  if v:HasTag("landmine") then
                                     v:Remove()
                                  end
                              end
                              caddie:RemoveTag("startgame")
                           end
                       end
	           end )
                else
                   if caddie.task then caddie.task:Cancel() caddie.task = nil end
                   if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end
                   caddie.Transform:SetRotation( 0 )
                   caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true)
                   caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end )
                   caddie.components.talker:Say("Game over !", 3, false)
                   GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
                   GetPlayer().SoundEmitter:KillSound("beavermusic")
                   local pos1 = Vector3(caddie.Transform:GetWorldPosition())
                   local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10)
                   for k,v in pairs(ents1) do
                       if v:HasTag("landmine") then
                          v:Remove()
                       end
                   end
                   caddie:RemoveTag("startgame")
                end
            end )
        end )
        caddie.task2 = caddie:DoTaskInTime(63, function()
            if caddie:HasTag("startgame") then
               if caddie.task then caddie.task:Cancel() caddie.task = nil end
               if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end
               caddie.Transform:SetRotation( 0 )
               caddie.AnimState:PlayAnimation("give")
               caddie.components.talker:Say("You win !", 3, false)
               GetPlayer().SoundEmitter:KillSound("beavermusic")
               caddie:StartThread(function()
                   for k = 1, 10 do
                       GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
                       Sleep(0.15)
                   end
               end )
               for k = 1, 50 do
                   local goldnugget = SpawnPrefab("goldnugget")
                   GetPlayer().components.inventory:GiveItem(goldnugget)
               end
               local pos1 = Vector3(caddie.Transform:GetWorldPosition())
               local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10)
               for k,v in pairs(ents1) do
                   if v:HasTag("landmine") then
                      v:Remove()
                   end
               end
               caddie:RemoveTag("startgame")
            end
        end )
    end
    caddie:AddTag("caddie")
    for k = 1, 50 do
        local result_offset = FindValidPositionByFan(1 * 2 * PI, 8.5, 50, function(offset)
            local x,y,z = (pt + offset):Get()
            local ents = TheSim:FindEntities(x,y,z , 1)
            return not next(ents) 
        end)
        if result_offset then
           local border = SpawnPrefab("coontail")
           border.Transform:SetPosition((pt + result_offset):Get())
           border.AnimState:SetBank("bulb")
           border.AnimState:SetBuild("bulb")
           border.AnimState:PlayAnimation("idle")
           border.Transform:SetScale(1.2, 1.2, 1.2)
           border.AnimState:SetMultColour(255/255,0/255,0/255,1)
           border.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
           border.AnimState:SetLayer( LAYER_BACKGROUND )
           border.AnimState:SetSortOrder( 1 )
           border:RemoveComponent("inventoryitem")
           border:RemoveComponent("stackable")
           border:RemoveComponent("deployable")
           border:RemoveTag("cattoy")
           border:DoPeriodicTask(2, function(shopsign)
               border.AnimState:SetMultColour(0/255,255/255,0/255,1)
               border:DoTaskInTime(1, function() border.AnimState:SetMultColour(255/255,0/255,0/255,1) end )
           end )
           border:AddTag("NOCLICK")
           border:AddTag("border")
        end
    end
end
local function OnDeploy (inst, pt)
    makecourt(inst)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
    if inst:HasTag("caddie") then
       data.caddie = true
    end
    if inst:HasTag("border") then
       data.border = true
    end
end
local function onload(inst, data)
  if data and data.caddie then
     makecourt(inst)
     inst:Remove()
  end
  if data and data.border then
     inst:Remove()
  end
end
    inst.OnSave = onsave
    inst.OnLoad = onload

    ڿտĵϣβֶ򳡣1βͶԵҼŶ򲻻ֳͶ10ƽһΣŻƽͶֵ᲻ڲܳԲȦ߽硢ҵ£60룬ͿӮ50ƽĽڻϰᱻˣ3ѪŵܰɡҪˣôͶּ




һһ.ٷ񵰣Ϸ1СʱС

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļSMALLBIRD_HATCH_TIME = total_day_time * 3, -- must be content for this amount of cumulative time to hatch滻Ϊݣ

SMALLBIRD_HATCH_TIME = seg_time*1,

    Ϸ1СʱС




һ.񲻳Ѫιʳ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\smallbird.luaļ

    1.--print("smallbird - OnGetItemFromPlayer")һвݣ

        local player = GetPlayer()
        if player and player.components.leader then
                player.components.leader:AddFollower(inst)
        end


    2.inst.components.combat:SetDefaultDamage(TUNING.TEENBIRD_DAMAGE)滻Ϊinst.components.combat:SetDefaultDamage(TUNING.TEENBIRD_DAMAGE*5)


    3.return TUNING.TEENBIRD_GROW_TIME滻Ϊreturn TUNING.TEENBIRD_GROW_TIME*1000


    4.inst.components.health:SetMaxHealth(TUNING.TEENBIRD_HEALTH)滻Ϊinst.components.health:SetMaxHealth(TUNING.TEENBIRD_HEALTH*100)

    18000첻Ѫ30000180ˣιʳ




һ.ι

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\smallbird.luaļlocal function OnEat(inst, food)һвݣ

    if food.components.edible then
       local poo = SpawnPrefab("poop")
       poo.Transform:SetPosition(inst.Transform:GetWorldPosition())		
    end

    ι




һ.ιʳ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\smallbird.luaļinst:AddComponent("hunger")һвݣ

    inst.components.hunger.burning = false

    ιʳΪԶֵ˲뿿ιʳѪ




һ.岻˺

    ü±ϷĿ¼\data\scripts\prefabs\trap_teeth.luaļif target then滻Ϊif target and not target:HasTag("smallbird") then

    岻˺




һ.Ǵⲻ˹

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\bunnyman.luaļif guy:HasTag("player")滻Ϊif guy:HasTag("monster")

    ˲ǣע滻ֻһеһֲ֣Ҫ




һ.ˢˣ÷ˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\rabbithouse.luaļinst.components.spawner:Configure( "bunnyman", TUNING.TOTAL_DAY_TIME)滻Ϊinst.components.spawner:Configure( "bunnyman", TUNING.TOTAL_DAY_TIME*0)

    ɴһˣ÷һ




һ.ˢˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pighouse.luaļinst.components.spawner:Configure( "pigman", TUNING.TOTAL_DAY_TIME*4)滻Ϊinst.components.spawner:Configure( "pigman", TUNING.TOTAL_DAY_TIME*0)

    ɴһˣһ




һ.ø

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pigman.luaļ

    1.inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER)滻Ϊ--inst.components.follower:AddLoyaltyTime(item.components.edible:GetHunger() * TUNING.PIG_LOYALTY_PER_HUNGER)


    2.inst.components.follower.maxfollowtime = TUNING.PIG_LOYALTY_MAXTIME滻Ϊ--inst.components.follower.maxfollowtime = TUNING.PIG_LOYALTY_MAXTIME

    ø棬Ҳ뿪һҪڻԣ




.

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\pigman.luaļ

    1.return guy:HasTag("character") and not guy:HasTag("guard")滻Ϊreturn guy:HasTag("character") and not guy:HasTag("guard") and not guy:HasTag("player")


    2.ɾݣ

        if not GetClock():IsDay() and home and home.components.burnable and home.components.burnable:IsBurning() then
            local lightThief = FindEntity(home, home.components.burnable:GetLargestLightRadius(), function(guy)
                return guy:HasTag("player")
                       and guy.LightWatcher:IsInLight()
                       and not (defenseTarget.components.trader and defenseTarget.components.trader:IsTryingToTradeWithMe(guy) ) 
                       and not (inst.components.trader and inst.components.trader:IsTryingToTradeWithMe(guy) ) 
            end)
            if lightThief then
                return lightThief
            end
        end

    




һ.޸ĵֵ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

	    PIG_HEALTH = 250,
	    WEREPIG_HEALTH = 350,
	    PIG_GUARD_HEALTH = 300,
	    PERD_HEALTH = 50,
	    MERM_HEALTH = 250,
	    WALRUS_HEALTH = 150,
С        LITTLE_WALRUS_HEALTH = 100,
	    PENGUIN_HEALTH = 150,
ʿ	    KNIGHT_HEALTH = 300,
	    BISHOP_HEALTH = 300,
ս	    ROOK_HEALTH = 300,
Զػ	    MINOTAUR_HEALTH = 2500,
ţ	    SLURTLE_HEALTH = 600,
	    SNURTLE_HEALTH = 200,
ͺ	    BUZZARD_HEALTH = 125,
	    GHOST_HEALTH = 200,
ţ	    BEEFALO_HEALTH = 500,
Сţ	    BABYBEEFALO_HEALTH = 300,
	    KOALEFANT_HEALTH = 500,
	    BAT_HEALTH = 50,
С֩	    SPIDER_HEALTH = 100,
֩	    SPIDER_WARRIOR_HEALTH = 200,
Ѩ֩	    SPIDER_HIDER_HEALTH = 150,
֩	    SPIDER_SPITTER_HEALTH = 175,
	    LEIF_HEALTH = 2000,
¹	    DEERCLOPS_HEALTH = 2000,
۷	    BEE_HEALTH = 100,
	    WORM_HEALTH = 900,
	    TENTACLE_HEALTH = 500,
ʳ˻۾	    EYEPLANT_HEALTH = 30,
	    TALLBIRD_HEALTH = 400,
	    RABBIT_HEALTH = 25,
	    MOLE_HEALTH = 30,
	    FROG_HEALTH = 100,
	    HOUND_HEALTH = 150,
	    FIREHOUND_HEALTH = 100,
	    ICEHOUND_HEALTH = 100,
		MOSQUITO_HEALTH = 100,
˹	    KRAMPUS_HEALTH = 200,
찵Ӱ	    TERRORBEAK_HEALTH = 400,
аӰ	    CRAWLINGHORROR_HEALTH = 300,
	    BIRD_HEALTH = 25,
֩Ů	    SPIDERQUEEN_HEALTH = 1250,
	    BUNNYMAN_HEALTH = 200,
Ϻ		ROCKY_HEALTH = 1500,
		MONKEY_HEALTH = 125,
¹Ѽ		MOOSE_HEALTH = 3000,
СѼ		MOSSLING_HEALTH = 350,
		DRAGONFLY_HEALTH = 2750,
		BEARGER_HEALTH = 3000,
	    WARG_HEALTH = 600,

    ޸ÿк֣޸ĶӦĵֵ罫ֵ1ͽLEIF_HEALTH = 2000,滻ΪLEIF_HEALTH = 4000,ɡ罫¹ֵ10ͽDEERCLOPS_HEALTH = 2000,滻ΪDEERCLOPS_HEALTH = 200,




.޸ĵ˹

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

	    PIG_DAMAGE = 33,
	    WEREPIG_DAMAGE = 40,
	    PIG_GUARD_DAMAGE = 33,
	    PERD_DAMAGE = 20,
	    MERM_DAMAGE = 30,
	    WALRUS_DAMAGE = 33,
С        LITTLE_WALRUS_DAMAGE = 22,
	    PENGUIN_DAMAGE = 33,
ʿ	    KNIGHT_DAMAGE = 40,
	    BISHOP_DAMAGE = 40,
ս	    ROOK_DAMAGE = 45,
Զػ	    MINOTAUR_DAMAGE = 100,
ţ	    SLURTLE_DAMAGE = 25,
	    SNURTLE_DAMAGE = 5,
	    LIGHTNING_DAMAGE = 10,
	    LIGHTNING_GOAT_DAMAGE = 25,
ͺ	    BUZZARD_DAMAGE = 15,
̹ľ	    MARSHBUSH_DAMAGE = wilson_health*.02,
	    CACTUS_DAMAGE = wilson_health*.04,
	    GHOST_DAMAGE = wilson_health*0.1,
ţ	    BEEFALO_DAMAGE = 34,
	    KOALEFANT_DAMAGE = 50,
	   	BAT_DAMAGE = 20,
С֩	    SPIDER_DAMAGE = 20,
֩	    SPIDER_WARRIOR_DAMAGE = 20,
Ѩ֩	    SPIDER_HIDER_DAMAGE = 20,
֩	    SPIDER_SPITTER_DAMAGE_MELEE = 20,
	    LEIF_DAMAGE = 150,
¹	    DEERCLOPS_DAMAGE = 150,
۷	    BEE_DAMAGE = 10,
	    WORM_DAMAGE = 75,
	    TENTACLE_DAMAGE = 34,
ʳ˻۾	    EYEPLANT_DAMAGE = 20,
	    TALLBIRD_DAMAGE = 50,
	    FROG_DAMAGE = 10,
	    HOUND_DAMAGE = 20,
	    FIREHOUND_DAMAGE = 30,
	    ICEHOUND_DAMAGE = 30,
		MOSQUITO_DAMAGE = 3,
˹	    KRAMPUS_DAMAGE = 50,
찵Ӱ	    TERRORBEAK_DAMAGE = 50,
аӰ	    CRAWLINGHORROR_DAMAGE = 20,
֩Ů	    SPIDERQUEEN_DAMAGE = 80,
	    BUNNYMAN_DAMAGE = 40,
Ϻ		ROCKY_DAMAGE = 75,
		MONKEY_MELEE_DAMAGE = 20,
¹Ѽ		MOOSE_DAMAGE = 150,
¹Ѽ		MOOSE_EGG_DAMAGE = 10,
СѼ		MOSSLING_DAMAGE = 50,
	    DRAGONFLY_DAMAGE = 150,
		BEARGER_DAMAGE = 200,
		CATCOON_DAMAGE = 25,
	    WARG_DAMAGE = 50,

    ޸ÿк֣޸ĶӦĵ˹罫1ͽLEIF_DAMAGE = 150,滻ΪLEIF_DAMAGE = 300,ɡ罫¹10ͽDEERCLOPS_DAMAGE = 150,滻ΪDEERCLOPS_DAMAGE = 15,




.޸ĵ˹

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļֱݣ

	    PIG_ATTACK_PERIOD = 3,
	    WEREPIG_ATTACK_PERIOD = 2,
	    PIG_GUARD_ATTACK_PERIOD = 1.5,
	    PERD_ATTACK_PERIOD = 3,
	    MERM_ATTACK_PERIOD = 3,
	    WALRUS_ATTACK_PERIOD = 3,
С        LITTLE_WALRUS_ATTACK_PERIOD = 3 * 1.7,
	    PENGUIN_ATTACK_PERIOD = 3,
ʿ	    KNIGHT_ATTACK_PERIOD = 2,
	    BISHOP_ATTACK_PERIOD = 4,
ս	    ROOK_ATTACK_PERIOD = 2,
Զػ	    MINOTAUR_ATTACK_PERIOD = 2,
ţ	    SLURTLE_ATTACK_PERIOD = 4,
	    LIGHTNING_GOAT_ATTACK_PERIOD = 2,
ͺ	    BUZZARD_ATTACK_PERIOD = 2,
	    BAT_ATTACK_PERIOD = 1,
С֩	    SPIDER_ATTACK_PERIOD = 3,
֩	    SPIDER_WARRIOR_ATTACK_PERIOD = 4,
Ѩ֩	    SPIDER_HIDER_ATTACK_PERIOD = 3,
֩	    SPIDER_SPITTER_ATTACK_PERIOD = 5,
	    LEIF_ATTACK_PERIOD = 3,
¹	    DEERCLOPS_ATTACK_PERIOD = 3,
۷	    BEE_ATTACK_PERIOD = 2,
	    WORM_ATTACK_PERIOD = 4,
	    TENTACLE_ATTACK_PERIOD = 2,
ʳ˻۾	    EYEPLANT_ATTACK_PERIOD = 1,
	    TALLBIRD_ATTACK_PERIOD = 2,
	    FROG_ATTACK_PERIOD = 1,
	    HOUND_ATTACK_PERIOD = 2,
	    FIREHOUND_ATTACK_PERIOD = 2,
	    ICEHOUND_ATTACK_PERIOD = 2,
		MOSQUITO_ATTACK_PERIOD = 7,
˹	    KRAMPUS_ATTACK_PERIOD = 1.2,
찵Ӱ	    TERRORBEAK_ATTACK_PERIOD= 1.5,
аӰ	    CRAWLINGHORROR_ATTACK_PERIOD= 2.5,
	    BUNNYMAN_ATTACK_PERIOD = 2,
		MONKEY_ATTACK_PERIOD = 2,
¹Ѽ		MOOSE_ATTACK_PERIOD = 3,
СѼ		MOSSLING_ATTACK_PERIOD = 3,
	    DRAGONFLY_ATTACK_PERIOD = 2.5,
		BEARGER_ATTACK_PERIOD = 3,
		CATCOON_ATTACK_PERIOD = 2,
֩Ů	    SPIDERQUEEN_ATTACKPERIOD = 3,
	    WARG_ATTACKPERIOD = 3,

    ޸ÿк֣޸ĶӦ˵Ĺ࣬ԽСԽ졣罫˹1ͽPIG_ATTACK_PERIOD = 3,滻ΪPIG_ATTACK_PERIOD = 1.5,ɡ罫𹥻ཱུ1ͽBAT_ATTACK_PERIOD = 1,滻ΪBAT_ATTACK_PERIOD = 2,




.֩볲3֩

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\spiderden.luaļ

    1.inst.components.lootdropper:SetLoot({ "silk","silk"})滻Ϊinst.components.lootdropper:SetLoot({ "silk","silk", "spidereggsack", "spidereggsack", "spidereggsack"})


    2.inst.components.lootdropper:SetLoot({ "silk","silk","silk","silk"})滻Ϊinst.components.lootdropper:SetLoot({ "silk","silk","silk","silk", "spidereggsack", "spidereggsack", "spidereggsack"})


    3.inst.components.lootdropper:SetLoot({ "silk","silk","silk","silk","silk","silk", "spidereggsack"})滻Ϊinst.components.lootdropper:SetLoot({ "silk","silk","silk","silk","silk","silk", "spidereggsack", "spidereggsack", "spidereggsack"})

    ۴ССֵ֩볲3֩ѣϷԭֻд֩볲1֩ѣ֩




.ָ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\evergreens.luaļif math.random() <= TUNING.LEIF_PERCENT_CHANCE then滻Ϊif math.random() <= TUNING.LEIF_PERCENT_CHANCE*100 then

    ָ100*100ΪҪı




.ȫ켰Ӵ徲ˣ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("penguinspawner")滻Ϊ--inst:AddComponent("penguinspawner")

    ɳȫ켰浵Ѿϰֶ첻




.治ʳ˻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("lureplantspawner")滻Ϊ--inst:AddComponent("lureplantspawner")

    õ治ʳ˻ص԰




.겻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("frograin")滻Ϊ--inst:AddComponent("frograin")

    ʱϲ




.겻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("flowerspawner")滻Ϊ--inst:AddComponent("flowerspawner")

    ʱϲ᲻ϳϷ




.𹷲Ż

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\hound.luaļinst.components.burnable:Ignite()滻Ϊ--inst.components.burnable:Ignite()

    ɴ𹷲Ż𣬴ƬׯҲ¸֮һ




һ.Ȯ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("hounded")滻Ϊ--inst:AddComponent("hounded")

    ɲȮʱıڣҪûȮ




.ľ˷

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\boards.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("mermhouse").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ľ˷Ҫ롰һͬ޸




.Ȯֺ

    ü±ϷĿ¼\data\scripts\prefabs\houndstooth.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("walrus_camp").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    Ȯֺ




.ѿյ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\walrus_camp.luaļinst:AddComponent("inspectable")һвMakeLargeBurnable(inst)

    յ




.ƬֺͰ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\thulecite_pieces.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("monkeybarrel").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ƬֺͰҪ롰Сɽһͬ޸




.ԴƤΧ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\tentaclespots.luaļinst:AddComponent("inspectable")һвݣ

function tentaclesfn(inst, reader)
    local pt = Vector3(reader.Transform:GetWorldPosition())
    local numtentacles = 9
    reader:StartThread(function()
        for k = 1, numtentacles do
            local theta = math.random() * 2 * PI
            local radius = math.random(9, 24)
            local result_offset = FindValidPositionByFan(theta, radius, 12, function(offset)
                local x,y,z = (pt + offset):Get()
                local ents = TheSim:FindEntities(x,y,z , 1)
                return not next(ents) 
            end)
            if result_offset then
                local tentacle = SpawnPrefab("tentacle")
                tentacle.Transform:SetPosition((pt + result_offset):Get())
                GetPlayer().components.playercontroller:ShakeCamera(reader, "FULL", 0.2, 0.02, .25, 40)
                local fx = SpawnPrefab("splash_ocean")
                local pos = pt + result_offset
                fx.Transform:SetPosition(pos.x, pos.y, pos.z)
                tentacle.sg:GoToState("attack_pre")
            end
            Sleep(.33)
        end
    end)
    return true
end
    inst:AddComponent("edible")
    inst.components.edible:SetOnEatenFn(tentaclesfn)

    ɳԴƤΧ9֣ⲻǵģΪ˲ô־֣ԲҪڻΧԴƤ




.÷Ұ

    ü±ϷĿ¼\data\scripts\prefabs\honey.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("beehive").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ÷Ұ




.÷ɱ˷

    ü±ϷĿ¼\data\scripts\prefabs\stinger.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("wasphive").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ÷ɱ˷ѣ¸ϿܰҪ롰˹Ůѡһͬ޸




.Ƥ

    ü±ϷĿ¼\data\scripts\prefabs\pigskin.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("pigtorch").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    Ƥ棬ǲͬһʱҪ롰һͬ޸




ģ.¹ָ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning_override.luaļݣ

										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", false)
										basehassler:OverrideAttackChance("DEERCLOPS", .33)
									elseif difficulty == "often" then
										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", false)
										basehassler:OverrideAttackChance("DEERCLOPS", 1.1)
									elseif difficulty == "always" then
										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", true)
										basehassler:OverrideAttackChance("DEERCLOPS", 1.1)

    滻Ϊ

										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", false)
										basehassler:OverrideAttackChance("DEERCLOPS", 1.1)
									elseif difficulty == "often" then
										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", false)
										basehassler:OverrideAttackChance("DEERCLOPS", 2.1)
									elseif difficulty == "always" then
										basehassler:OverrideAttacksPerSeason("DEERCLOPS", 1)
										basehassler:OverrideAttackDuringOffSeason("DEERCLOPS", true)
										basehassler:OverrideAttackChance("DEERCLOPS", 3.1)

    ¹ָ




һ.Ϸеһ1ʵ8޸Ϊ16ӣ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļlocal seg_time = 30滻Ϊlocal seg_time = 60

    ʹϷе1ʵ8ӳΪ16




Ķ.޸İ졢ҹռһı

    ü±ϷĿ¼\data\DLC0001\scripts\components\seasonmanager.luaļ

    1.＾14Сʱself.autumnsegs = {day=8,  dusk=6,  night=2}滻Ϊself.autumnsegs = {day=12,  dusk=2,  night=2}


    2.14Сʱself.wintersegs = {day=5,  dusk=5,  night=6}滻Ϊself.wintersegs = {day=12,  dusk=2,  night=2}


    3.14Сʱself.springsegs = {day=5,  dusk=8,  night=3}滻Ϊself.springsegs = {day=12,  dusk=2,  night=2}


    4.ļ14Сʱself.summersegs = {day=11, dusk=1,  night=4}滻Ϊself.summersegs = {day=12, dusk=2,  night=2}

    ɸҪеday죩duskҹnight֣СʱõҪʱ




.ů֮10ȣ25ȣ

    ü±ϷĿ¼\data\DLC0001\scripts\components\temperature.luaļݣ

	self.maxtemp = TUNING.MAX_ENTITY_TEMP
	self.mintemp = TUNING.MIN_ENTITY_TEMP

    滻Ϊ

	self.maxtemp = 25
	self.mintemp = 10

    ɽ趨Ϊ10ȣԭΪ20ȣ趨Ϊ25ȣԭΪ90ȣǲᶳ˻




.ļֲﲻȼ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļWILDFIRE_THRESHOLD = 80,滻ΪWILDFIRE_THRESHOLD = 800,

    ýֲļȼ




.ֲũﲻή

    1.ݲήü±ϷĿ¼\data\DLC0001\scripts\prefabs\grass.luaļinst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)滻Ϊ--inst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)


    2.粻ήü±ϷĿ¼\data\DLC0001\scripts\prefabs\sapling.luaļinst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)滻Ϊ--inst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)


    3.Բήü±ϷĿ¼\data\DLC0001\scripts\prefabs\berrybush.luaļinst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)滻Ϊ--inst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.pickable:MakeWitherable() end)


    4.ũﲻήü±ϷĿ¼\data\DLC0001\scripts\prefabs\plant_normal.luaļinst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.crop:MakeWitherable() end)滻Ϊ--inst.makewitherabletask = inst:DoTaskInTime(TUNING.WITHER_BUFFER_TIME, function(inst) inst.components.crop:MakeWitherable() end)

    ֲũ첻ή




.ֹͣη磨Ϸη٣

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("worldwind")滻Ϊ--inst:AddComponent("worldwind")

    ֹͣϷеĹη趨ôϷٿ٣ǹݽͣԭ




.粻

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playerlightningtarget")滻Ϊ--inst:AddComponent("playerlightningtarget")

    ǲ




İ.ͼߴ

    ü±ϷĿ¼\data\DLC0001\scripts\map\forest_map.luaļlocal min_size = 350滻Ϊlocal min_size = 800

    ڿ´浵ʱĬϵͼߴ磨WorldťµWorld sizeDefaultѡŴ2ϣ800ֿеעͼߴԽ󣬶ԼҪԽ




ľ.ϷԶ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("autosaver")滻Ϊ--inst:AddComponent("autosaver")

    ɲϷԶ




声.ֶ浵ϷаF5棩

    ü±ϷĿ¼\data\scripts\main.luaļTranslateStringTable( STRINGS )һвTheInput:AddKeyUpHandler(KEY_F5, function() SaveGameIndex:SaveCurrent() end )

    ϷаF5ֶ浵һ¾ͱ




һ.ٶϷаF6ٶȡ֮ǰ浵

    ü±ϷĿ¼\data\scripts\main.luaļTranslateStringTable( STRINGS )һвݣ

TheInput:AddKeyUpHandler(KEY_F6, function() StartNextInstance({reset_action=RESET_ACTION.LOAD_SLOT, save_slot = SaveGameIndex:GetCurrentSaveSlot()}, true) end )

    ϷʱF6ٶȡ֮ǰ浵Ҫһ̡F6ϷῨһ£ڶȡ




.Զɾ

    ü±ϷĿ¼\data\DLC0001\scripts\gamelogic.luaļݣ

	    local playtime = GetTimePlaying()
	    playtime = math.floor(playtime*1000)
	    SetTimingStat("time", "scenario", playtime)
	    SendTrackingStats()
	    local days_survived, start_xp, reward_xp, new_xp, capped = CalculatePlayerRewards(wilson)
	    
	    ProfileStatsSet("xp_gain", reward_xp)
	    ProfileStatsSet("xp_total", new_xp)
	    SubmitCompletedLevel() --close off the instance

	    wilson.components.health.invincible = true

	    wilson.profile:Save(function()
		    SaveGameIndex:EraseCurrent(function() 
				    scheduler:ExecuteInTime(3, function() 
						TheFrontEnd:PushScreen(DeathScreen(days_survived, start_xp, nil, capped))
					end)
		    	end)
		    end)

    滻Ϊ

       StartNextInstance({reset_action=RESET_ACTION.LOAD_SLOT, save_slot = SaveGameIndex:GetCurrentSaveSlot()}, true)

    ԶϷῨһҪڶ




.ɫƷÿνϷƷͼʲͬɫ

    ü±ϷĿ¼\data\scripts\widgets\inventorybar.luaļself.bg = self.root:AddChild(Image(HUD_ATLAS, "inventory_bg.tex"))һвݣ

local colours=
{
    {255/255,0/255,0/255},
    {0/255,255/255,0/255},
    {255/255,255/255,255/255},
    {79/255,153/255,68/255},
    {35/255,105/255,235/255},
    {109/255,50/255,163/255},
}
    local bgcolour = math.random(#colours)
    self.bg:SetTint(colours[bgcolour][1],colours[bgcolour][2],colours[bgcolour][3],1)

    ÿνϷʱƷͼֲͬɫŲͬϷ




.ĻEnterȱʶ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_ENTER, function() GetPlayer().HUD:Toggle() end )

    ɰEnterƷбʶҰͶ뼢ĵ磬ٴΰEnterʾʶ




.صͼͼ꣨Mصͼͼٰ꣬Mָ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("resurrectable")һвݣ

TheInput:AddKeyUpHandler(KEY_M, function()
    if not inst:HasTag("nomap") then
       inst:AddTag("nomap")
       inst.HUD.controls.mapcontrols.minimapBtn:Hide()
       inst.HUD.controls.mapcontrols.rotleft:Hide()
       inst.HUD.controls.mapcontrols.rotright:Hide()
    else
       inst:RemoveTag("nomap")
       inst.HUD.controls.mapcontrols.minimapBtn:Show()
       inst.HUD.controls.mapcontrols.rotleft:Show()
       inst.HUD.controls.mapcontrols.rotright:Show()
    end
end )

    ɰMصͼҷͼ꣬ڵߣٰMָ




.ͼʾ̽򣨰Ctrl+2رյͼʾٰһν

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("resurrectable")һвݣ

TheInput:AddKeyUpHandler(KEY_2, function()
    if TheInput:IsKeyDown(KEY_CTRL) then
       local map = TheSim:FindFirstEntityWithTag("minimap")
       if not inst:HasTag("mapoff") then
          inst:AddTag("mapoff")
          map.MiniMap:ClearRevealedAreas(true)
       else
          inst:RemoveTag("mapoff")
          map.MiniMap:ClearRevealedAreas(false)
       end
    end
end )

    ɰCtrl+2СͼȫڣҲʾ̽̽յѶȡٴΰCtrl+2ɽСͼʾ̽




.߿򣨰P߿ǿܵλã

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playercontroller")һвݣ

TheInput:AddKeyUpHandler(KEY_P, function() if not TheCamera.cutscene == false then TheCamera:CutsceneMode(false) else TheCamera:CutsceneMode(true) end end )

    ɰP߿ǿܵλã⣬գͼʱиõĹͼٴΰP߿




.ðӽǣF7л30ӽǣٰһηأ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("playeractionpicker")һвݣ

TheInput:AddKeyUpHandler(KEY_F7, function()
    if not inst:HasTag("goodangle") then
       inst:AddTag("goodangle")
       TheCamera.maxdistpitch = 30
    else
       inst:RemoveTag("goodangle")
       if not GetWorld():IsCave() then
          TheCamera.maxdistpitch = 60
       else
          TheCamera.maxdistpitch = 40
       end
    end
end )

    ϷаF7ϷӽлΪ30ðӽǣҰԶٴΰF7ԭӽ




.޸ϷModsťModsťס⣩

    ü±ϷĿ¼\data\DLC0001\scripts\screens\modsscreen.luaļ

    1.self.modlinkbutton:SetOnClick( function() self:MoreMods() end )һвself.cb(true)


    2.ݣ

function ModsScreen:StartWorkshopUpdate()
	if TheSim:UpdateWorkshopMods( function() self:WorkshopUpdateComplete() end ) then
		self.updatetask = scheduler:ExecutePeriodic(0, self.ShowWorkshopStatus, nil, 0, self )
	else
		self:WorkshopUpdateComplete()
	end
end

    滻Ϊ

function ModsScreen:StartWorkshopUpdate()
		self:WorkshopUpdateComplete()
end

    ˵ModsťֱʾmodϢûаװmod򲻻modģʽ




.ˢѨʯשֶѨڣòӿڵѨڣ

    1.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cutstone.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("cave_entrance").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cave_entrance.luaļinst:RemoveComponent("workable")滻Ϊݣ

local function dig_up(inst, chopper)
    inst:Remove()
end
    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.DIG)
    inst.components.workable:SetOnFinishCallback(dig_up)
    inst.components.workable:SetWorkLeft(1)

    ˢѨڵʯשֶѨڽµѨ㣬ڶѨʯשֶѨڽµԶŲ㣬עⲻҪԶŲֶѨˡҪöѨʱòӽڲ




һ.Ѩ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\cave.luaļinst:AddComponent("quaker")滻Ϊ--inst:AddComponent("quaker")

    öѨ




.Ҳ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\forest.luaļinst:AddComponent("hunter")һвinst:AddComponent("quaker")

    õҲ




.Ʒˤ

    ü±ϷĿ¼\data\DLC0001\scripts\components\quaker.luaļinst:Remove()滻Ϊ--inst:Remove()

    õʯͷƽƷˤ




.ڷˢ

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\mound.luaļݣ

    inst.AnimState:PlayAnimation("dug")
    inst:RemoveComponent("workable")

    滻Ϊ

    --inst.AnimState:PlayAnimation("dug")
    inst.components.workable:SetWorkLeft(1)

    ڷˢ




.ҵͻתͻڵͼʾ

    ü±ϷĿ¼\data\scripts\prefabs\teleportato_parts.luaļinst:AddComponent("inspectable")һвݣ

    local minimap = inst.entity:AddMiniMapEntity()
    minimap:SetIcon( "teleportato.png" )

    ڵͼϿͻλãʾΪͻͼ




.ɱСﲻܳͷС͵˹֣

    ü±ϷĿ¼\data\DLC0001\scripts\prefabs\player_common.luaļinst:AddComponent("kramped")滻Ϊ--inst:AddComponent("kramped")

    ɱСﲻС͵˹




.壨1ľͷ1ƽ壩

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļݣ

Recipe("bell", {Ingredient("glommerwings", 1), Ingredient("glommerflower", 1)}, RECIPETABS.MAGIC,  TECH.LOST)

    滻Ϊ

Recipe("bell", {Ingredient("log", 1), Ingredient("goldnugget", 1)}, RECIPETABS.MAGIC, TECH.NONE)

    ɲͼֽܽٻ˵壬ֻ1ľͷ1ƽ




.ӳȼȼʱ

    ü±ϷĿ¼\data\DLC0001\scripts\tuning.luaļݣ
	    TINY_FUEL = seg_time*.25,
	    SMALL_FUEL = seg_time * .5,
	    MED_FUEL = seg_time * 1.5,
	    MED_LARGE_FUEL = seg_time * 3,
	    LARGE_FUEL = seg_time * 6,

    滻Ϊ

	    TINY_FUEL = seg_time*1.25,
	    SMALL_FUEL = seg_time * 2.5,
	    MED_FUEL = seg_time * 7.5,
	    MED_LARGE_FUEL = seg_time * 12,
	    LARGE_FUEL = total_day_time*1,

    Ϸseg_timeСʱҪ16ĳһtotal_day_time*1,ĸʽ




.ʹܶѵƷɶѵ

    ϷĿ¼\data\DLC0001\scripts\prefabsļУе.luaļΪϷеƷţǿɶѵü±ϷĿ¼\data\scripts\prefabs\horn.luaļinst:AddComponent("inspectable")һвݣ

    inst:AddComponent("stackable")
    inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM

    ʵֲܶѵƷɶѵ




ߣ.ʹȼƷȼϣջٲõĵߣ

    ϷĿ¼\data\DLC0001\scripts\prefabsļУе.luaļΪϷеƷͨȼϱջ٣ü±ϷĿ¼\data\DLC0001\scripts\prefabs\backpack.luainst:AddComponent("inspectable")һвݣ

    inst:AddComponent("fuel")
    inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL

    òȼƷڻȼϣջٲõĵ




һ.Ʒ

    ϷĿ¼\data\DLC0001\scripts\prefabsļУƷϷĿ¼\data\DLC0001\scripts\prefabsļ£е.luaļΪϷеƷü±򿪻ḯƷļаperishableǰ--øƷעⲻҪ©Ϸ

    ޸üü±ϷĿ¼\data\DLC0001\scripts\prefabs\egg.luaļβݣ

        inst:AddComponent("perishable")
        inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
        inst.components.perishable:StartPerishing()
        inst.components.perishable.onperishreplacement = "rottenegg"
    inst.components.perishable:SetPerishTime(TUNING.PERISH_MED)
    inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
    inst.components.perishable.onperishreplacement = "spoiled_food"   
 
    ÿǰ--󣬱Ϊݣ

        --inst:AddComponent("perishable")
        --inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
        --inst.components.perishable:StartPerishing()
        --inst.components.perishable.onperishreplacement = "rottenegg"
    --inst.components.perishable:SetPerishTime(TUNING.PERISH_MED)
    --inst.components.perishable:SetPerishTime(TUNING.PERISH_FAST)
    --inst.components.perishable.onperishreplacement = "spoiled_food"   

    üΪֻḯƷļ

    butter.lua	
    butterflywings.lua	
    egg.lua	
    froglegs.lua	
    hambat.lua	ȶ̹
    honey.lua	
    mushrooms.lua	Ģ
    petals.lua	
    petals_evil.lua	جλ
    seeds.lua	
    fish.lua	
    veggies.lua	߲
    meats.lua	
    lightbulb	ӫ




߶.ƷƷ

    ϷĿ¼\data\DLC0001\scripts\prefabsļУе.luaļΪϷеƷľͷü±ϷĿ¼\data\DLC0001\scripts\prefabs\log.luaļinst:AddComponent("inspectable")һвݣ

local function OnDeploy (inst, pt)
    SpawnPrefab("leif").Transform:SetPosition(pt.x, pt.y, pt.z)
    inst.components.stackable:Get():Remove()
end
    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    ľͷleif滻ΪƷľͷƷƷƼƷӢơƷƷǲɶѵģţǵȣͽinst.components.stackable:Get():Remove()滻Ϊinst:Remove()




.޸ǿЯƷЯ3ȣ

    1.ѷü±ϷĿ¼\data\DLC0001\scripts\prefabs\wilson.luaļreturn MakePlayerCharacter("wilson", prefabs, assets, fn)滻Ϊreturn MakePlayerCharacter("wilson", prefabs, assets, fn, {"baconeggs", "baconeggs", "baconeggs",})


    2.˹ü±ϷĿ¼\data\DLC0001\scripts\prefabs\waxwell.luaļ"waxwelljournal",һвݣ

	"baconeggs",
	"baconeggs",
	"baconeggs",


    3.µ٣ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wendy.luaļ"abigail_flower",һвݣ

	"baconeggs",
	"baconeggs",
	"baconeggs",


    4.ϣü±ϷĿ¼\data\DLC0001\scripts\prefabs\woodie.luaļ"lucy",һвݣ

	"baconeggs",
	"baconeggs",
	"baconeggs",


    5.Τ˹ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wes.luaļ"balloons_empty",һвݣ

	"baconeggs",
	"baconeggs",
	"baconeggs",


    6.ͼԱü±ϷĿ¼\data\DLC0001\scripts\prefabs\wickerbottom.luaļreturn MakePlayerCharacter("wickerbottom", nil, assets, fn, {"papyrus", "papyrus"})滻Ϊreturn MakePlayerCharacter("wickerbottom", nil, assets, fn, {"papyrus", "papyrus", "baconeggs", "baconeggs","baconeggs",})


    7.ޱ壺ü±ϷĿ¼\data\DLC0001\scripts\prefabs\willow.luaļݣ

local start_inv = 
{
	"lighter",
}

    滻Ϊ

local start_inv = 
{
	"lighter",
	"baconeggs",
	"baconeggs",
	"baconeggs",
}


    8.ֶԣü±ϷĿ¼\data\DLC0001\scripts\prefabs\wolfgang.luaļreturn MakePlayerCharacter("wolfgang", nil, assets, fn)滻Ϊreturn MakePlayerCharacter("wolfgang", nil, assets, fn, {"baconeggs", "baconeggs", "baconeggs",})


    9.wx78ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wx78.luaļreturn MakePlayerCharacter("wx78", prefabs, assets, fn)滻Ϊreturn MakePlayerCharacter("wx78", prefabs, assets, fn, {"baconeggs", "baconeggs", "baconeggs",})


    10.˿˹ü±ϷĿ¼\data\DLC0001\scripts\prefabs\wathgrithr.luaļݣ

local start_inv = 
{
	"spear_wathgrithr",	
	"wathgrithrhat",
	"meat",
	"meat",
	"meat",
	"meat",
}

    滻Ϊ

local start_inv = 
{
	"spear_wathgrithr",	
	"wathgrithrhat",
	"meat",
	"meat",
	"meat",
	"meat",
	"baconeggs",
	"baconeggs",
	"baconeggs",
}


    11.Τü±ϷĿ¼\data\DLC0001\scripts\prefabs\webber.luaļݣ

local start_inv = 
{
	"spidereggsack",
	"monstermeat",
	"monstermeat",
}

    滻Ϊ

local start_inv = 
{
	"spidereggsack",
	"monstermeat",
	"monstermeat",
	"baconeggs",
	"baconeggs",
	"baconeggs",
}

    ޸ǿЯƷԭЯרƷϵĸӵȣ䡣Я4ȣ滻4"baconeggs",ɡԽbaconeggsȣΪҪƷƼ޸ļһƷӢơ




.޸ߵ䷽

    ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļӪcampfire䷽Ϊ

Recipe("campfire", {Ingredient("cutgrass", 3),Ingredient("log", 2)}, RECIPETABS.LIGHT, TECH.NONE, "campfire_placer")

䷽("Ӫ", {ɷ("", 3),ɷ("ľͷ", 2)}, ѡ., Ƽ.0, "Ӫ")

Recipe䷽campfireӪΪIngredientɷ֣cutgrassݣ3ֱߵĲϺһIngredientɷ֣logľͷ2Ҳǡֻ뽫滻ɾı޸ߵ䷽


    1òϣ䷽ɫ1˿8ţë2Ϊ5ݡü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļݣ

Recipe("trunkvest_winter", {Ingredient("trunk_winter", 1),Ingredient("silk", 8), Ingredient("beefalowool", 2)}, RECIPETABS.DRESS,  TECH.SCIENCE_TWO)

    滻Ϊ

Recipe("trunkvest_winter", {Ingredient("cutgrass", 5)}, RECIPETABS.DRESS,  TECH.SCIENCE_TWO)

    Ϸн5


    2Ʒ1ƽݡü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("purplegem", {Ingredient("redgem",1), Ingredient("bluegem", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO)һвݣ

Recipe("mandrake", {Ingredient("goldnugget", 1)}, RECIPETABS.REFINE,  TECH.SCIENCE_ONE)

    ھĿ£1ƽ


    3һƷ1100ľ̿ü±ϷĿ¼\data\DLC0001\scripts\recipes.luaļRecipe("purplegem", {Ingredient("redgem",1), Ingredient("bluegem", 1)}, RECIPETABS.REFINE, TECH.MAGIC_TWO)һвݣ

Recipe("charcoal", {Ingredient("cutgrass", 1)}, RECIPETABS.REFINE,  TECH.NONE,nil,nil,nil,100)

    ھĿ£1100ľ̿


    עȫ䷽

--LIGHT
campfireӪ𣩣cutgrassݣ3logľ2
firepitʯͷӪ𣩣logľ2rocksʯ12
torch棩cutgrassݣ2twigs֦2
coldfire𣩣cutgrassݣ3nitreʯ2
coldfirepitʯͷ𣩣nitreʯ2cutstoneʯש5transistorܣ2
minerhatñstrawhatñ1goldnuggetƽ1firefliesө棩1
molehatñmole2transistorܣ2wormlightӹ1
pumpkin_lanternϹϵƣpumpkinϹϣ1firefliesө棩1
lanternƣtwigs֦3ropeӣ2lightbulbӫ2


--STRUCTURES죩
treasurechestľ䣩boardsľ壩3
homesignƣboardsľ壩1
wall_hay_itemɲǽcutgrassݣ4twigs֦2
wall_wood_itemľǽboardsľ壩2ropeӣ1
wall_stone_itemʯǽcutstoneʯש2
pighouse˷boardsľ壩4cutstoneʯש3pigskinƤ4
rabbithouseӷboardsľ壩4carrotܲ10manrabbit_tailβͣ4
birdcagepapyrusֽ2goldnuggetƽ6seedsӣ2
turf_roadʯ·turf_rockyʯƤ1boardsľ壩1
turf_woodfloorľذ壩boardsľ壩1
turf_checkerfloor̵ذ壩marbleʯ1
turf_carpetfloor̺ذ壩boardsľ壩1beefalowoolţë1
pottedfernֲfoliageҶӣ5slurtle_shellpiecesţƬ1
dragonflychestӣdragon_scalesƬ1boardsľ壩4goldnuggetƽ10


--FARMֲ
slow_farmplotһũcutgrassݣ8poop㣩4logľ4
fast_farmplot߼ũcutgrassݣ10poop㣩6rocksʯ4
fertilizerʣpoop㣩3boneshardӲͷ2logľ4
beebox䣩boardsľ壩2honeycomb䳲1bee۷䣩4
meatrackܣtwigs֦3charcoalľ̿2ropeӣ3
cookpotcutstoneʯש3charcoalľ̿6twigs֦6
icebox䣩goldnuggetƽ2gears֣1cutstoneʯש1


--SURVIVAL棩
trap壩twigs֦2cutgrassݣ6
birdtrap壩twigs֦3silk˿4
bugnettwigs֦4silk˿2ropeӣ1
fishingrodͣtwigs֦2silk˿2
grass_umbrellaɡtwigs֦4cutgrassݣ3petals꣩6
umbrellaɡtwigs֦6),pigskinƤ1silk˿2
bandage۱papyrusֽ1honeyۣ2
healingsalveҩࣩashң2rocksʯ1spidergland֩壩1
compassָ룩goldnuggetƽ1papyrusֽ1
heatrockʯrocksʯ10pickaxe䣩1flintʯ3
backpackcutgrassݣ4twigs֦4
piggybackƤpigskinƤ4silk˿6ropeӣ2
bedroll_strawϯcutgrassݣ6ropeӣ1
bedroll_furryëƤ̸ǣbedroll_strawϯ1manrabbit_tailβͣ2
tent񣩣silk˿6twigs֦4ropeӣ3
siestahut˯Сݣsilk˿2boardsľ壩4ropeӣ3
featherfanëȣgoose_feather¹Ѽë5cutreeds«έ5ropeӣ2
icepackbearger_furƤ1gears֣3transistorܣ3


--TOOLSߣ
axeͷtwigs֦1flintʯ1
goldenaxeƽͷtwigs֦4goldnuggetƽ2
pickaxe䣩twigs֦2flintʯ2
goldenpickaxeƽ䣩twigs֦4goldnuggetƽ2
shovelӣtwigs֦2flintʯ2
goldenshovelƽӣtwigs֦4goldnuggetƽ2
hammerӣtwigs֦3rocksʯ3cutgrassݣ6
pitchforkݲ棩twigs֦2flintʯ2
razor굶twigs֦2flintʯ2


--SCIENCEѧ
researchlabѧgoldnuggetƽ1logľ4rocksʯ4
researchlab2棩boardsľ壩4cutstoneʯש2transistorܣ2
transistorܣgoldnuggetƽ2cutstoneʯש2
diviningrod̽ȣtwigs֦1nightmarefuelجȼϣ4gears֣1
winterometer¶ȼƣboardsľ壩2goldnuggetƽ2
rainometerƣboardsľ壩2goldnuggetƽ2ropeӣ2
gunpowderҩrotteneggü1charcoalľ̿1nitreʯ1
lightning_rod룩goldnuggetƽ4cutstoneʯש1
firesuppressorgears֣2ice15transistorܣ2


--MAGICħ
researchlab4ӷֽrabbitӣ4boardsľ壩4tophatñ1
researchlab3Ӱߣlivinglogľͷ3purplegemϱʯ1nightmarefuelجȼϣ7
resurrectionstatue񣩣boardsľ壩4cookedmeat⣩4beardhair룩4
panflutecutreeds«έ5mandrakeݣ1ropeӣ1
bell壩glommerwingsų1glommerflowerŻ1
onemanbandgoldnuggetƽ2nightmarefuelجȼϣ4pigskinƤ2
nightlightӰƣgoldnuggetƽ8nightmarefuelجȼϣ2redgem챦ʯ1
armor_sanityҹħףnightmarefuelجȼϣ5papyrusֽ3
nightswordҹnightmarefuelجȼϣ5livinglogľͷ1
batbatbatwing5livinglogľͷ2purplegemϱʯ1
armorslurperslurper_peltʳƤ6ropeӣ2nightmarefuelجȼϣ2
amuletɫgoldnuggetƽ3nightmarefuelجȼϣ2redgem챦ʯ1
blueamuletɫgoldnuggetƽ3bluegemʯ1
purpleamuletɫgoldnuggetƽ6nightmarefuelجȼϣ4purplegemϱʯ2
firestaffħȣnightmarefuelجȼϣ2spearì1redgem챦ʯ1
icestaffħȣspearì1bluegemʯ1
telestaffħȣnightmarefuelجȼϣ4livinglogľͷ2purplegemϱʯ2
telebaseͺģnightmarefuelجȼϣ4livinglogľͷ4goldnuggetƽ8


--REFINE
ropeӣcutgrassݣ3
boardsľ壩logľ4
cutstoneʯשrocksʯ3
papyrusֽcutreeds«έ4
transistorܣgoldnuggetƽ2cutstoneʯש1
nightmarefuelجȼϣpetals_evilجλ꣩4
purplegemϱʯredgem챦ʯ1bluegemʯ1


--WARս
spearìtwigs֦2ropeӣ1flintʯ1
hambatȶ̹pigskinƤ1twigs֦2meat⣩2
nightstickҹlightninggoathornǣ1transistorܣ2
armorgrassݿףcutgrassݣ10twigs֦2
armorwoodľףlogľ8ropeӣ2
armormarbleʯףmarbleʯ12ropeӣ4
footballhatƤñpigskinƤ1ropeӣ1
blowdart_sleepcutreeds«έ2stingeṛ1feather_crowѻë1
blowdart_fireȼմcutreeds«έ2charcoalľ̿1feather_robinȸë1
blowdart_pipecutreeds«έ2houndstoothȮ1feather_robin_winterѩȸë1
boomerangڣboardsľ壩1silk˿1charcoalľ̿1
beemine۷ףboardsľ壩1bee۷䣩4flintʯ1
trap_teeth壩logľ1ropeӣ1houndstoothȮ1
armordragonflyѿףdragon_scalesƬ1armorwoodľף1pigskinƤ3
staff_tornadoħȣgoose_feather¹Ѽë10lightninggoathornǣ1gears֣1


--DRESSUP
sewing_kit߰logľ1silk˿8houndstoothȮ2
flowerhatpetals꣩12
strawhatñcutgrassݣ12
tophatñsilk˿6
rainhatñmole2strawhatñ1boneshardӲͷ1
earmuffshatö֣rabbitӣ2twigs֦1
beefalohatţëñbeefalowoolţë8hornҰţǣ1
winterhatñbeefalowoolţë4silk˿4
catcoonhatñcoontailβͣ4silk˿4
watermelonhatñwatermelonϣ1twigs֦3
icehatñtransistorܣ2ropeӣ4ice10
beehatñsilk˿8ropeӣ1
featherhatëñfeather_crowѻë3feather_robinȸë2tentaclespotsƤ2
bushhatñstrawhatñ1ropeӣ1dug_berrybushľԣ1
raincoat£tentaclespotsƤ2ropeӣ2boneshardӲͷ2
sweatervestСɱģhoundstoothȮ8silk˿6
trunkvest_summerձģtrunk_summerɫǣ1silk˿8
trunkvest_winterģtrunk_winterɫǣ1silk˿8beefalowoolţë2
reflectivevest䱳ģropeӣ1feather_robinȸë4pigskinƤ2
hawaiianshirtĳpapyrusֽ3silk˿3cactus_flowerƻ5
caneȣgoldnuggetƽ2walrus_tusk1twigs֦4
beargervestܱģbearger_furƤ1sweatervestСɱģ1ropeӣ2
eyebrellahat۾ñdeerclops_eyeball¹1twigs֦15boneshardӲͷ4


----ANCIENT----Զţ
thuleciteʯthulecite_piecesƬ6
wall_ruins_itemǽthuleciteʯ1
nightmare_timepiece£thuleciteʯ2nightmarefuelجȼϣ2
orangeamuletɫthuleciteʯ2nightmarefuelجȼϣ3orangegemɫʯ1
yellowamuletɫthuleciteʯ2nightmarefuelجȼϣ3yellowgemɫʯ1
greenamuletɫthuleciteʯ2nightmarefuelجȼϣ3greengemɫʯ1
orangestaffɫħȣnightmarefuelجȼϣ2caneȣ1orangegemɫʯ2
yellowstaffɫħȣnightmarefuelجȼϣ4livinglogľͷ2yellowgemƱʯ2
greenstaffɫħȣnightmarefuelجȼϣ4livinglogľͷ2greengemɫʯ2
multitool_axe_pickaxe๦ܹߣgoldenaxeƽͷ1goldenpickaxeƽ䣩1thuleciteʯ2

ruinshatԶڣthuleciteʯ4nightmarefuelجȼϣ4
armorruinsԶſףthuleciteʯ6nightmarefuelجȼϣ4
ruins_batԶŶ̰livinglogľͷ3thuleciteʯ4nightmarefuelجȼϣ4
eyeturret_item۾deerclops_eyeball¹1minotaurhornԶػ߽ǣ1thuleciteʯ5




.޸ʳףȫȷʳף

    ü±ϷĿ¼\data\DLC0001\scripts\preparedfoods.luaļɱbutterflymuffinʳΪ

ɱ		butterflymuffin =
			{
ʳ		test = function(cooker, names, tags) return names.butterflywings and not tags.meat and tags.veggie end,
˳		priority = 1,
			weight = 1,
ʳ		foodtype = "VEGGIE",
Ѫ			health = TUNING.HEALING_MED,
		hunger = TUNING.CALORIES_LARGE,
ʱ		perishtime = TUNING.PERISH_SLOW,
ֵ			sanity = TUNING.SANITY_TINY,
ʱ		cooktime = 2,
			},

    У

    ʳģnames.butterflywings򣩡not tags.meat⣩tags.veggie߲ˣ

    ʳͣ"VEGGIE",߲ˣ޸ĵѡΪ"MEAT",⣩

    ѪTUNING.HEALING_MED,20Ѫ޸ĵѡΪTUNING.HEALING_TINY,1ѪTUNING.HEALING_SMALL,3ѪTUNING.HEALING_MEDSMALL,8ѪTUNING.HEALING_MEDLARGE,30ѪTUNING.HEALING_LARGE,40ѪTUNING.HEALING_HUGE,60ѪTUNING.HEALING_SUPERHUGE,100Ѫ

    TUNING.CALORIES_LARGE,37.5㼢޸ĵѡΪTUNING.CALORIES_TINY,9.375㼢TUNING.CALORIES_SMALL,12.5㼢TUNING.CALORIES_MEDSMALL,18.75㼢TUNING.CALORIES_MED,25㼢TUNING.CALORIES_HUGE,75㼢TUNING.CALORIES_SUPERHUGE,150㼢

    ʱ䣺TUNING.PERISH_SLOW,15죩޸ĵѡΪTUNING.PERISH_ONE_DAY,1죩TUNING.PERISH_TWO_DAY,2죩TUNING.PERISH_SUPERFAST,3죩TUNING.PERISH_FAST,6죩TUNING.PERISH_MED,10죩TUNING.PERISH_PRESERVED,20죩TUNING.PERISH_SUPERSLOW,40죩

    ֵTUNING.SANITY_TINY,5ԣ޸ĵѡΪTUNING.SANITY_SUPERTINY,1ԣTUNING.SANITY_SMALL,10ԣTUNING.SANITY_MED,15ԣTUNING.SANITY_MEDLARGE,20ԣTUNING.SANITY_LARGE,33ԣTUNING.SANITY_HUGE,50ԣ

    ʱ䣺2,2Сʱе޸Ϊ.1,0.1Сʱ



    1ʳģʳף1ݣΪ4֦ü±ϷĿ¼\data\DLC0001\scripts\preparedfoods.luaļtest = function(cooker, names, tags) return names.mandrake end,滻Ϊtest = function(cooker, names, tags) return names.twigs >= 4 end,

    Ϸн4֦



    2Ʒ֣4ɫǣtrunk_winterü±ϷĿ¼\data\DLC0001\scripts\preparedfoods.luaļݣ

		cooktime = .25,
	},

    һвݣ

	trunk_winter =
	{
		test = function(cooker, names, tags)  return names.berries >= 4 end,
		priority = 1,
		foodtype = "MEAT",
		health = TUNING.HEALING_SUPERHUGE,
		hunger = TUNING.CALORIES_SUPERHUGE,
		perishtime = TUNING.PERISH_SUPERSLOW,
		sanity = TUNING.SANITY_HUGE,
		cooktime = .1,
	},

    4ɫǣѪ100㡢150㡢ʱ40졢50ԡʱ0.1СʱʾǵĿչչóɫǡעⲻҪʳáḯõƷΪƽȣıԡʹڱʱ䡣ΪʳƼ޸ļһƷӢơ



    עȫȷʳ

butterflymuffinɱ
    ʳģnames.butterflywings򣩡not tags.meat⣩tags.veggie߲ˣ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

frogglebunwichԲΣ
    ʳģnames.froglegs or names.froglegs_cookedȣtags.veggie߲ˣ
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,8Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

taffy̫ǣ
    ʳģtags.sweetener and tags.sweetener >= 3ۻ䳲ڵ3not tags.meat⣩
    ʳͣ"VEGGIE",߲ˣ
    Ѫ-TUNING.HEALING_SMALL,-3Ѫ
    TUNING.CALORIES_SMALL*2,25㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_MED,15ԣ
    ʱ䣺2,2Сʱ

pumpkincookieϹϱ
    ʳģnames.pumpkin or names.pumpkin_cookedϹϣtags.sweetener and tags.sweetener >= 2ۻ䳲ڵ2
    ʳͣ"VEGGIE",߲ˣ
    Ѫ0,0Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵTUNING.SANITY_MED,15ԣ
    ʱ䣺2,2Сʱ

stuffedeggplantѺУ
    ʳģnames.eggplant or names.eggplant_cookedӣtags.veggie and tags.veggie > 1߲˴1
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_BRIEF,5룩
    ʱ䣺2,2Сʱ

fishsticks
    ʳģtags.fish㣩names.twigs and (tags.inedible and tags.inedible <= 1)֦֦Сڵ1
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_LARGE,40Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

honeynuggets۽ש
    ʳģnames.honeyۣtags.meat and tags.meat <= 1.5Сڵ1.51⡢1С⣩not tags.inedible֦
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

honeyham֭ȣ
    ʳģnames.honeyۣtags.meat and tags.meat > 1.51.51⡢1С⣩not tags.inedible֦
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MEDLARGE,30Ѫ
    TUNING.CALORIES_HUGE,75㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_AVERAGE,10룩
    ʱ䣺2,2Сʱ

dragonpieڱ
    ʳģnames.dragonfruit or names.dragonfruit_cookednot tags.meat⣩
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_LARGE,40Ѫ
    TUNING.CALORIES_HUGE,75㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_AVERAGE,10룩
    ʱ䣺2,2Сʱ

kabobs⴮
    ʳģtags.meat⣩names.twigs֦not tags.monster or tags.monster <= 1ûзСڵ1tags.inedible and tags.inedible <= 1֦Сڵ1
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

mandrakesoup
    ʳģnames.mandrakeݣ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_SUPERHUGE,100Ѫ
    TUNING.CALORIES_SUPERHUGE,150㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺3,3Сʱ

baconeggsȣ
    ʳģtags.egg and tags.egg > 11tags.meat and tags.meat > 111⣩not tags.veggie߲ˣ
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_HUGE,75㼢
    ʱ䣺TUNING.PERISH_PRESERVED,20죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺2,2Сʱ

meatballs裩
    ʳģtags.meat⣩not tags.inedible֦
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_SMALL*5,62.5㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.75,0.75Сʱ

bonestew
    ʳģtags.meat and tags.meat >= 3ڵ33⣩not tags.inedible֦
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_SMALL*4,12Ѫ
    TUNING.CALORIES_LARGE*4,150㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_LONG,15룩
    ʱ䣺.75,0.75Сʱ

perogiesԲСֱ
    ʳģtags.eggtags.meat⣩tags.veggie߲ˣnot tags.inedible֦
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_LARGE,40Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_PRESERVED,20죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺1,1Сʱ

turkeydinnerͣ
    ʳģnames.drumstick and names.drumstick > 1ȴ1tags.meat and tags.meat > 111⣩tags.veggie or tags.fruit߲˻ˮ
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_HUGE,75㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_AVERAGE,10룩
    ʱ䣺3,3Сʱ

ratatouilleŵˣ
    ʳģnot tags.meat⣩tags.veggie߲ˣnot tags.inedible֦
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_MED,25㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺1,1Сʱ

jammypreserves۽
    ʳģtags.fruitˮnot tags.meat⣩not tags.veggie߲ˣnot tags.inedible֦
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_SMALL*3,37.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

fruitmedleyˮƴ̣
    ʳģtags.fruit and tags.fruit >= 3ˮڵ3not tags.meat⣩not tags.veggie߲ˣ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_MED,25㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ¶ȣTUNING.COLD_FOOD_BONUS_TEMP,-40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_BRIEF,5룩
    ʱ䣺.5,0.5Сʱ

fishtacosױը㣩
    ʳģtags.fish㣩names.corn or names.corn_cookedף
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

waffles
    ʳģnames.butterͣnames.berries or names.berries_cooked콬tags.egg
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_HUGE,60Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

monsterlasagnaǧ
    ʳģtags.monster and tags.monster >= 2ڵ2not tags.inedible֦
    ʳͣ"MEAT",⣩
    Ѫ-TUNING.HEALING_MED,-20Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵ-TUNING.SANITY_MEDLARGE,-20ԣ
    ʱ䣺.5,0.5Сʱ

powcake֥ʿ⣩
    ʳģnames.twigs֦names.honeyۣnames.corn or names.corn_cookedף
    ʳͣ"VEGGIE",߲ˣ
    Ѫ-TUNING.HEALING_SMALL,-3Ѫ
    0,0㼢
    ʱ䣺9000000,9000000죩
    ֵ0,0ԣ
    ʱ䣺.5,0.5Сʱ

unagi
    ʳģnames.cutlichen̦޺names.eel or names.eel_cooked㣩
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_MEDSMALL,18.75㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

wetgoopʪ役
    ʳģtrueзʳ׵ϣ
    ʳͣ
    Ѫ0,0Ѫ
    0,0㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵ0,0ԣ
    ʱ䣺.25,0.25Сʱ

flowersaladɳ
    ʳģnames.cactusflowerƻtags.veggie and tags.veggie >= 2߲˴ڵ2not tags.meat⣩not tags.inedible֦not tags.eggŵnot tags.sweetenerŷۻ䳲not tags.fruitˮ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_LARGE,40Ѫ
    TUNING.CALORIES_SMALL,12.5㼢
    ʱ䣺TUNING.PERISH_FAST,6죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

icecreamܣ
    ʳģtags.frozentags.dairyƷtags.sweetenerۻ䳲not tags.meat⣩not tags.veggie߲ˣnot tags.inedible֦not tags.eggŵ
    ʳͣ"VEGGIE",߲ˣ
    Ѫ0,0Ѫ
    TUNING.CALORIES_MEDSMALL,18.75㼢
    ʱ䣺TUNING.PERISH_SUPERFAST,3죩
    ֵTUNING.SANITY_LARGE,33ԣ
    ¶ȣTUNING.COLD_FOOD_BONUS_TEMP,-40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_LONG,15룩
    ʱ䣺.5,0.5Сʱ

watermelonicleϱ
    ʳģnames.watermelonϣtags.frozennames.twigs֦not tags.meat⣩not tags.veggie߲ˣnot tags.eggŵ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_SMALL,3Ѫ
    TUNING.CALORIES_SMALL,12.5㼢
    ʱ䣺TUNING.PERISH_SUPERFAST,3죩
    ֵTUNING.SANITY_MEDLARGE,20ԣ
    ¶ȣTUNING.COLD_FOOD_BONUS_TEMP,-40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_AVERAGE,10룩
    ʱ䣺.5,0.5Сʱ

trailmixɹ
    ʳģnames.acorn_cookedtags.seed and tags.seed >= 1Ӵڵ1names.berries or names.berries_cooked콬tags.fruit and tags.fruit >= 1ˮڵ1not tags.meat⣩not tags.veggie߲ˣnot tags.eggŵnot tags.dairyƷ
    ʳͣ"VEGGIE",߲ˣ
    ѪTUNING.HEALING_MEDLARGE,30Ѫ
    TUNING.CALORIES_SMALL,12.5㼢
    ʱ䣺TUNING.PERISH_SLOW,15죩
    ֵTUNING.SANITY_TINY,5ԣ
    ʱ䣺.5,0.5Сʱ

hotchiliଣ
    ʳģtags.meat >= 1.5ڵ1.5tags.veggie >= 1.5߲˴ڵ1.5
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,20Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵ0,0ԣ
    ¶ȣTUNING.HOT_FOOD_BONUS_TEMP,40ȣ
    ¶ȳʱ䣺TUNING.FOOD_TEMP_LONG,15룩
    ʱ䣺.5,0.5Сʱ

guacamole潴
    ʳģnames.mole󣩡names.cactus_meat⣩not tags.fruitˮ
    ʳͣ"MEAT",⣩
    ѪTUNING.HEALING_MED,8Ѫ
    TUNING.CALORIES_LARGE,37.5㼢
    ʱ䣺TUNING.PERISH_MED,10죩
    ֵ0,0ԣ
    ʱ䣺.5,0.5Сʱ




.ƷӢ

1.ϣ

cutgrass	ݣ
twigs	֦
log	ľͷ
charcoal	ľ̿
ash	ң
cutreeds	µ«έ
lightbulb	ӫ
petals	꣩
petals_evil	جλ꣩
pinecone	ɹ
foliage	Ҷӣ
cutlichen	ժµ̦޺
wormlight	ӹ
lureplantbulb	ʳ˻ӣ
flint	ʯ
nitre	ʯ
redgem 	챦ʯ
bluegem	ʯ
purplegem	ϱʯ
greengem	̱ʯ
orangegem	ȱʯ
yellowgem	Ʊʯ
rocks	ʯ
goldnugget	ƽ
thulecite	ʯ
thulecite_pieces	Ƭ
rope	ӣ
boards	ľ壩
cutstone	ʯש
papyrus	ֽ
houndstooth	Ȯ
pigskin	Ƥ
manrabbit_tail	βͣ
silk	֩˿
spidergland	֩壩
spidereggsack	֩ѣ
beardhair	ӣ
beefalowool	ţë
honeycomb	䳲
stinger	̣
walrus_tusk	
feather_crow	ѻë
feather_robin	ȸë
feather_robin_winter	ѩȸë
horn	ţǣ
tentaclespots	Ƥ
trunk_summer	ǣ
trunk_winter	ǣ
slurtleslime	ţճҺ
slurtle_shellpieces	ţƬ
butterflywings	
mosquitosack	Ѫң
slurper_pelt	ʳƤ
minotaurhorn	Զػ߽ǣ
deerclops_eyeball	¹
lightninggoathorn	ǣ
glommerwings	ų
glommerflower	Ż
glommerfuel	ȼϣ
livinglog	ľͷ
nightmarefuel	جȼϣ
gears	֣
transistorܣ
marble	ʯ
boneshard	Ӳͷ
ice	
poop	㣩
guano	ࣩ
dragon_scales	Ƭ
goose_feather	¹Ѽë
coontail	βͣ
bearger_fur	Ƥ



2.

axe	ӣ
goldenaxe	ƽͷ
lucy	¶ӣ
hammer	ӣ
pickaxe	䣩
goldenpickaxe	ƽ䣩
shovel	ӣ
goldenshovel	ƽӣ
pitchfork	ݲ棩
razor	굶
bugnet	
fishingrod	ͣ
multitool_axe_pickaxe	๦ܹߣ
cane	ȣ
trap	壩
birdtrap	壩
trap_teeth	壩
trap_teeth_maxwell	˹壩
backpack	
piggyback	Ƥ
krampus_sack	˹
umbrella	ɡ
grass_umbrellaɡ
heatrock	ʯ
bedroll_straw	ϯ
bedroll_furry	ëƤ̸ǣ
torch	棩
lantern	ƣ
pumpkin_lantern	Ϲϵƣ
compass	ָ룩
fertilizerʣ
firesuppressor
sewing_kit	ҹ߰
spear	ì
boomerang	ڣ
tentaclespike	
blowdart_pipe	
blowdart_sleep	
blowdart_fire	ȼմ
hambat	ȶ̹
nightsword	Ӱ
batbat	
ruins_bat	ԶŶ̰
spear_wathgrithr	˿˹ì
panflute	
onemanband	
gunpowder	ҩ
beemine	۷ף
bell	壩
amulet	ɫ
blueamulet	ɫ
purpleamulet	ɫ
yellowamulet	ɫ
orangeamulet	ɫ 
greenamulet	ɫ
nightmare_timepiece	£
icestaff	ħȣ
firestaff	ħȣ
telestaff	ħȣ
orangestaff	ɫħȣ
greenstaff	ɫħȣ
yellowstaff	ɫħȣ
diviningrod	̽ȣ
book_birds	ٻ飩
book_tentacles	ٻֵ飩
book_gardening	ֲ飩
book_sleep	ߵ飩
book_brimstone	ٻ飩
waxwelljournal	˹־
abigail_flower	ȸǶ֮
balloons_empty	
balloon		
lighter	ޱĴ
chester_eyebone	˹عۣ
featherfan	ëȣ
staff_tornado	ħȣ
nightstick	ҹ



3.

strawhat	ñ
flowerhat	
beefalohat	ţëñ
featherhat	ëñ
footballhat	Ƥñ
tophat	ñ
earmuffshat	ö֣
winterhat	ñ
minerhat	ñ
spiderhat	֩ñ
beehat	ñ
walrushat	ñ
slurtlehat	ţñӣ
bushhat	ñ
ruinshat	Զڣ
rainhatñ
icehatñ
watermelonhat	ñ
catcoonhat	ñ
wathgrithrhat	˿˹ñ
armorwood	ľף
armorgrass	ݿף
armormarble	ʯף
armor_sanity	ҹħף
armorsnurtleshell	ţף
armorruins	Զſף
sweatervest	Сɱģ
trunkvest_summer	ձģ
trunkvest_winter	ģ
armorslurper	
raincoat£
webberskull	Τͷǣ
molehat	ñ
armordragonfly	ѿף
beargervest	ܱģ
eyebrellahat	۾ñ
reflectivevest	䱳ģ
hawaiianshirt	ĳ



4.

campfire	Ӫ
firepit	ʯͷӪ
coldfire
coldfirepitʯͷ
cookpot	
icebox	䣩
winterometer	¶ȼƣ
rainometer	ƣ
slow_farmplot	һũ
fast_farmplot	߼ũ
siestahut˯Сݣ
tent	
homesign	·ƣ
birdcage	
meatrack	ܣ
lightning_rod	룩
pottedfern	ԣ
nightlight	ҹƣ
nightmarelight	Ӱƣ
researchlab	ѧ
researchlab2	棩
researchlab3	Ӱߣ
researchlab4	ӷֽ
treasurechest	ľ䣩
skullchest	䣩
pandoraschest	ӣ
minotaurchest	ӣ
wall_hay_item	ǽ
wall_wood_item	ľǽ
wall_stone_item	ʯǽ
wall_ruins_item	ǽ
wall_hay	ϵĲǽ
wall_wood	ϵľǽ
wall_stone	ϵʯǽ
wall_ruins	ϵǽ
pighouse	
rabbithole	÷
mermhouse	˷
resurrectionstatue	
resurrectionstone	ʯ
ancient_altar 	Զż̳
ancient_altar_broken 	𻵵Զż̳
telebase	ͺģ
gemsocket	ʯ̨
eyeturret	̶ڵϵ۾
eyeturret_item	ɴߵ۾
cave_exit	Ѩڣ
turf_woodfloor	ľذ壩
turf_carpetfloor	̺ذ壩
turf_checkerfloor	̵ذ壩
adventure_portal	ð֮ţ
rock_light	ɽӣ
gravestone	Ĺ
mound	Ĺѣ
skeleton	˹ǣ
houndbone	ͷ
animal_track	㼣
dirtpile	ɵѣ
pond	
pond_cave	Ѩ
pighead	ͷ
mermhead	ͷ
pigtorch	棩
rabbithole	Ӷ
beebox	䣩
beehive	Ұѣ
wasphive	ɱ˷ѣ
spiderhole	Ѩ֩붴
walrus_camp	ѣ
tallbirdnest	ѣ
houndmound	Ȯ
slurtlehole	ţѣ
batcave	𶴣
monkeybarrel	Ͱ
spiderden	֩볲Ѩ
molehill	
catcoonden	ܶ
rock1	ʯʯ
rock2	ƽʯ
rock_flintless	ֻʯͷʯ
stalagmite_full	ԲѨʯͷ
stalagmite_med	ԲѨʯͷ
stalagmite_low	СԲѨʯͷ
stalagmite_tall_full	߶Ѩʯͷ
stalagmite_tall_med	и߶Ѩʯͷ
stalagmite_tall_low	С߶Ѩʯͷ
rock_ice	ʯ
ruins_statue_head	Զͷ
ruins_statue_mage	Զŷʦ
marblepillar	ʯӣ
marbletree	ʯ
statueharp	ٵ
basalt	ң
basalt_pillar	ң
insanityrock	ʯ
sanityrock	ʯ
ruins_chair	Զӣ
ruins_vase	ԶŻƿ
ruins_table	Զӣ
statuemaxwell	˹
statueglommer	ŵ
relic	棩
ruins_rubble	ٵķ棩
bishop_nightmare	𻵵ĵ
rook_nightmare	𻵵ս
knight_nightmare	𻵵ʿ
chessjunk1	𻵵Ļе1
chessjunk2	𻵵Ļе2
chessjunk3	𻵵Ļе3
teleportato_ring	״ͻ
teleportato_box	״ͻ
teleportato_crank	״ͻ
teleportato_potato	״ͻ
teleportato_base	ͻ
teleportato_checkmate	ͻ
wormhole	涴
wormhole_limited_1	Ƶĳ涴
stafflight	Сǣ
treasurechest_trap	壩
icepack	
dragonflychest	ӣ



5.ʳ

carrot	ܲ
carrot_cooked	ܲ
berries	
berries_cooked	콬
pumpkin	Ϲϣ
pumpkin_cooked	Ϲϣ
dragonfruit	
dragonfruit_cooked	
pomegranate	ʯ
pomegranate_cooked	ʯ
corn	ף
corn_cooked	ף
durian	
durian_cooked	
eggplant	ӣ
eggplant_cooked	ӣ
cave_banana	Ѩ㽶
cave_banana_cooked	춴Ѩ㽶
acorn	
acorn_cooked
cactus_meat	⣩
watermelonϣ
red_cap	ժĺĢ
red_cap_cooked	ĺĢ
green_cap	ժĢ
green_cap_cooked	Ģ
blue_cap_cooked	Ģ
blue_cap	ժĢ
seeds	ӣ
seeds_cooked	ӣ
carrot_seeds	ܲӣ
pumpkin_seeds	Ϲӣ
dragonfruit_seeds	ӣ
pomegranate_seeds	ʯӣ
corn_seeds	ӣ
durian_seeds	ӣ
eggplant_seeds	ӣ
smallmeat	С⣩
cookedsmallmeat	С⣩
smallmeat_dried	С⣩
meat	⣩
cookedmeat	⣩
meat_dried	⣩
drumstick	ȣ
drumstick_cooked	켦ȣ
monstermeat	⣩
cookedmonstermeat	⣩
monstermeat_dried	ɷ⣩
plantmeat	ʳ˻⣩
plantmeat_cooked	ʳ˻⣩
bird_egg	
bird_egg_cooked	ļ
rottenegg	ü
tallbirdegg	񵰣
tallbirdegg_cooked	񵰣
tallbirdegg_cracked	ĸ񵰣
fish	㣩
fish_cooked	㣩
eel	㣩
eel_cooked	㣩
froglegs	ȣ
froglegs_cooked	ȣ
batwing	
batwing_cooked	
trunk_cooked	ǣ
mandrake	ݣ
cookedmandrake	ݣ
honey	ۣ
butter	ͣ
butterflymuffin	ɱ
frogglebunwich	ԲΣ
honeyham	֭ȣ
dragonpie	ڱ
taffy	̫ǣ
pumpkincookie	Ϲϱ
kabobs	⴮
powcake	֥ʿ⣩
mandrakesoup	
baconeggs	ȣ
bonestew	
perogies	ԲСֱ
wetgoop	ʪ役
ratatouille	ŵˣ
fruitmedley	ˮƴ̣
fishtacos 	ױը㣩
waffles 	
turkeydinner	ͣ
fishsticks	
stuffedeggplant	ѺУ
honeynuggets	۽ש
meatballs	裩
jammypreserves	۽
monsterlasagna	ǧ
unagi	
bandage	۱
healingsalve	ҩࣩ
spoiled_food	ʳ
flowersalad	ɳ
icecream	ܣ
watermelonicle	ϱ
trailmix	ɹ
hotchili	ଣ
guacamole	潴
goatmilk	̣



6.ֲ

flower	
flower_evil	جλ
carrot_planted	ڵϵĺܲ
grass	ڵϵĲݣ
depleted_grass	ݸ
dug_grass	ݴأ
sapling	磩
dug_sapling	ֵ磩
berrybush	ԣ
dug_berrybush	ֵĹԣ
berrybush2	2
dug_berrybush2	ֵĹ2
marsh_bush	̹ľ
dug_marsh_bush	ֵļ̹ľ
reeds	«έ
lichen	Ѩ̦޺
cave_fern	ާֲ
evergreen	
evergreen_sparse	ɹ
marsh_tree	Ҷ
cave_banana_tree	Ѩ㽶
livingtree	
deciduoustree	
deciduoustree_tall	
deciduoustree_short	
red_mushroom	Ģ
green_mushroom	Ģ
blue_mushroom	Ģ
mushtree_tall	Ģ
mushtree_medium	Ģ
mushtree_small	СĢ
flower_cave	䶴Ѩ
flower_cave_double	˫䶴Ѩ
flower_cave_triple	䶴Ѩ
tumbleweed	ݣ
cactus	ƣ
cactus_flower	ƻ
marsh_plant	ˮСݣ
pond_algae	ˮ壩



7.

rabbit	ӣ
perd	𼦣
crow	ѻ
robin	ȸ
robin_winter	ѩȸ
butterfly	
fireflies	ө棩
bee	۷䣩
killerbee	ɱ˷䣩
flies	Ӭ
mosquito	ӣ
frog	ܣ
beefalo	ţ
babybeefalo	Сţ
lightninggoat	
pigman	ˣ
pigguard	
bunnyman	ˣ
merm	ˣ
spider_hider	Ѩ֩룩
spider_spitter	֩룩
spider	С֩룩
spider_warrior	֩룩
spiderqueen	֩Ů
spider_dropper	֩룩
hound	Թ
firehound	ɫԹ
icehound	
tentacle	֣
tentacle_garden	ʹ֣
leif	
leif_sparse	ϡ
walrus	
little_walrus	С
smallbird	С
teenbird	
tallbird	
koalefant_summer	
koalefant_winter	
penguin	죩
slurtle	ţ꣩
snurtle	棩
bat	
rocky	Ϻ
monkey	ӣ
slurper	׺ʳߣ
buzzard	ͺգ
mole	
catcoon	ܣ
knight	ʿ
bishop	̣
rook	ս
crawlinghorror	аӰ֣
terrorbeak	찵Ӱ֣
deerclops	¹
minotaur	Զػߣ
worm	Զųӣ
abigail	ȸǶ
ghost	飩
shadowwaxwell	˹ӰСˣ
krampus	˹
glommer	ţ
chester	˹أ
lureplant	ʳ˻
eyeplant	ʳ˻۾
bigfoot	ţ
pigking	
moose	¹Ѽ
mossling	СѼ
dragonfly	ѣ
warg	ǣ
bearger	ܣ
birchnutdrake	Ѽ
mooseegg	¹Ѽ



8.ɫ

wilson	ѷ
waxwell	˹
wendy	µ٣
woodie	ϣ
wes	Τ˹
wickerbottom	ͼԱ
willow	ޱ壩
wolfgang	ֶԣ
wx78	ˣ
wathgrithr	˿˹
webber	Τ