Skip to content

Commit

Permalink
rotate laptop
Browse files Browse the repository at this point in the history
  • Loading branch information
xhankaishi committed Apr 22, 2024
1 parent c8ee3ba commit 2d0ccfb
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 5 deletions.
3 changes: 1 addition & 2 deletions code/_onclick/click.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,14 @@
/*
Control+Alt click
*/

/mob/proc/CtrlAltClickOn(atom/A)
if(A.CtrlAltClick(src))
return
pointed(A)

/atom/proc/CtrlAltClick(mob/user)
return


/*
Rclick.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
icon_state = null
center_of_mass = null // No pixelshifting by placing on tables, etc.
randpixel = 0 // And no random pixelshifting on-creation either.
var/icon_state_unpowered = null // Icon state when the computer is turned off
/*var/icon_state_unpowered = null // Icon state when the computer is turned off
var/icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
var/icon_state_screensaver = "standby"
var/max_hardware_size = 0 // Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/light_strength = 0 // Intensity of light this computer emits. Comparable to numbers light fixtures use.
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/list/idle_threads = list() */ // Idle programs on background. They still receive process calls but can't be interacted with.

// Damage of the chassis. If the chassis takes too much damage it will break apart.
var/damage = 0 // Current damage level
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
/obj/item/modular_computer/laptop
anchored = TRUE
name = "laptop computer"
Expand Down Expand Up @@ -43,3 +44,4 @@
/obj/item/modular_computer/laptop/preset
anchored = FALSE
screen_on = FALSE
*/
Binary file modified icons/obj/modular_laptop.dmi
Binary file not shown.
16 changes: 16 additions & 0 deletions mod_celadon/laptop_rotate/_laptop_rotate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/datum/modpack/laptop_rotate
/// A string name for the modpack. Used for looking up other modpacks in init.
name = "laptop_rotate"
/// A string desc for the modpack. Can be used for modpack verb list as description.
desc = "-"
/// A string with authors of this modpack.
author = "XAH"

/datum/modpack/laptop_rotate/pre_initialize()
. = ..()

/datum/modpack/laptop_rotate/initialize()
. = ..()

/datum/modpack/laptop_rotate/post_initialize()
. = ..()
4 changes: 4 additions & 0 deletions mod_celadon/laptop_rotate/_laptop_rotate.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "_laptop_rotate.dm"

#include "code/laptop_rotate.dm"

57 changes: 57 additions & 0 deletions mod_celadon/laptop_rotate/code/laptop_rotate.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/obj/item/modular_computer
var/icon_state_unpowered = null // Icon state when the computer is turned off
var/icon_state_menu = "mod_celadon/laptop_rotate/code/laptop_rotate.dmi/menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
var/icon_state_screensaver = "mod_celadon/laptop_rotate/code/laptop_rotate.dmi/standby"
var/max_hardware_size = 0 // Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/light_strength = 0 // Intensity of light this computer emits. Comparable to numbers light fixtures use.
var/list/idle_threads = list()

/obj/item/modular_computer/laptop
anchored = TRUE
name = "laptop computer"
desc = "A portable computer."
hardware_flag = PROGRAM_LAPTOP
icon_state_unpowered = "laptop-open"
icon = 'mod_celadon/laptop_rotate/code/laptop_rotate.dmi'
icon_state = "laptop-open"
icon_state_screensaver = "standby"
base_idle_power_usage = 25
base_active_power_usage = 200
max_hardware_size = 2
light_strength = 3
max_damage = 200
broken_damage = 100
w_class = ITEM_SIZE_NORMAL
var/icon_state_closed = "laptop-closed"
interact_sounds = list(SFX_KEYBOARD, SFX_KEYSTROKE)
interact_sound_volume = 20

/obj/item/modular_computer/laptop/AltClick(mob/living/carbon/user)
// We need to be close to it to open it
if((!in_range(src, user)) || user.stat || user.restrained())
return
// Prevents carrying of open laptops inhand.
// While they work inhand, i feel it'd make tablets lose some of their high-mobility advantage they have over laptops now.
if(!istype(loc, /turf/))
to_chat(usr, "\The [src] has to be on a stable surface first!")
return
anchored = !anchored
screen_on = anchored
update_icon()

/obj/item/modular_computer/laptop/update_icon()
if(anchored)
..()
else
cut_overlays()
set_light(0) // No glow from closed laptops
compile_overlays()
icon_state = icon_state_closed

/obj/item/modular_computer/laptop/preset
anchored = FALSE
screen_on = FALSE

/obj/item/modular_computer/laptop/CtrlAltClick(mob/user)
src.set_dir(turn(src.dir, -90))
Binary file added mod_celadon/laptop_rotate/code/laptop_rotate.dmi
Binary file not shown.
2 changes: 1 addition & 1 deletion mod_celadon/mod_celadon.dme
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "_components/__components.dme"
#include "outfits/_outfits.dme"
#include "human_examine/_human_examine.dme"

#include "laptop_rotate/_laptop_rotate.dme"
// --- ICONS --- //

// --- OBJECTS --- //
Expand Down

0 comments on commit 2d0ccfb

Please sign in to comment.