Skip to content
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

Merged
merged 6 commits into from
May 6, 2016
Merged

Adds Pod Locks #4301

merged 6 commits into from
May 6, 2016

Conversation

IK3I
Copy link
Contributor

@IK3I IK3I commented Apr 27, 2016

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:
space station 13 2016-04-30 191354
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:

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
@Keilden
Copy link

Keilden commented Apr 27, 2016

Atlast! Now I don't need to strip down all parts each time I have to leave my pod as a sec pod pilot.

@IK3I
Copy link
Contributor Author

IK3I commented Apr 27, 2016

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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)

@TheDZD TheDZD added Feature This PR is a new addition to the game Balance This PR will modify how effective something is or isnt labels Apr 27, 2016
@TheDZD
Copy link
Contributor

TheDZD commented Apr 27, 2016

Might want to describe how the locks work in a bit more detail for the code-illiterate. Also, needs a changelog.

@IK3I
Copy link
Contributor Author

IK3I commented Apr 27, 2016

Added in a proper usage description and a changelog to the first post

@Spacemanspark
Copy link
Contributor

Noooo merge conflicts whyyyyy

# Conflicts:
#	_maps/map_files/cyberiad/cyberiad.dmm
@IK3I
Copy link
Contributor Author

IK3I commented Apr 27, 2016

the ai sat fix means my map edits have to be redone, it's only two items though so it'll be fixed quick
#4302

@pinatacolada
Copy link
Contributor

don't forget to mapmerge

@IK3I
Copy link
Contributor Author

IK3I commented Apr 28, 2016

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.

@Fox-McCloud
Copy link
Member

@tigercat2000 May want to look at this; you're more familiar with the horrors of Pod code than I am.

@IK3I
Copy link
Contributor Author

IK3I commented Apr 30, 2016

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
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this works

Copy link
Contributor

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
@Fox-McCloud
Copy link
Member

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).

@IK3I
Copy link
Contributor Author

IK3I commented May 1, 2016

I'll add them to the first Post quick

@Fox-McCloud
Copy link
Member

@tigercat2000 @TheDZD

This look good to you?

@TheDZD TheDZD added the Map Edit This PR will modify a map label May 4, 2016

// Key and Tumbler System
/obj/item/device/spacepod_equipment/lock/keyed
name = "\improper spacepod tumbler lock"
Copy link
Contributor

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.

@Fox-McCloud Fox-McCloud merged commit c8e94bb into ParadiseSS13:master May 6, 2016
ParadiseSS13-Bot pushed a commit that referenced this pull request May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Balance This PR will modify how effective something is or isnt Feature This PR is a new addition to the game Map Edit This PR will modify a map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants