mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
324 lines
9.5 KiB
Plaintext
324 lines
9.5 KiB
Plaintext
//Please see the comment above the main NIF definition before
|
|
//trying to call any of these procs directly.
|
|
|
|
//A single piece of NIF software
|
|
/datum/nifsoft
|
|
var/name = "Prototype"
|
|
var/desc = "Contact a dev!"
|
|
|
|
var/obj/item/device/nif/nif //The NIF that the software is stored in
|
|
|
|
var/list_pos // List position in the nifsoft list
|
|
|
|
var/cost = 1000 // Cost in cash of buying this software from a terminal
|
|
|
|
var/vended = TRUE // This is available in NIFSoft Shops at the start of the game
|
|
var/wear = 1 // The wear (+/- 10% when applied) that this causes to the NIF
|
|
var/access // What access they need to buy it, can only set one for ~reasons~
|
|
var/illegal = FALSE // If this is a black-market nifsoft (emag option)
|
|
|
|
var/active = FALSE // Whether the active mode of this implant is on
|
|
var/p_drain = 0 // Passive power drain, can be used in various ways from the software
|
|
var/a_drain = 0 // Active power drain, same purpose as above, software can treat however
|
|
var/activates = TRUE // Whether or not this has an active power consumption mode
|
|
var/tick_flags = 0 // Flags to tell when we'd like to be ticked
|
|
|
|
var/empable = TRUE // If the implant can be destroyed via EMP attack
|
|
|
|
var/expiring = FALSE // Trial software! Or self-deleting illegal ones!
|
|
var/expires_at // World.time for when they expire
|
|
|
|
var/applies_to = (NIF_ORGANIC|NIF_SYNTHETIC) // Who this software is useful for
|
|
|
|
var/vision_flags = 0 // Various flags for fast lookups that are settable on the NIF
|
|
var/health_flags = 0 // These are added as soon as the implant is activated
|
|
var/combat_flags = 0 // Otherwise use set_flag/clear_flag in one of your own procs for tricks
|
|
var/other_flags = 0
|
|
|
|
var/list/planes_enabled = null // List of vision planes this nifsoft enables when active
|
|
|
|
var/list/incompatible_with = null // List of NIFSofts that are disabled when this one is enabled
|
|
|
|
var/obj/effect/nif_stat/stat_line // The stat line in the statpanel for this NIFSoft
|
|
|
|
|
|
//Constructor accepts the NIF it's being loaded into
|
|
/datum/nifsoft/New(var/obj/item/device/nif/nif_load)
|
|
ASSERT(nif_load)
|
|
|
|
nif = nif_load
|
|
stat_line = new(src)
|
|
if(!install(nif))
|
|
qdel(src)
|
|
|
|
//Destructor cleans up the software and nif reference
|
|
/datum/nifsoft/Destroy()
|
|
if(nif)
|
|
uninstall()
|
|
nif = null
|
|
QDEL_NULL(stat_line)
|
|
return ..()
|
|
|
|
//Called when the software is installed in the NIF
|
|
/datum/nifsoft/proc/install()
|
|
return nif.install(src)
|
|
|
|
//Called when the software is removed from the NIF
|
|
/datum/nifsoft/proc/uninstall()
|
|
if(active)
|
|
deactivate()
|
|
if(nif)
|
|
. = nif.uninstall(src)
|
|
nif = null
|
|
if(!QDESTROYING(src))
|
|
qdel(src)
|
|
|
|
//Called every life() tick on a mob on active implants
|
|
/datum/nifsoft/proc/life(var/mob/living/carbon/human/human)
|
|
return TRUE
|
|
|
|
//Called when attempting to activate an implant (could be a 'pulse' activation or toggling it on)
|
|
/datum/nifsoft/proc/activate(var/force = FALSE)
|
|
if(active && !force)
|
|
return
|
|
var/nif_result = nif.activate(src)
|
|
|
|
//If the NIF was fine with it, or we're forcing it
|
|
if(nif_result || force)
|
|
active = TRUE
|
|
|
|
//If we enable vision planes
|
|
if(planes_enabled)
|
|
nif.add_plane(planes_enabled)
|
|
nif.vis_update()
|
|
|
|
//If we have other NIFsoft we need to turn off
|
|
if(incompatible_with)
|
|
nif.deactivate_these(incompatible_with)
|
|
|
|
//Set all our activation flags
|
|
nif.set_flag(vision_flags,NIF_FLAGS_VISION)
|
|
nif.set_flag(health_flags,NIF_FLAGS_HEALTH)
|
|
nif.set_flag(combat_flags,NIF_FLAGS_COMBAT)
|
|
nif.set_flag(other_flags,NIF_FLAGS_OTHER)
|
|
|
|
return nif_result
|
|
|
|
//Called when attempting to deactivate an implant
|
|
/datum/nifsoft/proc/deactivate(var/force = FALSE)
|
|
if(!active && !force)
|
|
return
|
|
var/nif_result = nif.deactivate(src)
|
|
|
|
//If the NIF was fine with it or we're forcing it
|
|
if(nif_result || force)
|
|
active = FALSE
|
|
|
|
//If we enable vision planes, disable them
|
|
if(planes_enabled)
|
|
nif.del_plane(planes_enabled)
|
|
nif.vis_update()
|
|
|
|
//Clear all our activation flags
|
|
nif.clear_flag(vision_flags,NIF_FLAGS_VISION)
|
|
nif.clear_flag(health_flags,NIF_FLAGS_HEALTH)
|
|
nif.clear_flag(combat_flags,NIF_FLAGS_COMBAT)
|
|
nif.clear_flag(other_flags,NIF_FLAGS_OTHER)
|
|
|
|
return nif_result
|
|
|
|
//Called when an implant expires
|
|
/datum/nifsoft/proc/expire()
|
|
uninstall()
|
|
return
|
|
|
|
//Called when installed from a disk
|
|
/datum/nifsoft/proc/disk_install(var/mob/living/carbon/human/target,var/mob/living/carbon/human/user)
|
|
return TRUE
|
|
|
|
//Stat-line clickable text
|
|
/datum/nifsoft/proc/stat_text()
|
|
if(activates)
|
|
return "[active ? "Active" : "Disabled"]"
|
|
|
|
return "Always On"
|
|
|
|
//////////////////////
|
|
//A package of NIF software
|
|
/datum/nifsoft/package
|
|
var/list/software = list()
|
|
wear = 0 //Packages don't cause wear themselves, the software does
|
|
|
|
//Constructor accepts a NIF and loads all the software
|
|
/datum/nifsoft/package/New(var/obj/item/device/nif/nif_load)
|
|
ASSERT(nif_load)
|
|
|
|
for(var/P in software)
|
|
new P(nif_load)
|
|
|
|
qdel(src)
|
|
|
|
//Clean self up
|
|
/datum/nifsoft/package/Destroy()
|
|
software.Cut()
|
|
software = null
|
|
return ..()
|
|
|
|
/////////////////
|
|
// A NIFSoft Disk
|
|
/obj/item/weapon/disk/nifsoft
|
|
name = "NIFSoft Disk"
|
|
desc = "It has a small label: \n\
|
|
\"Portable NIFSoft Disk. \n\
|
|
Insert directly into brain.\""
|
|
icon = 'icons/obj/cloning.dmi'
|
|
icon_state = "datadisk2"
|
|
item_state = "card-id"
|
|
w_class = ITEMSIZE_SMALL
|
|
var/datum/nifsoft/stored = null
|
|
|
|
/obj/item/weapon/disk/nifsoft/afterattack(var/A, mob/user, flag, params)
|
|
if(!in_range(user, A))
|
|
return
|
|
|
|
if(!ishuman(user) || !ishuman(A))
|
|
return
|
|
|
|
var/mob/living/carbon/human/Ht = A
|
|
var/mob/living/carbon/human/Hu = user
|
|
|
|
if(!Ht.nif || Ht.nif.stat != NIF_WORKING)
|
|
to_chat(user,"<span class='warning'>Either they don't have a NIF, or the disk can't connect.</span>")
|
|
return
|
|
|
|
var/extra = extra_params()
|
|
if(A == user)
|
|
to_chat(user,"<span class='notice'>You upload [src] into your NIF.</span>")
|
|
else
|
|
Ht.visible_message("<span class='warning'>[Hu] begins uploading [src] into [Ht]!</span>","<span class='danger'>[Hu] is uploading [src] into you!</span>")
|
|
|
|
if(A == user || do_after(Hu,10 SECONDS,Ht))
|
|
new stored(Ht.nif,extra)
|
|
qdel(src)
|
|
|
|
//So disks can pass fancier stuff.
|
|
/obj/item/weapon/disk/nifsoft/proc/extra_params()
|
|
return null
|
|
|
|
|
|
// Compliance Disk //
|
|
/obj/item/weapon/disk/nifsoft/compliance
|
|
name = "NIFSoft Disk (Compliance)"
|
|
desc = "Wow, adding laws to people? That seems illegal. It probably is. Okay, it really is."
|
|
stored = /datum/nifsoft/compliance
|
|
var/laws
|
|
|
|
/obj/item/weapon/disk/nifsoft/compliance/afterattack(var/A, mob/user, flag, params)
|
|
if(!ishuman(A))
|
|
return
|
|
if(!laws)
|
|
to_chat(user,"<span class='warning'>You haven't set any laws yet. Use the disk in-hand first.</span>")
|
|
return
|
|
..(A,user,flag,params)
|
|
|
|
/obj/item/weapon/disk/nifsoft/compliance/attack_self(mob/user)
|
|
var/newlaws = input(user,"Please Input Laws","Compliance Laws",laws) as message
|
|
newlaws = sanitize(newlaws,2048)
|
|
if(newlaws)
|
|
to_chat(user,"You set the laws to: <br><span class='notice'>[newlaws]</span>")
|
|
laws = newlaws
|
|
|
|
/obj/item/weapon/disk/nifsoft/compliance/extra_params()
|
|
return laws
|
|
|
|
// Security Disk //
|
|
/obj/item/weapon/disk/nifsoft/security
|
|
name = "NIFSoft Disk - Security"
|
|
desc = "Contains free NIFSofts useful for security members.\n\
|
|
It has a small label: \n\
|
|
\"Portable NIFSoft Disk. \n\
|
|
Insert directly into brain.\""
|
|
|
|
stored = /datum/nifsoft/package/security
|
|
|
|
/datum/nifsoft/package/security
|
|
software = list(/datum/nifsoft/ar_sec,/datum/nifsoft/flashprot)
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_security
|
|
name = "security nifsoft disks"
|
|
desc = "A box of free nifsofts for security employees."
|
|
icon_state = "disk_kit"
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_security/New()
|
|
..()
|
|
for(var/i = 0 to 7)
|
|
new /obj/item/weapon/disk/nifsoft/security(src)
|
|
|
|
// Engineering Disk //
|
|
/obj/item/weapon/disk/nifsoft/engineering
|
|
name = "NIFSoft Disk - Engineering"
|
|
desc = "Contains free NIFSofts useful for engineering members.\n\
|
|
It has a small label: \n\
|
|
\"Portable NIFSoft Disk. \n\
|
|
Insert directly into brain.\""
|
|
|
|
stored = /datum/nifsoft/package/engineering
|
|
|
|
/datum/nifsoft/package/engineering
|
|
software = list(/datum/nifsoft/ar_eng,/datum/nifsoft/uvblocker)
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_engineering
|
|
name = "engineering nifsoft disks"
|
|
desc = "A box of free nifsofts for engineering employees."
|
|
icon_state = "disk_kit"
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_engineering/New()
|
|
..()
|
|
for(var/i = 0 to 7)
|
|
new /obj/item/weapon/disk/nifsoft/engineering(src)
|
|
|
|
// Medical Disk //
|
|
/obj/item/weapon/disk/nifsoft/medical
|
|
name = "NIFSoft Disk - Medical"
|
|
desc = "Contains free NIFSofts useful for medical members.\n\
|
|
It has a small label: \n\
|
|
\"Portable NIFSoft Disk. \n\
|
|
Insert directly into brain.\""
|
|
|
|
stored = /datum/nifsoft/package/medical
|
|
|
|
/datum/nifsoft/package/medical
|
|
software = list(/datum/nifsoft/ar_med,/datum/nifsoft/crewmonitor)
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_medical
|
|
name = "medical nifsoft disks"
|
|
desc = "A box of free nifsofts for medical employees."
|
|
icon_state = "disk_kit"
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_medical/New()
|
|
..()
|
|
for(var/i = 0 to 7)
|
|
new /obj/item/weapon/disk/nifsoft/medical(src)
|
|
|
|
// Mining Disk //
|
|
/obj/item/weapon/disk/nifsoft/mining
|
|
name = "NIFSoft Disk - Mining"
|
|
desc = "Contains free NIFSofts useful for mining members.\n\
|
|
It has a small label: \n\
|
|
\"Portable NIFSoft Disk. \n\
|
|
Insert directly into brain.\""
|
|
|
|
stored = /datum/nifsoft/package/mining
|
|
|
|
/datum/nifsoft/package/mining
|
|
software = list(/datum/nifsoft/material,/datum/nifsoft/spare_breath)
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_mining
|
|
name = "mining nifsoft disks"
|
|
desc = "A box of free nifsofts for mining employees."
|
|
icon_state = "disk_kit"
|
|
|
|
/obj/item/weapon/storage/box/nifsofts_mining/New()
|
|
..()
|
|
for(var/i = 0 to 7)
|
|
new /obj/item/weapon/disk/nifsoft/mining(src) |