Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #183 from Kolergo/dev
Browse files Browse the repository at this point in the history
Mini Roles - Open Beta 0.1
  • Loading branch information
johncoder0 authored May 28, 2023
2 parents 375177d + 4d0b0a7 commit 105d403
Show file tree
Hide file tree
Showing 6 changed files with 366 additions and 0 deletions.
2 changes: 2 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
#include "code\bos\datums\uplink\implants.dm"
#include "code\bos\datums\uplink\stealth_and_camouflage_items.dm"
#include "code\bos\datums\uplink\uplink_categories.dm"
#include "code\bos\game\gamemodes\mini_roles\mini_roles.dm"
#include "code\bos\game\jobs\access_datum.dm"
#include "code\bos\game\machinery\christmas.dm"
#include "code\bos\game\objects\fakebooks.dm"
Expand Down Expand Up @@ -738,6 +739,7 @@
#include "code\game\antagonist\station\changeling.dm"
#include "code\game\antagonist\station\cultist.dm"
#include "code\game\antagonist\station\loyalist.dm"
#include "code\game\antagonist\station\mini_roles.dm"
#include "code\game\antagonist\station\provocateur.dm"
#include "code\game\antagonist\station\renegade.dm"
#include "code\game\antagonist\station\revolutionary.dm"
Expand Down
1 change: 1 addition & 0 deletions code/__defines/gamemode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#define MODE_MISC_AGITATOR "provocateur"
#define MODE_HUNTER "hunter"
#define MODE_VOXRAIDER "vox raider"
#define MODE_MINI_ROLES "mini roles" //BoS

#define DEFAULT_TELECRYSTAL_AMOUNT 130
#define TEAM_TELECRYSTAL_AMOUNT 780 //DEFAULT_TELECRYSTAL_AMOUNT*6 //proxima
Expand Down
11 changes: 11 additions & 0 deletions code/bos/game/gamemodes/mini_roles/mini_roles.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/datum/game_mode/mini_toles
name = "mini roles"
round_description = "Everybody have they own targets now!"
extended_round_description = "Pure chaos"
config_tag = "miniroles"
required_players = 0
required_enemies = 0
antag_tags = list(MODE_MINI_ROLES)
antag_scaling_coeff = 1
end_on_antag_death = FALSE
latejoin_antag_tags = list(MODE_MINI_ROLES)
337 changes: 337 additions & 0 deletions code/game/antagonist/station/mini_roles.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,337 @@
GLOBAL_DATUM_INIT(mini_role, /datum/antagonist/mini_roles, new)

/datum/antagonist/mini_roles
id = MODE_MINI_ROLES
role_text = "Mini Role"
role_text_plural = "Mini Roles"
antaghud_indicator = "hud_traitor"
flags = ANTAG_RANDSPAWN | ANTAG_VOTABLE
welcome_text = "Хаха, мини роль делает пиу-пиу"
antag_text = "Если Вы видите этот текст, то что-то сломалось. Попросите Стивена починить."
blacklisted_jobs = list()
skill_setter = null
min_player_age = 0

var/datum/mini_role/mini_role_datum //Container for last mini role
var/list/datum/mini_role/all_mini_roles_datums = list() //All in round roles
//Whitelists of mini roles for every branch. Don't forget put new mini roles here
var/list/regcom_roles = list(/datum/mini_role/creditor, /datum/mini_role/pyroman)
var/list/syndicate_roles = list(/datum/mini_role/rat, /datum/mini_role/creditor, /datum/mini_role/pyroman)
var/list/traders_roles = list(/datum/mini_role/contrabandist, /datum/mini_role/rat, /datum/mini_role/creditor, /datum/mini_role/link)
var/list/scum_roles = list(/datum/mini_role/contrabandist, /datum/mini_role/contractor, /datum/mini_role/rat, /datum/mini_role/cannibal, /datum/mini_role/pyroman, /datum/mini_role/torch, /datum/mini_role/link) //Barbars and zeki
var/list/other_roles = list(/datum/mini_role/contrabandist, /datum/mini_role/contractor, /datum/mini_role/pyroman, /datum/mini_role/torch, /datum/mini_role/link)

/datum/antagonist/mini_roles/create_antagonist(var/datum/mind/target, var/move, var/gag_announcement, var/preserve_appearance)

//Mostly default proc copy paste, but with pick of mini role datum
if(!target)
return

var/checks_passed = FALSE
var/choosen_role
while(checks_passed == FALSE)
if(ishuman(target.current))
var/mob/living/carbon/human/man_on_check = target.current
switch(man_on_check.char_branch.name)
if("Regulators") choosen_role = pick(regcom_roles)
if("Consortium of Trans-Star Corporations") choosen_role = pick(syndicate_roles)
if("Free Trade Union") choosen_role = pick(traders_roles)
if("Alternatively Hired") choosen_role = pick(scum_roles)
if("Aborigens") choosen_role = pick(scum_roles)
else choosen_role = pick(other_roles)
else
choosen_role = pick(other_roles)

