Don't Starve Together

Don't Starve Together

Improved Force Attack
Mister Mycelium 2022년 10월 19일 오후 2시 27분
Support for wild beefalo
I found that my largest issue when playing with friends was accidentally attacking their beefalo, however I almost always want to attack beefalo during the early portion of the game. This code adds an option to check if they have an owner.

if guy:HasTag("beefalo") then local hasowner = guy.replica.follower:GetLeader() or nil if CONFIG.force_attack_beefalos == "NEVER" or ( CONFIG.force_attack_beefalos == "WildOnly" and hasowner ~= nil) then return true end end

The following also adds some hover text for the options page, though I changed all of the labels to just one word.

for i = 1, #configuration_options do local opt = configuration_options
opt.hover = "CTRL+F Force Attack Behavior For " .. opt.label
local options = opt.options
for i = 1, #options do
if options.data == "UNMODIFIED" then
options.hover = "Default Behavior"
elseif options.data == "NEVER" then
options.hover = "Never Force Attack"
elseif options.data == "IF_HOSTILE" then
options.hover = "Only Force Attack When Hostile"
end
end
end[/code]

Beefalo entry in modinfo to support the new option:
[code[
{
name = "force_attack_beefalos",
label = "Beefalos",
hover = "",
options =
{
{
description = "Default",
data = "UNMODIFIED",
},
{
description = "Wild Only",
data = "WildOnly",
hover = "Only Force Attack Wild Beefalo"
},
{
description = "Never",
data = "NEVER",
},
},
default = "NEVER",
},[/code]