-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve user-generated entity/wirelink outputs #2891
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we do something like shift+r with the wire tool removes outputs? Making a whole new tool for this is kind of messy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so. I didn't want to touch the wire tool because I figured it had enough features. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
TOOL.Category = "Tools" | ||
TOOL.Name = "Output Remover" | ||
TOOL.Tab = "Wire" | ||
|
||
if CLIENT then | ||
language.Add("Tool.wire_outputremover.name", "Wire Output Remover") | ||
language.Add("Tool.wire_outputremover.desc", "Removes auto-generated entity or wirelink outputs.") | ||
language.Add("Tool.wire_outputremover.desc2", "Used to connect wirable props.") | ||
language.Add("Tool.wire_outputremover.left", "Remove entity output") | ||
language.Add("Tool.wire_outputremover.right","Remove wirelink output") | ||
language.Add("Tool.wire_outputremover.reload", "Remove both") | ||
TOOL.Information = { "left", "right", "reload" } | ||
|
||
TOOL.Wire_ToolMenuIcon = "icon16/disconnect.png" | ||
end | ||
|
||
if SERVER then | ||
local function removeWirelinkOutput(ent) | ||
if ent.EntityMods and ent.EntityMods.CreateWirelinkOutput and ent.Outputs and ent.Outputs.wirelink then | ||
WireLib.DisconnectOutput(ent, "wirelink") | ||
ent.Outputs.wirelink = nil | ||
WireLib.RemoveOutPort(ent, "wirelink") | ||
duplicator.ClearEntityModifier(ent, "CreateWirelinkOutput") | ||
WireLib._SetOutputs(ent) | ||
end | ||
end | ||
|
||
local function removeEntityOutput(ent) | ||
if ent.EntityMods and ent.EntityMods.CreateEntityOutput and ent.Outputs and ent.Outputs.entity then | ||
WireLib.DisconnectOutput(ent, "entity") | ||
ent.Outputs.entity = nil | ||
WireLib.RemoveOutPort(ent, "entity") | ||
duplicator.ClearEntityModifier(ent, "CreateEntityOutput") | ||
WireLib._SetOutputs(ent) | ||
end | ||
end | ||
|
||
function TOOL:LeftClick(trace) | ||
local ent = trace.Entity | ||
if ent:IsValid() then | ||
removeEntityOutput(ent) | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
function TOOL:RightClick(trace) | ||
local ent = trace.Entity | ||
if ent:IsValid() then | ||
removeWirelinkOutput(ent) | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
function TOOL:Reload(trace) | ||
local ent = trace.Entity | ||
if ent:IsValid() then | ||
removeEntityOutput(ent) | ||
removeWirelinkOutput(ent) | ||
return true | ||
end | ||
return false | ||
end | ||
else | ||
function TOOL.BuildCPanel(panel) | ||
panel:AddControl("Header", { Text = "#Tool.wire_outputremover.name", Description = "#Tool.wire_outputremover.desc" }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2940, just posting review to make it official