mini_role_datum = new choosen_role
mini_role_datum.owner = target
all_mini_roles_datums += mini_role_datum
if(!mini_role_datum.additional_check(target.current))
qdel(mini_role_datum)
continue

if(mini_role_datum.double)
if(mini_role_datum.double_act(target))
checks_passed = TRUE
else
qdel(mini_role_datum)
else
checks_passed = TRUE

//Check of target validicity on role
update_antag_mob(target, preserve_appearance)
if(!target.current)
remove_antagonist(target)
return 0
if(flags & ANTAG_CHOOSE_NAME)
spawn(1)
set_antag_name(target.current)
if(move)
place_mob(target.current)
update_leader()
update_icons_added(target)
greet(target)
if(!gag_announcement)
announce_antagonist_spawn()

/datum/antagonist/mini_roles/greet(var/datum/mind/player)

// Takes things from picked mini role datum
player.special_role = mini_role_datum.name
var/name = mini_role_datum.name
var/desc = mini_role_datum.desc
to_chat(player.current, "<span class='danger'><font size=4>Вы - [name]!</font></span>")
if(leader_welcome_text && player == leader)
to_chat(player.current, "<span class='antagdesc'>[get_leader_welcome_text(player.current)]</span>")
else
to_chat(player.current, "<span class='antagdesc'>[get_welcome_text(player.current)]</span>")
to_chat(player.current, "[desc]")

mini_role_datum.special_act(player.current)
create_objectives(player)
src.show_objectives_at_creation(player)
return 1

/datum/antagonist/mini_roles/create_objectives(var/datum/mind/player)
var/datum/objective/micro_obj = new
micro_obj.owner = player
micro_obj.explanation_text = mini_role_datum.objective
player.objectives |= micro_obj
if(mini_role_datum.second_objective)
var/datum/objective/second_micro_obj = new
second_micro_obj.owner = player
second_micro_obj.explanation_text = mini_role_datum.second_objective
player.objectives |= second_micro_obj

/datum/antagonist/mini_roles/equip(mob/living/carbon/human/player)
if(!istype(player))
return

if(!mini_role_datum.gear)
return

var/list/slots = list (
"backpack" = slot_in_backpack,
"left pocket" = slot_l_store,
"right pocket" = slot_r_store,
"left hand" = slot_l_hand,
"right hand" = slot_r_hand,
)

if(mini_role_datum.random_gear)
var/random_count = 0
while(random_count != mini_role_datum.random_gear)
var/thing = pick(mini_role_datum.gear)
mini_role_datum.gear -= thing
var/obj/spawned_thing = new thing(get_turf(player))
for(var/slot in slots)
player.equip_to_slot(spawned_thing, slot)
if(spawned_thing.loc == player)
break
var/obj/item/storage/S = locate() in player.contents
if(istype(S))
spawned_thing.forceMove(S)
random_count += 1
else
for(var/thing in mini_role_datum.gear)
var/obj/spawned_thing = new thing(get_turf(player))
for(var/slot in slots)
player.equip_to_slot(spawned_thing, slot)
if(spawned_thing.loc == player)
break
var/obj/item/storage/S = locate() in player.contents
if(istype(S))
spawned_thing.forceMove(S)

/////
// MINI ROLES DATUMS
/////

/datum/mini_role
var/name
var/desc //Explanation text for role
var/objective //Objective text
var/second_objective
var/datum/mind/owner
var/datum/mind/mini_target //Some particular target(person) for role owner
var/no_robots = FALSE //If true, don't give this role to robot species(Full prothes included)
var/can_latejoin = TRUE //If false, don't give this role to guys who enter after round begining
var/list/gear = list() //What gear give to the role
var/random_gear = FALSE //If not false, give this amount of random items from gear list

var/double = FALSE //Is role work like bounty hunter(give targets to more than one guy)
var/double_text //Text for second man. Keep null, if you want double man to be clueless about target on him
var/double_objective //Target for second man

/datum/mini_role/proc/special_act(var/mob/living/carbon/human/target)
return

/datum/mini_role/proc/double_act(var/datum/mind/obj_owner)
var/list/possible_targets = list()
for(var/datum/mind/possible_target in SSticker.minds)
if((possible_target != obj_owner) && (ishuman(possible_target.current)) && (possible_target.current.stat != DEAD) && (possible_target.special_role != obj_owner.special_role))
possible_targets += possible_target
if(possible_targets.len > 0)
mini_target = pick(possible_targets)
if(double_text)
to_chat(mini_target, "[double_text]")
var/datum/objective/mini_target_obj = new
mini_target_obj.owner = mini_target
mini_target_obj.explanation_text = double_objective
mini_target.objectives |= mini_target_obj
show_objectives(mini_target)
return TRUE
else
return FALSE

