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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Lockenening Overhaul Implementation Fixering Extravaganza Creationism Finishism V3: For fuckin real edition #2399

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#define IGNORE_DIGITIGRADE (1<<18)
/// Has contextual screentips when HOVERING OVER OTHER objects
#define ITEM_HAS_CONTEXTUAL_SCREENTIPS (1 << 19)
#define LOCKING_ITEM (1<<20) // MOJAVE CHANGE - Locks - For lock general interactions
#define KEY_ITEM (1<<21) // MOJAVE CHANGE - Keys - For key general interactions

// Flags for the clothing_flags var on /obj/item/clothing

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
return
if(try_safety_unlock(user))
return
return try_to_activate_door(user)
//return try_to_activate_door(user) MOJAVE SUN EDIT - Door Tweaks


/obj/machinery/door/attack_tk(mob/user)
Expand Down Expand Up @@ -271,7 +271,7 @@
else if((!(I.item_flags & NOBLUDGEON) && !user.combat_mode) && try_to_activate_door(user))
return TRUE
*/// MOJAVE SUN EDIT END - Bad Door Code
return ..()
return . = ..()

/obj/machinery/door/attackby_secondary(obj/item/weapon, mob/user, params)
if (weapon.tool_behaviour == TOOL_WELDER)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/clothing/spacesuits/_spacesuits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@
/obj/item/clothing/suit/space/AltClick(mob/living/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return ..()
toggle_spacesuit_cell(user)
. = ..()
//toggle_spacesuit_cell(user) MOJAVE SUN EDIT - No I dont think so

/// Remove the cell whent he cover is open on CTRL+Click
/obj/item/clothing/suit/space/CtrlClick(mob/living/user)
Expand Down
1 change: 1 addition & 0 deletions mojave/__DEFINES/do_afters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DOAFTER_SOURCE_FISHING "doafter_fishing"
#define DOAFTER_SOURCE_BREAKICE "doafter_breakice"
#define DOAFTER_SOURCE_DOORS "doafter_doors"
#define DOAFTER_SOURCE_LOCKS "doafter_doors"
#define DOAFTER_SOURCE_TELESCOPICROD "doafter_telescopicrod"
#define DOAFTER_SOURCE_CRATEOPEN "doafter_crateopen"
#define DOAFTER_SOURCE_CHOPTREE "doafter_choptree"
Expand Down
3 changes: 3 additions & 0 deletions mojave/__DEFINES/tools.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Defines for tools

#define TOOL_FISHINGROD "fishingrod"
#define TOOL_PLIERS "pliers"
#define TOOL_RULER "ruler"
#define TOOL_LENS "lens"
5 changes: 3 additions & 2 deletions mojave/code/_DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
//To be used with the ms13_flags_1 variable; kinda equivalent to the TG flags_1
//WILL NOT WORK OUTSIDE OF THE /mojave folder

// For objects able to be locked, slap this on and it should work, preventing you from interacting
#define LOCKABLE_1 (1<<0)
#define LOCKABLE_1 (1<<0) // For objects able to be locked, slap this on and it should work, preventing you from interacting
#define LOCKING_ITEM (1<<1) // Locks - For lock general interactions
#define KEY_ITEM (1<<2) // Keys - For key general interactions
88 changes: 73 additions & 15 deletions mojave/code/modules/clothing/spacesuits/power_armor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,74 @@
return TRUE

/obj/item/clothing/suit/space/hardsuit/ms13/power_armor/attackby(obj/item/I, mob/user, params)
if(I.item_flags & LOCKING_ITEM && ms13_flags_1 & LOCKABLE_1)
if(I.ms13_flags_1 & KEY_ITEM && lock) //gotta add it here cause clothing code is FUCKED on attackbys, never shouldve made this shit a hardsuit fellas
var/obj/item/ms13/key/key = I
//alignment checks
if(key.bitt_1 != lock.pin_1)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(key.bitt_2 != lock.pin_2)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(key.bitt_3 != lock.pin_3)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(key.bitt_4 != lock.pin_4)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(key.bitt_5 != lock.pin_5)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(key.bitt_6 != lock.pin_6)
playsound(src, 'mojave/sound/ms13effects/lockpicking/lockpick_tension_11.ogg', 50, TRUE)
to_chat(user, span_notice("The key dosen't turn in [name]."))
return
if(!lock.item_lock_locked)
playsound(src, 'mojave/sound/ms13effects/key_lock.ogg', 50, TRUE)
to_chat(user, span_notice("You lock the [name]."))
lock.item_lock_locked = TRUE
return
if(lock.item_lock_locked)
playsound(src, 'mojave/sound/ms13effects/key_unlock.ogg', 50, TRUE)
to_chat(user, span_notice("You unlock the [name]."))
lock.item_lock_locked = FALSE
return
//lock interactions
if(I.ms13_flags_1 & LOCKING_ITEM && ms13_flags_1 & LOCKABLE_1)
var/obj/item/ms13/lock/potential_lock = I
if(lock_locked)
to_chat(user, span_warning("The [name] already has a lock."))
return
if(!can_be_picked)
if(potential_lock.item_lock_locked)
to_chat(user, span_notice("The [name] is locked."))
playsound(src, 'mojave/sound/ms13effects/door_locked.ogg', 20, TRUE)
return
var/obj/item/ms13/lock/L = I
if(!L.lock_open)
to_chat(user, span_warning("The [name] is closed."))
if(!potential_lock.lock_open)
to_chat(user, span_warning("The [lock.name] is shut, open it!"))
return
if(!user.transferItemToLoc(L, src))
return
lock = I
to_chat(user, span_notice("You attach the [lock.name] to the [name]."))
update_appearance()
return
if(!potential_lock.item_lock_locked && potential_lock.lock_open)
if(!do_after(user, 0.5 SECONDS, src))
return
if(!user.transferItemToLoc(potential_lock, src))
return
lock = potential_lock
can_be_picked = TRUE
lock.item_lock_locked = TRUE
lock.lock_open = FALSE
lock_locked = TRUE
lock.moveToNullspace()
AddComponent(/datum/component/lockpickable, difficulty = lock.lock_difficulty)
for(var/datum/component/storage/storage as anything in GetComponents(/datum/component/storage))
storage.locked = TRUE //locks
playsound(src, 'mojave/sound/ms13effects/lock_close.ogg', 50, TRUE)
to_chat(user, span_notice("You attach the [lock.name] to the [name] and clasp it shut."))
user.visible_message("<span class='notice'[user.name] attaches the [lock.name] to the [name].")
update_appearance()
else if(I.tool_behaviour == TOOL_CROWBAR)
toggle_spacesuit_cell(user)
return
Expand Down Expand Up @@ -545,10 +597,6 @@

//Let's get into the power armor (or not)
/obj/item/clothing/suit/space/hardsuit/ms13/power_armor/AltClick(mob/living/carbon/human/user)
if(ms13_flags_1 & LOCKABLE_1 && lock_locked)
to_chat(user, span_warning("The [name] is locked."))
playsound(src, 'mojave/sound/ms13effects/door_locked.ogg', 50, TRUE)
return
if(!istype(user))
return FALSE
else
Expand All @@ -559,6 +607,16 @@
return TRUE
return FALSE

if(ms13_flags_1 & LOCKABLE_1 && lock_locked)
if(lock && lock.item_lock_locked) //putting this here cause this code is weird and shartoid
to_chat(user, span_warning("The [name] is locked."))
playsound(src, 'mojave/sound/ms13effects/door_locked.ogg', 50, TRUE)
return
if(!lock) //for pre-spawn locked things
to_chat(user, span_warning("The [name] is locked."))
playsound(src, 'mojave/sound/ms13effects/door_locked.ogg', 50, TRUE)
return

if(!CheckEquippedClothing(user) || get_dist(user, src) > 1 || link_to)
return FALSE
if(user.fatness == FATNESS_OBESE)
Expand Down
40 changes: 40 additions & 0 deletions mojave/code/modules/locks/keys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,52 @@
icon_state = "brass"
lefthand_file = 'mojave/icons/mob/inhands/items_lefthand.dmi'
righthand_file = 'mojave/icons/mob/inhands/items_righthand.dmi'
inhand_icon_state = "brass_key"
worn_icon = 'mojave/icons/mob/worn_melee.dmi'
worn_icon_state = "empty_placeholder"
w_class = WEIGHT_CLASS_SMALL
ms13_flags_1 = KEY_ITEM
obj_flags = UNIQUE_RENAME | UNIQUE_RENAME_NO_DESCRIPTION //so you can keep track of yo keys
grid_width = 32
grid_height = 32
drop_sound = 'mojave/sound/ms13effects/keydrop.ogg'
pickup_sound = 'mojave/sound/ms13effects/keygrab.ogg'
//Custom key shape for corresponding with the identical lock type pins
//Bitts seperated into sloppy seperates so players can edit them and interaction with keys
var/bitt_amount = 6
var/bitt_1
var/bitt_2
var/bitt_3
var/bitt_4
var/bitt_5
var/bitt_6

/obj/item/ms13/key/Initialize()
. = ..()
AddElement(/datum/element/world_icon, null, icon, 'mojave/icons/objects/tools/keys_inventory.dmi')
generate_key_order()

/obj/item/ms13/key/proc/generate_key_order()
var/static/list/bitting_levels = list("A","B","C","D","E","F")
if(bitt_amount == 6)
bitt_1 = pick(bitting_levels)
bitt_2 = pick(bitting_levels)
bitt_3 = pick(bitting_levels)
bitt_4 = pick(bitting_levels)
bitt_5 = pick(bitting_levels)
bitt_6 = pick(bitting_levels)
if(bitt_amount == 4)
bitt_1 = pick(bitting_levels)
bitt_2 = pick(bitting_levels)
bitt_3 = pick(bitting_levels)
bitt_4 = pick(bitting_levels)

/obj/item/ms13/key/test

/obj/item/ms13/key/test/generate_key_order()
bitt_1 = "A"
bitt_2 = "A"
bitt_3 = "A"
bitt_4 = "A"
bitt_5 = "A"
bitt_6 = "A"
Empty file.
12 changes: 12 additions & 0 deletions mojave/code/modules/locks/keys/key_types.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/obj/item/ms13/key/brass
name = "brass key"
desc = "A simple brass key, dont lose it."
icon_state = "brass"
inhand_icon_state = "brass_key"

/obj/item/ms13/key/scrap
name = "makeshift key"
desc = "A crude piece of metal with a jagged protusion, looks like a key."
icon_state = "scrap"
inhand_icon_state = "scrap_key"
bitt_amount = 4
Empty file.
30 changes: 30 additions & 0 deletions mojave/code/modules/locks/lock/lock_types.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/obj/item/ms13/lock/scrap
name = "makeshift lock"
desc = "A crude and makeshift scrap lock, enough to keep people out of your stuff."
icon_state = "scrap"
inhand_icon_state = "scrap_lock"
lock_difficulty = 12
pin_amount = 4

/obj/item/ms13/lock/scrap/unlocked
pre_locked = FALSE

/obj/item/ms13/lock/brass
name = "brass lock"
desc = "A refined and intricate brass lock, keeps people out."
icon_state = "brass"
inhand_icon_state = "brass_lock"
lock_difficulty = 3

/obj/item/ms13/lock/brass/unlocked
pre_locked = FALSE

/obj/item/ms13/lock/advanced
name = "advanced lock"
desc = "A high tech and experimental piece of locking technology, impervious to lockpicking."
icon_state = "advanced"
inhand_icon_state = "advanced_lock"
can_be_lockpicked = FALSE

/obj/item/ms13/lock/advanced/unlocked
pre_locked = FALSE
Loading
Loading