From 29a9af6268a2d7f40d6c4a92529b9b8087e5eb9d Mon Sep 17 00:00:00 2001 From: thakyZ Date: Fri, 29 Jan 2021 11:38:00 -0800 Subject: [PATCH] Fixed shipdoor --- _metadata | 10 +-- .../lilly/shipdoor/lillyshipdoor.animation | 4 +- objects/lilly/shipdoor/lillyshipdoor.lua | 86 +++++++++---------- objects/lilly/shipdoor/lillyshipdoor.object | 64 ++++++++++---- .../lilly/shipdoor/lillyshipdoorlit.frames | 21 ++--- 5 files changed, 107 insertions(+), 78 deletions(-) diff --git a/_metadata b/_metadata index 12597d4..1a145b4 100644 --- a/_metadata +++ b/_metadata @@ -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" } \ No newline at end of file diff --git a/objects/lilly/shipdoor/lillyshipdoor.animation b/objects/lilly/shipdoor/lillyshipdoor.animation index 1ea671e..31560c6 100644 --- a/objects/lilly/shipdoor/lillyshipdoor.animation +++ b/objects/lilly/shipdoor/lillyshipdoor.animation @@ -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" diff --git a/objects/lilly/shipdoor/lillyshipdoor.lua b/objects/lilly/shipdoor/lillyshipdoor.lua index 5d4fbb4..33f0062 100644 --- a/objects/lilly/shipdoor/lillyshipdoor.lua +++ b/objects/lilly/shipdoor/lillyshipdoor.lua @@ -11,17 +11,17 @@ 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 @@ -29,50 +29,50 @@ 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") @@ -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 @@ -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 diff --git a/objects/lilly/shipdoor/lillyshipdoor.object b/objects/lilly/shipdoor/lillyshipdoor.object index 17762b8..a559670 100644 --- a/objects/lilly/shipdoor/lillyshipdoor.object +++ b/objects/lilly/shipdoor/lillyshipdoor.object @@ -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:", "fullbright" : true }, { "image" : "lillyshipdoorlit.png:" } ], + "imageLayers" : [ { "image" : "lillyshipdoor.png:.", "fullbright" : true }, { "image" : "lillyshipdoorlit.png:." } ], "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] ] } diff --git a/objects/lilly/shipdoor/lillyshipdoorlit.frames b/objects/lilly/shipdoor/lillyshipdoorlit.frames index a4c301d..6db0bf2 100644 --- a/objects/lilly/shipdoor/lillyshipdoorlit.frames +++ b/objects/lilly/shipdoor/lillyshipdoorlit.frames @@ -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" } }