Skip to content

Commit

Permalink
Fixed shipdoor
Browse files Browse the repository at this point in the history
  • Loading branch information
thakyZ committed Jan 29, 2021
1 parent 0756fd3 commit 29a9af6
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 78 deletions.
10 changes: 5 additions & 5 deletions _metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"version" : "2.8.5",
"tags" : "Crafting and Building|Weapons|Cheats and God Items|Furniture and Objects|Armor and Clothes",
"author" : "thakyZ",
"description" : "^#EA9931;A mod about a little kitty named Lilly, and other things.^#FFFFFF;\n\nThis is a mod for Starbound. It contains an assorted amount of changes and additions to Starbound.\nLilly is my cat who is a 12 year old calico, and she is so cute I just had to name a mod after her.\n\nThis mod contains armor, weapons and objects. The armor is an end tier armor set and is titled, Zorabian Armor, this armor is not based off of anything, but is Thaky's own creation. The armor has been balanced and with other mods, such as Frackin' Universe, it does change to not being an end tier armor set. There is an admin version of the armor set and is only able to be spawned in via admin mode (more details in the item list for this mod).\n\nThe Weapons in this mod is first the Void Excalibur, which is a top tier sword that has a unique texture and not so unique secondary ability; the secondary abality is planned on changing in the future. The second weapon is the Zorabian Assault rifle, it is a high powered rifle, and it too has a secondary ability already in the game and is going to be changed in the future.\n\nOther miscellaneous items are the Zorcan Crystal, which is a element created by infusion of all tier 5 ores and solarium. This item is used only for creating Zorabian products like the Void Excalibur or Zorabian Armor.\n\nA new pet texture to the cat provides Thaky's kitty, Lilly to be able to be a pet. If you want to have Lilly specifically you must download the Purchasable Pets mod. With the Purchasable Pets mod being an optional mod, DO NOT use the Lilly's Pet House if you are going to not get the Purchasable Pets mod.\n\nThis also adds some furniture like a painting of Lilly, custom teleporters, an ancient torch stand, Lilly's Emblem, and gravestones. These gravestones consist of my previous real life cats Oscar and Wilson.\n\nSome other objects that have been added, is a painting of Lilly, a emblem of Lilly's paw (not actually Lilly's paw), and some other hidden objects that have yet to be implemented.\n\n^#A451C4;Item List:^#FFFFFF; ^#9BBA3D;https://files.nekogaming.xyz/games/starbound/lillymod-item-list/^#FFFFFF;\n\n^#A451C4;Chucklefish Forums:^#FFFFFF; ^#9BBA3D;https://community.playstarbound.com/resources/lillymod.4686/^#FFFFFF;\n^#A451C4;Steam Workshop:^#FFFFFF; ^#9BBA3D;https://steamcommunity.com/sharedfiles/itemedittext/?id=729548200^#FFFFFF;\n\nIf you would like to have Lilly as a purchasable pet you can download \"^#0080FF;LillyMod Purchasable Pets Patch^#FFFFFF;\"\n^#A451C4;Chucklefish Forums:^#FFFFFF; ^#9BBA3D;https://community.playstarbound.com/resources/lillymod-purchasable-pets-patch.5620/^#FFFFFF;\n^#A451C4;Steam Workshop:^#FFFFFF; ^#9BBA3D;https://steamcommunity.com/sharedfiles/filedetails/?id=1595365078^#FFFFFF;\n\nFully compatible with Frackin' Universe\n^#9BBA3D;https://i.imgur.com/1TfuM5F.png^#FFFFFF;",
"name" : "LillyMod",
"description" : "^#EA9931;A mod about a little kitty named Lilly, and other things.^reset;\n\nThis is a mod for Starbound. It contains an assorted amount of changes and additions to Starbound.\nLilly is my cat who is a 12 year old calico, and she is so cute I just had to name a mod after her.\n\nThis mod contains armor, weapons and objects. The armor is an end tier armor set and is titled, Zorabian Armor, this armor is not based off of anything, but is Thaky's own creation. The armor has been balanced and with other mods, such as Frackin' Universe, it does change to not being an end tier armor set. There is an admin version of the armor set and is only able to be spawned in via admin mode (more details in the item list for this mod).\n\nThe Weapons in this mod is first the Void Excalibur, which is a top tier sword that has a unique texture and not so unique secondary ability; the secondary abality is planned on changing in the future. The second weapon is the Zorabian Assault rifle, it is a high powered rifle, and it too has a secondary ability already in the game and is going to be changed in the future.\n\nOther miscellaneous items are the Zorcan Crystal, which is a element created by infusion of all tier 5 ores and solarium. This item is used only for creating Zorabian products like the Void Excalibur or Zorabian Armor.\n\nA new pet texture to the cat provides Thaky's kitty, Lilly to be able to be a pet. If you want to have Lilly specifically you must download the Purchasable Pets mod. With the Purchasable Pets mod being an optional mod, DO NOT use the Lilly's Pet House if you are going to not get the Purchasable Pets mod.\n\nThis also adds some furniture like a painting of Lilly, custom teleporters, an ancient torch stand, Lilly's Emblem, and gravestones. These gravestones consist of my previous real life cats Oscar and Wilson.\n\nSome other objects that have been added, is a painting of Lilly, a emblem of Lilly's paw (not actually Lilly's paw), and some other hidden objects that have yet to be implemented.\n\n^#A451C4;Item List:^reset; ^#9BBA3D;https://files.voidinc.net/games/starbound/lillymod-item-list/^reset;\n\n^#A451C4;Steam Workshop:^reset; ^#9BBA3D;https://steamcommunity.com/sharedfiles/itemedittext/?id=729548200^reset;\n^#A451C4;Chucklefish Forums:^reset; ^#9BBA3D;https://community.playstarbound.com/resources/lillymod.4686/^reset;\n^#A451C4;Github Repo:^reset; ^#9BBA3D;https://github.com/thakyZ/LillyMod^reset;\n\nIf you would like to have Lilly as a purchasable pet you can download \"^#0080FF;LillyMod Purchasable Pets Patch^reset;\"\n^#A451C4;Steam Workshop:^reset; ^#9BBA3D;https://steamcommunity.com/sharedfiles/filedetails/?id=1595365078^reset;\n^#A451C4;Chucklefish Forums:^reset; ^#9BBA3D;https://community.playstarbound.com/resources/lillymod-purchasable-pets-patch.5620/^reset;\n^#A451C4;Github Repo:^reset; ^#9BBA3D;https://github.com/thakyZ/LillyMod_PurchasablePets^reset;\n\nFully compatible with Frackin' Universe\n^#9BBA3D;https://i.imgur.com/1TfuM5F.png^reset;",
"friendlyName" : "LillyMod",
"link" : "steam://url/CommunityFilePage/729548200",
"name" : "LillyMod",
"steamContentId" : "729548200",
"link" : "steam://url/CommunityFilePage/729548200"
"tags" : "Crafting and Building|Weapons|Cheats and God Items|Furniture and Objects|Armor and Clothes",
"version" : "2.8.6"
}
4 changes: 2 additions & 2 deletions objects/lilly/shipdoor/lillyshipdoor.animation
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"default" : "closed",
"states" : {
"opening" : {
"frames" : 3,
"frames" : 2,
"cycle" : 0.15,
"mode" : "transition",
"transition" : "open"
},
"open" : {},
"closing" : {
"frames" : 3,
"frames" : 2,
"cycle" : 0.15,
"mode" : "transition",
"transition" : "closed"
Expand Down
86 changes: 43 additions & 43 deletions objects/lilly/shipdoor/lillyshipdoor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,68 @@ function init()
self.detectArea = config.getParameter("detectArea")
self.detectArea[1] = object.toAbsolutePosition(self.detectArea[1])
self.detectArea[2] = object.toAbsolutePosition(self.detectArea[2])

self.connectedDoor = nil
self.doorLocked = false
self.lockInputLevel = nil
self.forceOpenTimer = 0

message.setHandler("openDoor", function()
if animator.animationState("doorState") == "closed" or animator.animationState("doorState") == "closing" then
animator.setAnimationState("doorState", "open")
self.forceOpenTimer = 0.5
end
if animator.animationState("doorState") == "closed" or animator.animationState("doorState") == "closing" then
animator.setAnimationState("doorState", "open")
self.forceOpenTimer = 0.5
end
end)
end

function update(dt)
--If we don't have a connected door, check for one every frame
--Doing this every frame prevents rare issues where the connection check fails when loading a new sector
if not self.connectedDoor then
checkDoorConnection()
checkDoorConnection()
end

--If we have input on the lock node, invert that to set lock state. If there is no connection in the lock node, unlock the door
if object.isInputNodeConnected(1) then
self.lockInputLevel = object.getInputNodeLevel(1)
self.doorLocked = not self.lockInputLevel
self.lockInputLevel = object.getInputNodeLevel(1)
self.doorLocked = not self.lockInputLevel
else
self.doorLocked = false
self.doorLocked = false
end

--Count down the force open timer
self.forceOpenTimer = math.max(0, self.forceOpenTimer - dt)

--Check if there are players nearby
local players = world.entityQuery(self.detectArea[1], self.detectArea[2], {
includedTypes = {"player"},
boundMode = "CollisionArea"
includedTypes = {"player"},
boundMode = "CollisionArea"
})

--If the door is connected, open or close the door based on player proximity
if #players > 0 and self.connectedDoor and animator.animationState("doorState") == "closed" and not self.doorLocked then
animator.setAnimationState("doorState", "opening")
animator.playSound("open")
animator.setAnimationState("doorState", "opening")
animator.playSound("open")
elseif #players == 0 and self.connectedDoor and animator.animationState("doorState") == "open" and self.forceOpenTimer == 0 and not self.doorLocked then
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
--If the door isn't connected, try to close the door
elseif not self.connectedDoor and animator.animationState("doorState") == "open" and self.forceOpenTimer == 0 and not self.doorLocked then
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
elseif animator.animationState("doorState") == "open" and self.doorLocked then
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
animator.setAnimationState("doorState", "closing")
animator.playSound("close")
end

--If we have a connected door and it still exists, make the door interactive
if self.connectedDoor and world.entityExists(self.connectedDoor) and not self.doorLocked then
object.setInteractive(true)
object.setInteractive(true)
else
object.setInteractive(false)
self.connectedDoor = false
object.setInteractive(false)
self.connectedDoor = false
end

--Debug the detectArea and the stored door connection ID
local detectPoly = {self.detectArea[1], {self.detectArea[1][1], self.detectArea[2][2]}, self.detectArea[2], {self.detectArea[2][1], self.detectArea[1][2]}}
world.debugPoly(detectPoly, "cyan")
Expand All @@ -82,14 +82,14 @@ function update(dt)
end

--Called on interaction from a player or NPC. Used for active teleportation
function onInteraction(args)
function onInteraction(args)
local targetPosition = world.entityMouthPosition(self.connectedDoor)
local interactedEntity = args.sourceId

if self.connectedDoor then
world.sendEntityMessage(interactedEntity, "applyStatusEffect", "thea-teleportentity", 0.1, self.connectedDoor)
world.sendEntityMessage(interactedEntity, "applyStatusEffect", "thea-teleportentity", 0.1, self.connectedDoor)
end

--TODO: Implement status effect that teleports an entity. Use the sourceEntity to transmit target position?
end

Expand All @@ -102,16 +102,16 @@ end
function checkDoorConnection()
self.connectedDoor = nil
for entityId, _ in pairs(object.getOutputNodeIds(0)) do
if world.entityExists(entityId) then
--Check if the connected object allows background door connections
if world.getObjectParameter(entityId, "allowBackgroundDoorConnection", false) then
self.connectedDoor = entityId
end

--local entityName = world.entityName(entityId)
--if entityName == world.entityName(entity.id()) then
--self.connectedDoor = entityId
--end
end
if world.entityExists(entityId) then
--Check if the connected object allows background door connections
if world.getObjectParameter(entityId, "allowBackgroundDoorConnection", false) then
self.connectedDoor = entityId
end
--local entityName = world.entityName(entityId)
--if entityName == world.entityName(entity.id()) then
--self.connectedDoor = entityId
--end
end
end
end
64 changes: 48 additions & 16 deletions objects/lilly/shipdoor/lillyshipdoor.object
Original file line number Diff line number Diff line change
@@ -1,42 +1,74 @@
{
"objectName" : "lillyshipdoor",
"colonyTags" : ["lilly","misc"],
"objectType" : "teleporter",
"rarity" : "Common",
"description" : "A door that is also a teleporter!",
"shortdescription" : "Lilly Co. Ship Door",
"price" : 80,
"category" : "door",
"printable" : true,
"price" : 80,
"description" : "A blast door. It can be linked to other background doors.",
"shortdescription" : "Lilly Co. Ship Door",

"category" : "door",
"apexDescription" : "I wonder where this door leads...",
"avianDescription" : "I wonder where this door leads...",
"floranDescription" : "Floran wondersss where door goesss...",
"glitchDescription" : "Curious. I wonder where this door leads...",
"humanDescription" : "I wonder where this door leads...",
"hylotlDescription" : "I wonder where this door leads...",
"novakidDescription" : "I wonder where this door leads...",

"aegiDescription" : "I wonder where this door leads...",
"avikanDescription" : "I wonder where this door leads...",
"draunaarDescription" : "I wonder where this door leads...",
"trinkDescription" : "I wonder where this door leads...",
"hymidDescription" : "I wonder where this door leads...",
"notixDescription" : "I wonder where this door leads...",
"jorgasianDescription" : "I wonder where this door leads...",
"centensDescription" : "I wonder where this door leads...",
"dremetonDescription" : "I wonder where this door leads...",
"theleanDescription" : "I wonder where this door leads...",
"drodenDescription" : "Scanning failed. Unable to determine where this door leads.",
"akkimariDescription" : "Akki wonder where door leads...",

"interactAction" : "OpenTeleportDialog",
"interactData" : "/interface/warping/remoteteleporter.config",
"nekoDescription" : "I wonder where this door leads...",

"inventoryIcon" : "icon.png",
"orientations" : [
{
"imageLayers" : [ { "image" : "lillyshipdoor.png:<color>", "fullbright" : true }, { "image" : "lillyshipdoorlit.png:<color>" } ],
"imageLayers" : [ { "image" : "lillyshipdoor.png:<color>.<frames>", "fullbright" : true }, { "image" : "lillyshipdoorlit.png:<color>.<frames>" } ],
"imagePosition" : [-16, 0],
"animationPosition" : [-16, 0],
"spaceScan" : 0.1,

"anchors" : [ "bottom" ],
"anchors" : [ "bottom", "background" ],
"direction" : "right"
}
],

"detectArea" : [ [-6, 0], [7, 6] ],
"allowBackgroundDoorConnection" : true,
"mouthPosition" : [0, -1], //Used to determine the teleport position of the door
"inputNodes" : [ [-2, 0], [-2, 2] ],
"outputNodes" : [ [1, 4] ],

"animation" : "/objects/lilly/shipdoor/lillyshipdoor.animation",
"animationCustom" : {
"sounds" : {
"open" : {
"pool" : [ "/sfx/objects/apexcooldoor_open.ogg" ],
"rangeMultiplier" : 0.5
},
"close" : {
"pool" : [ "/sfx/objects/apexcooldoor_close.ogg" ],
"rangeMultiplier" : 0.5
}
}
},
"animationParts" : {
"bg" : "lillyshipdoor.png",
"fg" : "lillyshipdoorlit.png"
},
"animationPosition" : [-16, 0],

"scripts" : [ "/objects/lilly/shipdoor/lillyshipdoor.lua" ],
"detectArea" : [ [-6, 0], [7, 6] ],

"scripts" : [ "/objects/lilly/shipdoor/lillyshipdoor.lua" ]
"allowBackgroundDoorConnection" : true,
"mouthPosition" : [0, -1], //Used to determine the teleport position of the door

"inputNodes" : [ [-2, 0], [-2, 2] ],
"outputNodes" : [ [1, 4] ]
}
21 changes: 9 additions & 12 deletions objects/lilly/shipdoor/lillyshipdoorlit.frames
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@
"size" : [32, 40],
"dimensions" : [4, 3],
"names" : [
[ "default.closed", "default.opening.3", "default.opening.2", "default.opening.1" ],
[ "blue.closed", "blue.opening.3", "blue.opening.2", "blue.opening.1" ],
[ "orange.closed", "orange.opening.3", "orange.opening.2", "orange.opening.1" ]
[ "default.closed", "default.opening.1", "default.opening.2", "default.open" ],
[ "blue.closed", "blue.opening.1", "blue.opening.2", "blue.open" ],
[ "orange.closed", "orange.opening.1", "orange.opening.2", "orange.open" ]
]
},

"aliases" : {
"default.default" : "default.closed",
"default.closing.1" : "default.opening.3",
"default.closing.2" : "default.opening.2",
"default.closing.3" : "default.opening.1",
"default.closing.1" : "default.opening.2",
"default.closing.2" : "default.opening.1",
"blue.blue" : "blue.closed",
"blue.closing.1" : "blue.opening.3",
"blue.closing.2" : "blue.opening.2",
"blue.closing.3" : "blue.opening.1",
"blue.closing.1" : "blue.opening.2",
"blue.closing.2" : "blue.opening.1",
"orange.orange" : "orange.closed",
"orange.closing.1" : "orange.opening.3",
"orange.closing.2" : "orange.opening.2",
"orange.closing.3" : "orange.opening.1"
"orange.closing.1" : "orange.opening.2",
"orange.closing.2" : "orange.opening.1"
}
}

0 comments on commit 29a9af6

Please sign in to comment.