/datum/mini_role/proc/additional_check(var/mob/living/carbon/human/target)
if(no_robots)
if((target.species.name == SPECIES_IPC) || (target.species.name == SPECIES_ADHERENT) || (target.species.name == SPECIES_SHELL) || (target.species.name == SPECIES_FBP))
return FALSE

if((!can_latejoin) && (round_duration_in_ticks >> 30)) //About 3 seconds after round start
return FALSE

return TRUE


/datum/mini_role/contrabandist
name = "Контрабандист"
desc = "ЧЗХ, микро трейтор?77"
objective = "Сохраните свой аплинк у себя."
can_latejoin = FALSE

/datum/mini_role/contrabandist/special_act(var/mob/living/carbon/human/target)
var/money = target.mind.assigned_job.economic_power * 1000 + rand(-20,20) * 100
second_objective = "Имейте [money] кредитов к концу смены."
var/TC_amount = rand(40, 80)
var/obj/item/device/radio/uplink/U = new(target, null, TC_amount)
var/obj/O = target.equip_to_storage(U)
if(O)
to_chat(target, "<span class='notice'>Uplink unit can be found in your [O.name].</span>")
else if(target.put_in_hands(U))
to_chat(target, "<span class='notice'>Uplink unit appear in your hands.</span>")

/datum/mini_role/contractor
name = "Контрактник"
desc = "Эрис момент"
objective = "Сохраните свой аплинк у себя. Также сохраните свою роль в секрете."
can_latejoin = FALSE

/datum/mini_role/contractor/special_act(var/mob/living/carbon/human/target)
var/contracts_amount = rand(3,6)
second_objective = "Выполните как минимум [contracts_amount] контрактов до конца смены."
setup_uplink_source(target, 1)


/datum/mini_role/cannibal
name = "Людоед"
desc = "Есть гайских детей"
objective = "Опробуйте хотя бы один свежий кусочек человеческой плоти к концу смены."
no_robots = TRUE
gear = list(/obj/item/material/knife/kitchen/cleaver, /obj/item/handcuffs, /obj/item/tape_roll, /obj/item/device/flash, /obj/item/clothing/mask/chameleon/voice, /obj/item/beartrap)
random_gear = 2


/datum/mini_role/rat
name = "Крыса"
desc = "Доносики"
objective = "Сохраните свою роль и работодателя в тайне."
gear = list(/obj/item/storage/box/syndie_kit/spy, /obj/item/spacecash/bundle/c2000, /obj/item/storage/box/radiokeys, /obj/item/device/uv_light, /obj/item/device/camera, /obj/item/device/taperecorder)
random_gear = 2

/datum/mini_role/rat/special_act(var/mob/living/carbon/human/target)
var/hirer = pick("Ассамблею Альянса", "Посольство ЛСС", "Представительство Синдиката", "Совет ВТС")
second_objective = "Отправьте через факс в [hirer] компрометирующую информацию о миссии на Кадаабе или её членах."


/datum/mini_role/creditor
name = "Кредитор"
desc = "Где деньги"
double = TRUE

/datum/mini_role/creditor/special_act(var/mob/living/carbon/human/target)
var/debt
debt = mini_target.assigned_job.economic_power * 1000 - rand(-40,1) * 100
objective = "[mini_target]([mini_target.assigned_job.title]) задолжал Вам [debt] кредитов. Добейтесь от должника возвращения долга до конца смены."
double_text = "<span class='danger'><font size=3>Вы вспоминаете, что то ли по пьяне, то ли из-за смертельной угрозы, то ли просто по случайности, но Вы должны [owner] [debt] кредитов. Не сказать, что бы Вам хотелось с ними раставаться...</font></span>"
double_objective = "Избегать отдачи долга в [debt] кредитов [owner]([owner.assigned_job.title])."


/datum/mini_role/pyroman
name = "Пироман"
desc = "Ай феар нот мэн, бат..."
objective = "Наслаждайтесь огнём. Сдережируйте небольшой пожар, став его главным зрителем."
gear = list(/obj/item/storage/firstaid/fire, /obj/item/storage/box/beakers, /obj/item/storage/box/matches, /obj/item/reagent_containers/food/drinks/bottle/specialwhiskey, /obj/item/flamethrower, /obj/item/clothing/mask/gas/cbrn)
random_gear = 2


/datum/mini_role/torch
name = "Торчок"
desc = "Хе-хе"
objective = "Запасите несколько доз на будущее. Чем больше - тем лучше."
no_robots = TRUE
gear = list(/obj/item/seeds/ambrosiadeusseed, /obj/item/reagent_containers/hypospray/autoinjector/mindbreaker, /obj/item/storage/firstaid/toxin, /obj/item/storage/box/syringes, /obj/item/storage/pill_bottle/three_eye, /obj/item/gun/projectile/pistol/holdout)
random_gear = 2


