Skip to content

Commit

Permalink
[MIRROR] Allows domains to forgo giving bitrunners their disk items a…
Browse files Browse the repository at this point in the history
…nd spells if that is desired [MDB IGNORE] (#177)

* Allows domains to forgo giving bitrunners their disk items and spells if that is desired (#78959)

---------

Co-authored-by: Paxilmaniac <[email protected]>
Co-authored-by: Ghom <42542238+Ghommie@ users.noreply.github.com>
  • Loading branch information
3 people authored Oct 20, 2023
1 parent 9f37a7b commit 6e35810
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/modules/bitrunning/objects/netpod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
return
current_avatar = server.generate_avatar(wayout, netsuit)
avatar_ref = WEAKREF(current_avatar)
server.stock_gear(current_avatar, neo)
server.stock_gear(current_avatar, neo, generated_domain)

neo.set_static_vision(3 SECONDS)
protect_occupant(occupant)
Expand Down
23 changes: 20 additions & 3 deletions code/modules/bitrunning/server/obj_generation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,28 @@
return wayout

/// Scans over neo's contents for bitrunning tech disks. Loads the items or abilities onto the avatar.
/obj/machinery/quantum_server/proc/stock_gear(mob/living/carbon/human/avatar, mob/living/carbon/human/neo)
/obj/machinery/quantum_server/proc/stock_gear(mob/living/carbon/human/avatar, mob/living/carbon/human/neo, datum/lazy_template/virtual_domain/generated_domain)
var/domain_forbids_items = generated_domain.forbids_disk_items
var/domain_forbids_spells = generated_domain.forbids_disk_spells

var/import_ban = list()
var/disk_ban = list()
if(domain_forbids_items)
import_ban += "smuggled digital equipment"
disk_ban += "items"
if(domain_forbids_spells)
import_ban += "imported_abilities"
disk_ban += "powers"
if(import_ban)
to_chat(neo, span_warning("This domain forbids the use of [english_list(import_ban)], your disk [english_list(disk_ban)] will not be granted!"))

var/failed = FALSE

// We don't need to bother going over the disks if neither of the types can be used.
if(domain_forbids_spells && domain_forbids_items)
return
for(var/obj/item/bitrunning_disk/disk in neo.get_contents())
if(istype(disk, /obj/item/bitrunning_disk/ability))
if(istype(disk, /obj/item/bitrunning_disk/ability) && !domain_forbids_spells)
var/obj/item/bitrunning_disk/ability/ability_disk = disk

if(isnull(ability_disk.granted_action))
Expand All @@ -88,7 +105,7 @@
our_action.Grant(avatar)
continue

if(istype(disk, /obj/item/bitrunning_disk/item))
if(istype(disk, /obj/item/bitrunning_disk/item) && !domain_forbids_items)
var/obj/item/bitrunning_disk/item/item_disk = disk

if(isnull(item_disk.granted_item))
Expand Down
4 changes: 4 additions & 0 deletions code/modules/bitrunning/virtual_domain/virtual_domain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
var/filename = "virtual_domain.dmm"
/// Any outfit that you wish to force on avatars. Overrides preferences
var/datum/outfit/forced_outfit
/// If this domain blocks the use of items from disks, for whatever reason
var/forbids_disk_items = FALSE
/// If this domain blocks the use of spells from disks, for whatever reason
var/forbids_disk_spells = FALSE
/// Information given to connected clients via ability
var/help_text
// Name to show in the UI
Expand Down

0 comments on commit 6e35810

Please sign in to comment.