Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 6 7 8 9 10 … 18 Next »
Sensor wirelink delay?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Sensor wirelink delay?
13-12-2017, 12:05 AM, (This post was last modified: 13-12-2017, 12:06 AM by SuperPlayer. Edited 1 time in total.)
#1
SuperPlayer Offline
TSCM Super Member
****
Posts: 234
Threads: 30
Joined: Oct 2014
Sensor wirelink delay?
Hey there. While I was working on my chip today I noticed that there seems to be a problem with changing targets on the sensor array and getting the outputs via wirelink. This is the code I am talking about:
Code:
--@name Test --@author SuperPlayer wire.createInputs( {"IN"}, {"ENTITY"} ) Sensor = {} Sensor.Entity = find.byClass("sensor_array",function( Ent ) return Ent:owner() == ents.owner() end )[1] Sensor.Wirelink = Sensor.Entity:getWirelink() hook.add( "input", "hookname", function( input, value ) Sensor.Wirelink["Target"] = value printStuff(value) end ) function printStuff(E) print(E:class()) for k,v in pairs(getStatus(E)) do print(k,v) end end function getStatus(Ent) if Ent:class() == "player" then return {Health = Ent:health(), Armor = Ent:armor()} elseif Ent:class() == "ship_core" then return {Hull = Ent:entHealth(), MaxHull = Ent:entMaxHealth(),Plating = Ent:platingStrength(), Shield = Ent:getShield():getTotalCharge(),MaxShield = Ent:getShield():getMaxCharge()} elseif Ent:class():find("box_") then return {Hull = Ent:entHealth(), MaxHull = Ent:entMaxHealth()} elseif Ent:class():find("st_shuttle_") or Ent:class() == "sci_fi_shuttle" then return {Hull = Sensor.Wirelink["Health"]or 0, MaxHull = Sensor.Wirelink["Max Health"]or 0, Shield = Sensor.Wirelink["Shields"]or 0, Armour = Sensor.Wirelink["Armour"]or 0} else return {Health = Ent:entHealth()} end end
When changing the inputs the following gets printed
Code:
st_shuttle_type11 Shield 0 Armour 0 MaxHull 0 Hull 0 -------------------------------------- sci_fi_shuttle Shield 100 Armour 200000 MaxHull 10000 Hull 10000 -------------------------------------- ship_core Hull 410 MaxShield 60000 Plating 0 MaxHull 410 Shield 0 -------------------------------------- st_shuttle_type11 Shield 0 Armour 0 MaxHull 410 Hull 410 --------------------------------------
As you can see there seems to be an error what the sensor array returns. It looks like some previous values dont get overidden or something. Also when changing to a ship_core or borg cube everything works fine.
But when changing to a shuttle the problem occurs. Ano figured out that if you delay printStuff(value) by 1 second everything works. Now my question is if that is intentional or a bug?

Also while we are on it, could you explain how to use
Code:
profiler.push("TargetStuff")
and
Code:
profiler.pop("TargetStuff")
properly? Because I always run into "Tried to pop too much".

Thanks,
SuperPlayer

[Image: banner_sgmgnlsa1.png]
Stargate Modding Group
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Sensor wirelink delay? - by SuperPlayer - 13-12-2017, 12:05 AM
RE: Sensor wirelink delay? - by Red The Blue Color - 13-12-2017, 05:53 AM
RE: Sensor wirelink delay? - by Person8880 - 13-12-2017, 10:45 AM
RE: Sensor wirelink delay? - by Kosmos - 13-12-2017, 05:17 PM
RE: Sensor wirelink delay? - by SuperPlayer - 13-12-2017, 06:41 PM
RE: Sensor wirelink delay? - by Person8880 - 13-12-2017, 06:51 PM
RE: Sensor wirelink delay? - by SuperPlayer - 13-12-2017, 07:58 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.