[Somewhat New Mod] Utility Items Pack

Post about your finished mods here.
cybersoul
Anarchist
Anarchist
Posts: 3
Joined: Sun Dec 01, 2013 7:25 am

Hello,

I was trying to get this to work stand-alone in 1.1, in the "All Loot" mode. However, I ran into to 2 problems. One, the orbit autopilot code wanted an RPCFindAngle function that I found in Dynamic Systems, but not in this mod. Second, the "all loot" mode would fail and start to spam the screen on wrecks that just had damaged equipment. This is easy to reproduce in Eridani with wrecked Centauri.

This was the patch I used to get it working:

Code: Select all

--- "Utility Items/UtilityItems.xml"    2013-06-09 22:34:38.000000000 -0700
+++ ../UtilityItems.xml 2013-11-30 23:20:24.244011059 -0800
@@ -28,6 +28,22 @@
                                (item list 4)
                        )
                ))
+        (setq RPCFindAngle (lambda (Object1 Object2)
+            (block (Lobject1 Lobject2)
+                (if
+                    (gr (ObjGetDistance Object1 Nil) (ObjGetDistance Object2 Nil))
+                        (block Nil
+                            (setq greater Object1)
+                            (setq lesser Object2)
+                            )
+                        (block Nil
+                            (setq greater Object2)
+                            (setq lesser Object1)
+                            )
+                    )
+                (sysVectorAngle (sysVectorSubtract (ObjGetPos greater) (ObjGetPos lesser)))
+            )
+        ))
                )
 </Globals>
 
@@ -305,7 +321,7 @@
                                                                                (Not (eq wreck &stMRADSensor;))
                                                                                (Not (eq wreck &stLogBuoy;))
                                                                                (Not (eq wreck &stMajellenStargate;))
-                                                                               (gr (count (objGetItems wreck "*N")) 0)
+                                                                               (gr (count (objGetItems wreck "*")) 0)
                                                                                ;there are no docked items:
                                                                                (eq (count (staGetDockedShips wreck)) 0)
                                                                                )
@@ -318,9 +334,9 @@
                                                                                        )
                                                                                (enum (objGetItems wreck "*") Loot
                                                                                        (block (aNumber)
-                                                                                               (setq aNumber(count (objGetItems wreck "*N")))
+                                                                                               (setq aNumber (count (objGetItems wreck "*")))
                                                                                                ;(PrintTo 'log "Number itms!")
-                                                                                               ;(PrintTo 'log (count (objGetItems wreck "*N")))
+                                                                                               ;(PrintTo 'log (count (objGetItems wreck "*")))
                                                                                                ;(PrintTo 'log (ls (objGetMass wreck) (add (ObjGetData gPlayership "ThresholdMass") 0)  ))
                                                                                                (if
                                                                                                        (and
@@ -342,7 +358,7 @@
                                                                                                (if
                                                                                                        (and
                                                                                                                (eq (ObjGetData gPlayership "AutoScuttle") "on")
-                                                                                                               (eq (count (objGetItems wreck "*N")) 0)
+                                                                                                               (eq (count (objGetItems wreck "*")) 0)
                                                                                                                (ls (objGetMass wreck) (add (ObjGetData gPlayership "ThresholdMass") 0) )
                                                                                                                )
                                                                                                                (block Nil
@@ -357,13 +373,13 @@
                                                                        ;looted= say so
                                                                        (block (agreement agreement2 spaceleft)
                                                                                ;(PrintTo 'log "Number itms!")
-                                                                               ;(PrintTo 'log (count (objGetItems wreck "*N")))
+                                                                               ;(PrintTo 'log (count (objGetItems wreck "*")))
                                                                                ;(PrintTo 'log (ls (objGetMass wreck) (add (ObjGetData gPlayership "ThresholdMass") 0) ))
                                                                                (if
                                                                                        (and
                                                                                                (eq (ObjGetData gPlayership "AutoScuttle") "on")
                                                                                                (ObjIsAbandoned wreck)
-                                                                                               (eq (count (objGetItems wreck "*N")) 0)
+                                                                                               (eq (count (objGetItems wreck "*")) 0)
                                                                                                (ls (objGetMass wreck) (add (ObjGetData gPlayership "ThresholdMass") 0) )
                                                                                                (not (eq &stNavBeacon; (objGetType wreck) ))
                                                                                                (not (eq &stNavSign; (objGetType wreck) ))
@@ -1383,4 +1399,4 @@
        </StationType>
 
 
-</TranscendenceExtension>
\ No newline at end of file
+</TranscendenceExtension>
The "*N" to "*" changes do not affect looting only undamaged items, because that is a whole separate copy/pasted code path (bad RPC!)

And thanks a lot for the mod, the autopilot in particular was cool to watch!

Cheers,
CyberSoul
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Wow, that's a good catch.
I never debug/play without either my godmod/and or Dynamic systems so naturally RPCFindAngle is in both of them >.<
*edit2: Also, I think I'm still working on the orbiting code since it looks weird (and is there a need to orbit planets? Maybe if you're using Bussard Reactors...)
*edit3: Also, the orbit code won't work in the 1.2 beta because planet definitions changed (so you'll end up automatically orbiting the sun instead D:).

I think I wrote this when I was *barely* beginning to understand what I was doing so I think if I wrote this today it wouldn't be as bad (or lazy >.>)

Thanks for finding the bugs though, it's nice to know that people are playing with my mods :3

tl;dr;
Updated at 823 downloads. Thanks to cybersoul for finding really basic errors (I forgot to add RPCFindAngle and clean up some code) >.<
I also changed powerusage to 0 MW for both items :3

*edit1: I set powerusage to 0 for both items but I guess Transcendence rounds up powerusage to one?
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

I don't think Trans rounds up power use. I've made devices with negative power use before.
Yes, look at my avatar, I have a wyvera type ship.
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Updated Utility Items at 1001 downloads.
Changelog:
General:
Enabled auto install rotolooter and Autopilot upon changing ships
Rotolooter:
-doesn't scuttle Captain's Logs markers anymore
-added option to scuttle wrecks with damaged items only
-cleaned up code
Autopilot:
-added beep that notifies players they have arrived at their destination
-added list filter to autopilot (stargate only, closest first, farthest first)
-fixed orbiting planets function
-FINALLY added 'follow ship' feature
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Post Reply