Working on a plugin that relies a lot on various entities and relationships between them, so I need to be able to visualize it to make sure it works as intended.
I'm pretty new to plugin development - anyone know how I can utilize the arrows/spheres/boxes etc. that I keep seeing?
Solved Debug graphics?
Discussion in 'Rust Development' started by rotten, Aug 22, 2017.
-
ddraw.text, ddraw.sphere, ddraw.arrow, ddraw.box
All of which are console commands. So you’d need to send the debug client those commands with valid arguments. Decompile some dlls or look into AdminRadar for examples of arguments of the commands.
For a non auth 2 player to see the debug graphics you’d need to temporarily grant them the admin flag. You can see how you can do that in AdminRadar also. -
Code:
void OnOvenToggle(BaseOven oven, BasePlayer player) { List<BuildingBlock> warmFoundations = new List<BuildingBlock>(); List<BuildingBlock> campfireFoundations = new List<BuildingBlock>(); Puts(oven.IsOn().ToString()); RaycastHit hit; Vector3 raycastPosition = new Vector3(oven.GetEstimatedWorldPosition().x, oven.GetEstimatedWorldPosition().y+0.1f, oven.GetEstimatedWorldPosition().z); if (Physics.Raycast(raycastPosition, -Vector3.up, out hit)) Puts("Found an object! Object: " +hit.GetEntity()+" - distance: " + hit.distance); BuildingBlock supportingBlock = hit.GetEntity() as BuildingBlock; if (supportingBlock != null) { campfireFoundations = findFoundations(supportingBlock); } foreach (BuildingBlock foundation in campfireFoundations) { //global::Effect.server.Run("assets/prefabs/misc/orebonus/effects/bonus_finish.prefab", foundation.GetEstimatedWorldPosition()); player.SendConsoleCommand("ddraw.sphere", 15, Color.yellow, foundation.GetEstimatedWorldPosition(), 1f); } }
Any idea what could be wrong here? I tried doing it the way you described, but it doesn't draw the spheres in question. I'm auth level 2. -
-
-
Are you sure that the player.SendConsoleCommand is running? Maybe try debugging that foreach(as in a PrintWarning or whatever)
-
-
Code:
public void CreateSphere(Vector3 position, float distance, float speed, float duration){ BaseEntity sphere; Vector3 pos = new Vector3(0, 0, 0); Quaternion rot = new Quaternion(); string strPrefab = "assets/prefabs/visualization/sphere.prefab"; sphere = GameManager.server.CreateEntity(strPrefab, pos, rot, true); SphereEntity ball = sphere.GetComponent<SphereEntity>(); ball.currentRadius = 1f; ball.lerpRadius = 2.0f*distance; ball.lerpSpeed = speed; sphere.SetParent(entity, ""); sphere?.Spawn(); timer.Once(duration, () => { if(sphere == null) return; sphere.Kill(BaseNetworkable.DestroyMode.None); }); }
-
[DOUBLEPOST=1503371424][/DOUBLEPOST] -
-
-
Everything but ddraw.text has been broken for a week or so, maybe longer.
If you want to make the spheres more opaque/dark, spawn multiple on top of each other. -