1
BloxGaming SB3 / Merry Christmas Space Builders!
« on: December 25, 2017, 10:01:07 pm »
I hope that everyone had a great holiday. I'm hoping Santa brought me some free time in 2018 for more SpaceBuild! Miss playing with all of you.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
@name Televator_v1.1
# By Kevin Minion
# 09/24/2016 v1.0 Original Code
# v1.1 Request to update GPS for target finders as ships move
#
# PURPOSE: To auto-teleport using target finders and a single asgard teleprter
# Idea from Shifty / RendStung
@inputs Teleporter:wirelink
@outputs
@persist ArrFinders:array
@persist WireLinkFinder1:wirelink WireLinkFinder2:wirelink
@persist Finder1:entity Finder2:entity LastFinder1:entity LastFinder2:entity
@persist GPS1:vector GPS2:vector
@trigger
interval(1000) # Check every second
if (first() || dupefinished()) {
# Find target finders, sort by distance
findIncludePlayerProps(owner())
findByClass("gmod_wire_target_finder")
findSortByDistance(entity():pos())
ArrFinders = findToArray()
print("Found " + ArrFinders:count() + " target finders")
# Save the wirelinks of the target finders for later
WireLinkFinder1 = ArrFinders[1,entity]:wirelink()
WireLinkFinder2 = ArrFinders[2,entity]:wirelink()
# Clear the Teleporter input of this chip
entity():deleteWire("Teleporter")
# Wire the Teleporter input of this chip to the Asgard teleporter it is welded to
if (entity():isWeldedTo():model() != "models/boba_fett/props/asgard_console/asgard_console.mdl") {
print("This chip MUST be welded to the asgard teleporter!")
} else {
Worked = entity():createWire(entity():isWeldedTo(),"Teleporter","wirelink")
if (Worked) {
hint("createWire worked!",3)
} else {
hint("createWire failed!",3)
}
}
}
GPS1 = ArrFinders[1,entity]:pos()
GPS2 = ArrFinders[2,entity]:pos()
Finder1 = WireLinkFinder1["1_Ent",entity]
Finder2 = WireLinkFinder2["1_Ent",entity]
if ((Finder1!=LastFinder1) && Finder1:isPlayer() && Finder1:isAlive()) {
Teleporter["Origin",vector] = GPS1
Teleporter["Dest" ,vector] = GPS2
timer("Send",350)
} elseif ((Finder2!=LastFinder2) && Finder2:isPlayer() & Finder2:isAlive()) {
Teleporter["Origin",vector] = GPS2
Teleporter["Dest" ,vector] = GPS1
timer("Send",350)
}
LastFinder1 = Finder1
LastFinder2 = Finder2
if (clk("Send")) {
Teleporter["Send" ,number] = 1
timer("clear",200)
}
if (clk("clear")) {
Teleporter["Send" ,number] = 0
Teleporter["Origin",vector] = vec(0,0,0)
Teleporter["Dest" ,vector] = vec(0,0,0)
}