/datum/mini_role/link
name = "Связной"
desc = "Шпион драмма"
objective = "Найдите агента, которому Вы должны передать информацию о том, что "
double = TRUE
double_text = "<span class='danger'><font size=3>Где-то рядом с Вами должен находится связной, который может обладать интересной и полезной информацией. Найдите его и получите эту информацию.</font></span>"
double_objective = "Найдите и установите контакт с связным."
gear = list()
random_gear = 2

//Put names of possible coop roles in list below
var/connected_roles = list("Крыса", "Контрактник")

/datum/mini_role/link/additional_check(var/mob/living/carbon/human/target)
var/try_amount = 0
var/list/unmasked_roles = list()
while(try_amount != 4)
var/datum/mini_role/picked_role = pick(GLOB.mini_role.all_mini_roles_datums)
if((is_type_in_list(picked_role.name, connected_roles)) || (picked_role.owner == target.mind))
try_amount += 1
continue
unmasked_roles += picked_role
try_amount += 1

if(unmasked_roles.len == 0)
return FALSE

for(var/datum/mini_role/unmasked in unmasked_roles)
var/add_text = "[unmasked.owner]([unmasked.owner.assigned_job.title]) - [unmasked.name],"
objective += add_text
return TRUE


/datum/mini_role/link/double_act(var/datum/mind/obj_owner)
var/list/possible_targets = list()
for(var/datum/mind/possible_target in SSticker.minds)
if((ishuman(possible_target.current)) && (possible_target.current.stat != DEAD) && (is_type_in_list(possible_target.special_role, connected_roles)))
possible_targets += possible_target
if(possible_targets.len > 0)
mini_target = pick(possible_targets)
to_chat(mini_target, "[double_text]")
to_chat(mini_target, "<u><b>Для поиска потенциальных союзников Вы были снабжены опозновательными словами:</b></u>")
to_chat(mini_target, "<b>Кодовые слова</b>: <span class='danger'>[GLOB.antag_code_phrase]</span>")
to_chat(mini_target, "<b>Кодовые ответы</b>: <span class='danger'>[GLOB.antag_code_response]</span>")
mini_target.StoreMemory("<b>Кодовые слова</b>: [GLOB.antag_code_phrase]", /decl/memory_options/system)
mini_target.StoreMemory("<b>Кодовые ответы</b>: [GLOB.antag_code_response]", /decl/memory_options/system)

to_chat(owner, "<u><b>Для поиска потенциальных союзников Вы были снабжены опозновательными словами:</b></u>")
to_chat(owner, "<b>Кодовые слова</b>: <span class='danger'>[GLOB.antag_code_phrase]</span>")
to_chat(owner, "<b>Кодовые ответы</b>: <span class='danger'>[GLOB.antag_code_response]</span>")
owner.StoreMemory("<b>Кодовые слова</b>: [GLOB.antag_code_phrase]", /decl/memory_options/system)
owner.StoreMemory("<b>Кодовые ответы</b>: [GLOB.antag_code_response]", /decl/memory_options/system)

var/datum/objective/mini_target_obj = new
mini_target_obj.owner = mini_target
mini_target_obj.explanation_text = double_objective
mini_target.objectives |= mini_target_obj
show_objectives(mini_target)
return TRUE
else
return FALSE
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
var/list/all_antag_types = GLOB.all_antag_types_
for(var/antag_type in all_antag_types)
var/datum/antagonist/antag = all_antag_types[antag_type]
if(antag.id == MODE_MINI_ROLES) //BoS
continue

. += "<tr><td>[antag.role_text]: </td><td>"
if(jobban_isbanned(preference_mob(), antag.id) || (antag.id == MODE_MALFUNCTION && jobban_isbanned(preference_mob(), "AI")))
. += "<span class='danger'>\[BANNED\]</span><br>"
Expand All @@ -55,6 +58,12 @@
. += "<td><span class='linkOn'>Yes</span> <a href='?src=\ref[src];del_special=[BE_PAI]'>No</a></br></td></tr>"
else
. += "<td><a href='?src=\ref[src];add_special=[BE_PAI]'>Yes</a> <span class='linkOn'>No</span></br></td></tr>"
for(var/antag_type in all_antag_types) //BoS
var/datum/antagonist/antag = all_antag_types[antag_type]
if(antag.id == MODE_MINI_ROLES)
. += "<tr><td>[antag.role_text]: </td><td>"
. += "<span class='linkOn'>Always</span>"
pref.be_special_role |= MODE_MINI_ROLES
. += "</table>"
. = jointext(.,null)

Expand Down
Loading

0 comments on commit 105d403

Please sign in to comment.