Skip to content

Commit

Permalink
Новое дерево технологий (#13287)
Browse files Browse the repository at this point in the history
* Basic hud upgrades functionality

* Added override button icon states

* Bassic toggle functionality

* Added other functionality for advanced HUD

* Added HUD design, advanced thermals replaces other buttons

* Special tech tree is now unshown by default

* Upgrading huds now in separate proc. Deleted not working properly code that replaces action buttons

* fix item action removal

* Added new icons, sprites and rebalanced designes

* Added disk with starting technology on derelict

* Fixed sprites on character

* Changed one of the derelicts with disk

* Probably fix for codelinter

* Super mega fix for codelinter

* Fixed world sprites

* Added new sprites for upgrade circuits

* Update code/modules/item_upgrades/item_upgrade.dm

Co-authored-by: Chip11-n <[email protected]>

* Added sound for uploading

* Added sound to all disks

* mob remove

* fix for mob remove

* fix conflict merge

* fix conflict

* Refactored mode change due to NinjaPikachushka desicion

* Added special operation tech branch

* Added disk with tech on 2 maps

* Update code/modules/item_upgrades/item_upgrade.dm

Co-authored-by: KIBORG04 <[email protected]>

* Update code/modules/item_upgrades/item_upgrade.dm

Co-authored-by: KIBORG04 <[email protected]>

* Update code/modules/item_upgrades/item_upgrade.dm

Co-authored-by: KIBORG04 <[email protected]>

* Update code/modules/item_upgrades/item_upgrade.dm

Co-authored-by: KIBORG04 <[email protected]>

* Review fixes

* Makes everything beautiful

* Beautiful fix

* 234

* Some fixes

fixed functionality, made color filter switch reactive

* Fix boots design

---------

Co-authored-by: AirBlack <[email protected]>
Co-authored-by: Chip11-n <[email protected]>
Co-authored-by: KatoMarika <[email protected]>
Co-authored-by: KIBORG04 <[email protected]>
  • Loading branch information
5 people authored Oct 4, 2024
1 parent d7e3ef0 commit f755cae
Show file tree
Hide file tree
Showing 19 changed files with 577 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/__DEFINES/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define RESEARCH_BLUESPACE "bluespace"
#define RESEARCH_ROBOTICS "robotics"
#define RESEARCH_ILLEGAL "illegal"
#define RESEARCH_SPECIAL "special"

// Is used in calculating reliability increase per prototype created.
#define RND_RELIABILITY_EXPONENT 0.75
Expand Down
6 changes: 5 additions & 1 deletion code/_onclick/hud/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
var/button_icon = 'icons/hud/actions.dmi'
var/button_icon_state = "default"
var/background_icon_state = "bg_default"
var/icon/button_overlay_icon = null
var/button_overlay_state = null
var/transparent_when_unavailable = TRUE
var/mob/owner
var/toggleable = FALSE
Expand Down Expand Up @@ -191,7 +193,9 @@

cut_overlays()
var/image/img
if(owner.action_type == AB_ITEM && owner.target)
if(owner.button_overlay_icon && owner.button_overlay_state)
img = image(owner.button_overlay_icon, owner.button_overlay_state)
else if(owner.action_type == AB_ITEM && owner.target)
var/obj/item/I = owner.target
img = image(I.icon, src , I.icon_state)
else if(owner.button_icon && owner.button_icon_state)
Expand Down
11 changes: 11 additions & 0 deletions code/game/objects/items/weapons/disks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@
m_amt = 30
g_amt = 10
var/datum/tech/stored
var/datum/technology/stored_technology

/obj/item/weapon/disk/tech_disk/hud
name = "HUD tech disk"
desc = "That disk contains design of basic HUD upgrade and advanced HUD blueprint"
stored_technology = new /datum/technology/tier1_hud_upgrade()

/obj/item/weapon/disk/tech_disk/spec_ops
name = "Spec Ops tech disk"
desc = "That disc contains designs and blueprints of Special Operation Forces equipment and ammunition"
stored_technology = new /datum/technology/healer_gun

/obj/item/weapon/disk/tech_disk/atom_init()
var/diskcolor = pick(0,1,2,3,4,5,6,7,8)
Expand Down
58 changes: 58 additions & 0 deletions code/modules/clothing/glasses/glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,61 @@
return
active = !active
to_chat(usr, "<span class='notice'>You toggle the Noire Mode [active ? "on. Let the investigation begin." : "off."]</span>")

/datum/glasses_mode_type_state

/datum/glasses_mode_type_state/proc/change_state(obj/item/clothing/glasses/glasses, state)
if(state)
on(glasses)
else
off(glasses)

/datum/glasses_mode_type_state/proc/on(obj/item/clothing/glasses/glasses)
return

/datum/glasses_mode_type_state/proc/off(obj/item/clothing/glasses/glasses)
return

/datum/glasses_mode_type_state/thermal
var/sightglassesmod = "thermal"

/datum/glasses_mode_type_state/thermal/sepia
sightglassesmod = "sepia"

/datum/glasses_mode_type_state/thermal/on(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
glasses.sightglassesmod = sightglassesmod
glasses.vision_flags = SEE_MOBS

/datum/glasses_mode_type_state/thermal/off(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = null
glasses.sightglassesmod = null
glasses.vision_flags = 0

/datum/glasses_mode_type_state/night
var/sightglassesmod = "night"

/datum/glasses_mode_type_state/night/nightsight
sightglassesmod = "nightsight"

/datum/glasses_mode_type_state/night/on(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
glasses.sightglassesmod = sightglassesmod
glasses.darkness_view = 7

/datum/glasses_mode_type_state/night/off(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = null
glasses.sightglassesmod = null
glasses.darkness_view = 0

/datum/glasses_mode_type_state/thermal_advanced

/datum/glasses_mode_type_state/thermal_advanced/on(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
glasses.darkness_view = 7
glasses.vision_flags = SEE_MOBS

/datum/glasses_mode_type_state/thermal_advanced/off(obj/item/clothing/glasses/glasses)
glasses.lighting_alpha = null
glasses.darkness_view = 0
glasses.vision_flags = 0
205 changes: 205 additions & 0 deletions code/modules/item_upgrades/item_upgrade.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#define HUD_UPGRADE_MEDSCAN 1
#define HUD_UPGRADE_NIGHTVISION 2
#define HUD_UPGRADE_THERMAL 3
#define HUD_UPGRADE_THERMAL_ADVANCED 4

#define HUD_TOGGLEABLE_MODE_NIGHTVISION "night"
#define HUD_TOGGLEABLE_MODE_THERMAL "thermal"
#define HUD_TOGGLEABLE_MODE_THERMAL_ADVANCED "thermal_adv"

/obj/item/clothing/glasses/sunglasses/hud/advanced
name = "Advanced HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and health status."
icon = 'icons/obj/clothing/goggles.dmi'
item_state = "sechud"
item_state_inventory = "sechud"
item_state_world = "sechud_w"
body_parts_covered = EYES
hud_types = list(DATA_HUD_SECURITY)
item_action_types = list()
var/upgrade_tier = 0
var/current_mode = null
var/static/list/glasses_states = list(
HUD_TOGGLEABLE_MODE_NIGHTVISION = new /datum/glasses_mode_type_state/night/nightsight,
HUD_TOGGLEABLE_MODE_THERMAL = new /datum/glasses_mode_type_state/thermal/sepia,
HUD_TOGGLEABLE_MODE_THERMAL_ADVANCED = new /datum/glasses_mode_type_state/thermal_advanced,
)

/obj/item/clothing/glasses/sunglasses/hud/advanced/atom_init()
. = ..()
RegisterSignal(src, COMSIG_ITEM_DROPPED, PROC_REF(handle_drop))

/obj/item/clothing/glasses/sunglasses/hud/advanced/equipped(mob/user, slot)
. = ..()
if(slot != SLOT_GLASSES)
return
apply_effects(current_mode, TRUE)

/obj/item/clothing/glasses/sunglasses/hud/advanced/proc/handle_drop(source, mob/living/carbon/human/user)
if(!istype(user) || user.glasses)
return
apply_effects(current_mode, FALSE)

/obj/item/clothing/glasses/sunglasses/hud/advanced/proc/apply_effects(mode_type, enable)
if(!ishuman(glasses_user))
return
if(mode_type == null)
return
var/datum/glasses_mode_type_state/state = glasses_states[mode_type]
state.change_state(src, enable)
playsound(src, activation_sound, VOL_EFFECTS_MASTER, 10, FALSE)
glasses_user.update_sight()
update_item_actions()


/obj/item/clothing/glasses/sunglasses/hud/advanced/proc/switch_mode(mode_type)
if(current_mode)
apply_effects(current_mode, FALSE)
if(current_mode == mode_type)
current_mode = null
return

apply_effects(mode_type, TRUE)
current_mode = mode_type

/obj/item/clothing/glasses/sunglasses/hud/advanced/proc/upgrade_hud(obj/item/hud_upgrade/hud_upgrader, mob/living/user)
hud_upgrader.upgrade_hud(src, user)
upgrade_tier = hud_upgrader.tier
update_world_icon()
add_item_actions(user)

/obj/item/clothing/glasses/sunglasses/hud/advanced/attackby(obj/item/W, mob/living/user)
if(istype(W, /obj/item/hud_upgrade))
var/obj/item/hud_upgrade/hud_upgrade = W
if(upgrade_tier >= hud_upgrade.tier)
to_chat(user, "<span class='notice'>You've already installed that upgrade</span>")
return
if(upgrade_tier < hud_upgrade.tier - 1)
to_chat(user, "<span class='alert'>You have to install previous upgrades</span>")
return
if(!user.is_in_hands(src))
to_chat(user, "<span class='alert'>You have to hold huds in hands to upgrade it</span>")
return
upgrade_hud(hud_upgrade, user)
add_item_actions(user)
qdel(hud_upgrade)
else if(istype(W, /obj/item/device/hud_calibrator))
var/obj/item/device/hud_calibrator = W
to_chat(user, "<span class='alert'>You try to recalibrate huds, but nothing happens</span>")
qdel(hud_calibrator)
return
return ..()

/obj/item/hud_upgrade
icon = 'icons/obj/item_upgrades.dmi'
var/tier = 0
var/glasses_item_state
var/glasses_item_state_inventory
var/glasses_item_state_world

/obj/item/hud_upgrade/proc/upgrade_hud(obj/item/clothing/glasses/sunglasses/hud/advanced/glasses, mob/living/user)
if(glasses_item_state)
glasses.item_state = glasses_item_state
if(glasses_item_state_inventory)
glasses.item_state_inventory = glasses_item_state_inventory
if(glasses_item_state_world)
glasses.item_state_world = glasses_item_state_world

/obj/item/hud_upgrade/medscan
name = "Damage Scan Upgrade"
desc = "Allows HUD to show damage on person."
item_state_inventory = "medscan"
item_state_world = "medscan_w"
glasses_item_state = "mixhud"
glasses_item_state_inventory = "mixhud"
glasses_item_state_world = "mixhud_w"
tier = HUD_UPGRADE_MEDSCAN

/obj/item/hud_upgrade/medscan/upgrade_hud(obj/item/clothing/glasses/sunglasses/hud/advanced/glasses, mob/living/user)
..()
glasses.hud_types.Add(DATA_HUD_MEDICAL_ADV)
glasses.def_hud_types.Add(DATA_HUD_MEDICAL_ADV)

/obj/item/hud_upgrade/night
name = "Basic Nightvision HUD upgrade"
desc = "Allows HUD to turn a basic nightvision mode. Can be installed only after damage scan upgrade"
item_state_inventory = "nightvision"
item_state_world = "nightvision_w"
glasses_item_state = "nvghud"
glasses_item_state_inventory = "nvghud"
glasses_item_state_world = "nvghud_w"
tier = HUD_UPGRADE_NIGHTVISION

/obj/item/hud_upgrade/night/upgrade_hud(obj/item/clothing/glasses/sunglasses/hud/advanced/glasses, mob/living/user)
..()
glasses.item_actions.Add(new /datum/action/item_action/hands_free/switch_hud_modes/night(glasses))

/obj/item/hud_upgrade/thermal
name = "Thermal HUD upgrade"
desc = "Allows HUD to turn a basic thermal mode, makes nightvision mode more comfortable for use. Can be installed only after basic nightvision upgrade"
item_state_inventory = "thermal"
item_state_world = "thermal_w"
glasses_item_state = "thermalhud"
glasses_item_state_inventory = "thermalhud"
glasses_item_state_world = "thermalhud_w"
tier = HUD_UPGRADE_THERMAL

/obj/item/hud_upgrade/thermal/upgrade_hud(obj/item/clothing/glasses/sunglasses/hud/advanced/glasses, mob/living/user)
..()
glasses.item_actions.Add(new /datum/action/item_action/hands_free/switch_hud_modes/thermal(glasses))

/obj/item/hud_upgrade/thermal_advanced
name = "Advanced Thermal HUD upgrade"
desc = "Makes thermal mode comfortable and combines it with nightvision mode. Can be installed only after thermal upgrade"
item_state_inventory = "thermaladv"
item_state_world = "thermaladv_w"
glasses_item_state = "thermalhudadv"
glasses_item_state_inventory = "thermalhudadv"
glasses_item_state_world = "thermalhudadv_w"
tier = HUD_UPGRADE_THERMAL_ADVANCED

/obj/item/hud_upgrade/thermal_advanced/upgrade_hud(obj/item/clothing/glasses/sunglasses/hud/advanced/glasses, mob/living/user)
..()
for(var/datum/action/item_action/hands_free/switch_hud_modes/night/night_action in glasses.item_actions)
night_action.Remove(user)
glasses.item_actions.Remove(night_action)
for(var/datum/action/item_action/hands_free/switch_hud_modes/thermal/thermal_action in glasses.item_actions)
thermal_action.Remove(user)
glasses.item_actions.Remove(thermal_action)
glasses.item_actions.Add(new /datum/action/item_action/hands_free/switch_hud_modes/thermal_advanced(glasses))


/datum/action/item_action/hands_free/switch_hud_modes
name = "Switch Mode"
button_overlay_icon = 'icons/obj/clothing/goggles.dmi'
var/hud_mode

/datum/action/item_action/hands_free/switch_hud_modes/Activate()
var/obj/item/clothing/glasses/sunglasses/hud/advanced/hud = target
if(!hud_mode || !istype(hud))
return

hud.switch_mode(hud_mode)

/datum/action/item_action/hands_free/switch_hud_modes/night
name = "Toggle Nightvision"
button_overlay_state = "nvghud"
hud_mode = HUD_TOGGLEABLE_MODE_NIGHTVISION

/datum/action/item_action/hands_free/switch_hud_modes/thermal //only thermal
name = "Toggle thermal"
button_overlay_state = "thermalhud"
hud_mode = HUD_TOGGLEABLE_MODE_THERMAL

/datum/action/item_action/hands_free/switch_hud_modes/thermal_advanced //mixed thermal and nightvision
name = "Toggle Advanced Thermal"
button_overlay_state = "thermalhudadv"
hud_mode = HUD_TOGGLEABLE_MODE_THERMAL_ADVANCED

#undef HUD_UPGRADE_MEDSCAN
#undef HUD_UPGRADE_NIGHTVISION
#undef HUD_UPGRADE_THERMAL
#undef HUD_UPGRADE_THERMAL_ADVANCED
#undef HUD_TOGGLEABLE_MODE_NIGHTVISION
#undef HUD_TOGGLEABLE_MODE_THERMAL
#undef HUD_TOGGLEABLE_MODE_THERMAL_ADVANCED
Loading

0 comments on commit f755cae

Please sign in to comment.