-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Pod Locks #4301
Adds Pod Locks #4301
Conversation
Adds key and tumbler based pod locks Adds lock pod system Adds pod lock to sec pod Adds keys to sec pod in HoS and Pilot Offices
Atlast! Now I don't need to strip down all parts each time I have to leave my pod as a sec pod pilot. |
A word of caution, your pod can still be stolen if you forget to lock it. That being said, you can easily prevent this by locking the doors once you're inside and always closing the maint hatch when you're done swapping parts (it now locks shut along with the doors.) |
|
||
/obj/item/device/spacepod_equipment/lock/keyed/New() | ||
..() | ||
id = rand(1, 99999) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad, rare chance the numbers will clash.
add
var/static/id_source = 0
(0 because we're doing ++id_source
not id_source++
, if you do the latter swap it for a 1)
to the definition of /obj/item/device/spacepod_equipment/lock/keyed
and then replace this line with id = ++id_source
guarantees unique numerical keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I used rand() here for the ID is because real key and tumbler locks have a set number of configurations that while large, are not infinite. In other words, if you tried a key on 100000 locks and didn't find several matches, you've got yourself a miracle.
If other people think that static var sourced perfect ID numbers are the way to go, I'll certainly make the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever, but mechanically will never be used ever (outside of maybe an event, in which case the keys can still be vv'd)
(the "never used ever" is an argument for not making the fix too, as the error itself will be rare and the chance the keys will be used on the lock they erroneously match is whew, it's very slim but it's only like 20 seconds work to get unique keys so, /shrug)
Might want to describe how the locks work in a bit more detail for the code-illiterate. Also, needs a changelog. |
Added in a proper usage description and a changelog to the first post |
Noooo merge conflicts whyyyyy |
# Conflicts: # _maps/map_files/cyberiad/cyberiad.dmm
the ai sat fix means my map edits have to be redone, it's only two items though so it'll be fixed quick |
don't forget to mapmerge |
Assuming there aren't any other issues that pop up, I think this is in its final state and ready to merge once the checks and waiting period are up. |
@tigercat2000 May want to look at this; you're more familiar with the horrors of Pod code than I am. |
Well I do intend to do a refactor and full clean up after this. If you'd prefer it happen before this gets merged I could do it and add it to this PR, but that could take a fair amount of time considering that a lot of it seems cobbled together right now. This is just the first step in a larger project to get pod code and interactions up to standards. |
name = "\improper spacepod tumbler lock" | ||
desc = "A locking system to stop podjacking. This version uses a standalone key." | ||
icon_state = "pod_locator" | ||
var/static/id_source = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static isn't useful here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what should I use instead to ensure that each lock gets a unique ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/static
is required here for this method of unique id generation. (/global
also works but using that keyword is misleading)
Still need to have a few more made so I can just set equipment as a whole to use the new icon file instead of some still pulling from the goon file. Sprite Credits: Pod Key and edits: Me All the others: @FlattestGuitar
If you're going to make sprite changes, it's generally recommend you post them (unless they're minor, like a flashing light on something). |
I'll add them to the first Post quick |
This look good to you? |
|
||
// Key and Tumbler System | ||
/obj/item/device/spacepod_equipment/lock/keyed | ||
name = "\improper spacepod tumbler lock" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\improper
isn't needed since this starts with a lowercase letter.
This adds key based locks to space pods as a new system type and gives the sec pod its own lock with keys belonging to the HoS and Pod Pilot.
The locks function by using the key on the pod to toggle the state between locked and unlocked. While locked, the pod can not be entered and the hatch can not be opened, (though it can be closed); However, the pod will function normally if inside.
The Keys are printed in a blank state and must be used on the target lock prior to mounting it in a pod to grind them to fit said lock.
Also adds new sprites to some systems courtesy of @FlattestGuitar.
The sprites of each object new and old:
The top row is weapons(new)
The second row is mining equipment(unchanged)
The third row is equipment(original locator and new ore module)
The bottom row is the lock and key(new)
馃啈
rscadd: Added key and tumbler based pod locks
rscadd: Made Pod Locks and keys buildable in Pod Fabricator
rscadd: Made Pod Keys recoverable from cryo
rscadd: Added lock to Security Pod
rscadd: Added a key for Security Pod to HoS and Pod Pilot Offices
rscadd: New sprites for several pieces of pod equipment
/:cl: